This commit is contained in:
parent
464cccaa3e
commit
74c3aab720
|
@ -266,13 +266,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.mojang:realms:1.10.21",
|
"name": "com.mojang:realms:1.10.22",
|
||||||
"downloads": {
|
"downloads": {
|
||||||
"artifact": {
|
"artifact": {
|
||||||
"size": 7134971,
|
"size": 7135057,
|
||||||
"sha1": "cfc457545a482027c066f13c262b9a4df64bc3f3",
|
"sha1": "bd0dccebdf3744c75f1ca20063f16e8f7d5e663f",
|
||||||
"path": "com/mojang/realms/1.10.21/realms-1.10.21.jar",
|
"path": "com/mojang/realms/1.10.22/realms-1.10.22.jar",
|
||||||
"url": "https://libraries.minecraft.net/com/mojang/realms/1.10.21/realms-1.10.21.jar"
|
"url": "https://libraries.minecraft.net/com/mojang/realms/1.10.22/realms-1.10.22.jar"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -719,6 +719,6 @@
|
||||||
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}",
|
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}",
|
||||||
"minimumLauncherVersion": 18,
|
"minimumLauncherVersion": 18,
|
||||||
"releaseTime": "2017-09-18T08:39:46+00:00",
|
"releaseTime": "2017-09-18T08:39:46+00:00",
|
||||||
"time": "2018-05-25T15:20:02+00:00",
|
"time": "2018-06-25T15:37:20+00:00",
|
||||||
"type": "release"
|
"type": "release"
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,6 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
|
||||||
" at ( " + spawnMsg.rawX + "," + spawnMsg.rawY + ", " + spawnMsg.rawZ + ") Please contact mod author or server admin.");
|
" at ( " + spawnMsg.rawX + "," + spawnMsg.rawY + ", " + spawnMsg.rawZ + ") Please contact mod author or server admin.");
|
||||||
}
|
}
|
||||||
WorldClient wc = FMLClientHandler.instance().getWorldClient();
|
WorldClient wc = FMLClientHandler.instance().getWorldClient();
|
||||||
Class<? extends Entity> cls = er.getEntityClass();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Entity entity;
|
Entity entity;
|
||||||
|
@ -85,7 +84,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
|
||||||
entity = er.doCustomSpawning(spawnMsg);
|
entity = er.doCustomSpawning(spawnMsg);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
entity = cls.getConstructor(World.class).newInstance(wc);
|
entity = er.newInstance(wc);
|
||||||
|
|
||||||
int offset = spawnMsg.entityId - entity.getEntityId();
|
int offset = spawnMsg.entityId - entity.getEntityId();
|
||||||
entity.setEntityId(spawnMsg.entityId);
|
entity.setEntityId(spawnMsg.entityId);
|
||||||
|
|
|
@ -276,15 +276,6 @@ public final class EntityEntryBuilder<E extends Entity>
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
private EntityRegistry.EntityRegistration createRegistration()
|
|
||||||
{
|
|
||||||
return EntityRegistry.instance().new EntityRegistration(
|
|
||||||
this.mod, this.id, this.entity, this.name, this.network,
|
|
||||||
this.trackingRange, this.trackingUpdateFrequency, this.trackingVelocityUpdates
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerStatistics()
|
private void registerStatistics()
|
||||||
{
|
{
|
||||||
if (!this.statisticsRegistered && (this.killEntityStatistic != null && this.entityKilledByStatistic != null))
|
if (!this.statisticsRegistered && (this.killEntityStatistic != null && this.entityKilledByStatistic != null))
|
||||||
|
@ -340,7 +331,7 @@ public final class EntityEntryBuilder<E extends Entity>
|
||||||
if (this.added) return;
|
if (this.added) return;
|
||||||
this.added = true;
|
this.added = true;
|
||||||
EntityEntryBuilder.this.registerStatistics();
|
EntityEntryBuilder.this.registerStatistics();
|
||||||
EntityRegistry.instance().insert(EntityEntryBuilder.this.entity, EntityEntryBuilder.this.createRegistration());
|
EntityRegistry.instance().insert(EntityEntryBuilder.this.entity, createRegistration());
|
||||||
if (EntityEntryBuilder.this.spawns != null)
|
if (EntityEntryBuilder.this.spawns != null)
|
||||||
{
|
{
|
||||||
for (final Spawn spawn : EntityEntryBuilder.this.spawns)
|
for (final Spawn spawn : EntityEntryBuilder.this.spawns)
|
||||||
|
@ -350,6 +341,17 @@ public final class EntityEntryBuilder<E extends Entity>
|
||||||
EntityEntryBuilder.this.spawns = null;
|
EntityEntryBuilder.this.spawns = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private EntityRegistry.EntityRegistration createRegistration()
|
||||||
|
{
|
||||||
|
EntityEntryBuilder<E> builder = EntityEntryBuilder.this;
|
||||||
|
return EntityRegistry.instance().new EntityRegistration(
|
||||||
|
builder.mod, builder.id, builder.entity, builder.name, builder.network,
|
||||||
|
builder.trackingRange, builder.trackingUpdateFrequency, builder.trackingVelocityUpdates, this.factory
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class Spawn
|
public final class Spawn
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.EntityTracker;
|
import net.minecraft.entity.EntityTracker;
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.Biome.SpawnListEntry;
|
import net.minecraft.world.biome.Biome.SpawnListEntry;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
@ -48,7 +49,9 @@ public class EntityRegistry
|
||||||
{
|
{
|
||||||
public class EntityRegistration
|
public class EntityRegistration
|
||||||
{
|
{
|
||||||
|
@Deprecated
|
||||||
private Class<? extends Entity> entityClass;
|
private Class<? extends Entity> entityClass;
|
||||||
|
private Function<World, ? extends Entity> factory;
|
||||||
private ModContainer container;
|
private ModContainer container;
|
||||||
private ResourceLocation regName;
|
private ResourceLocation regName;
|
||||||
private String entityName;
|
private String entityName;
|
||||||
|
@ -58,7 +61,14 @@ public class EntityRegistry
|
||||||
private boolean sendsVelocityUpdates;
|
private boolean sendsVelocityUpdates;
|
||||||
private Function<EntitySpawnMessage, Entity> customSpawnCallback;
|
private Function<EntitySpawnMessage, Entity> customSpawnCallback;
|
||||||
private boolean usesVanillaSpawning;
|
private boolean usesVanillaSpawning;
|
||||||
|
|
||||||
|
@Deprecated //1.13
|
||||||
public EntityRegistration(ModContainer mc, ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
public EntityRegistration(ModContainer mc, ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
||||||
|
{
|
||||||
|
this(mc, registryName, entityClass, entityName, id, trackingRange, updateFrequency, sendsVelocityUpdates, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityRegistration(ModContainer mc, ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, Function<World, ? extends Entity> factory)
|
||||||
{
|
{
|
||||||
this.container = mc;
|
this.container = mc;
|
||||||
this.regName = registryName;
|
this.regName = registryName;
|
||||||
|
@ -68,15 +78,27 @@ public class EntityRegistry
|
||||||
this.trackingRange = trackingRange;
|
this.trackingRange = trackingRange;
|
||||||
this.updateFrequency = updateFrequency;
|
this.updateFrequency = updateFrequency;
|
||||||
this.sendsVelocityUpdates = sendsVelocityUpdates;
|
this.sendsVelocityUpdates = sendsVelocityUpdates;
|
||||||
|
this.factory = factory != null ? factory :
|
||||||
|
new EntityEntryBuilder.ConstructorFactory<Entity>(entityClass) {
|
||||||
|
@Override
|
||||||
|
protected String describeEntity() {
|
||||||
|
return String.valueOf(EntityRegistration.this.getRegistryName());
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
public ResourceLocation getRegistryName()
|
public ResourceLocation getRegistryName()
|
||||||
{
|
{
|
||||||
return regName;
|
return regName;
|
||||||
}
|
}
|
||||||
|
@Deprecated //Used only for creating a new instance in EntitySpawnHandler, use newInstance(world) instead.
|
||||||
public Class<? extends Entity> getEntityClass()
|
public Class<? extends Entity> getEntityClass()
|
||||||
{
|
{
|
||||||
return entityClass;
|
return entityClass;
|
||||||
}
|
}
|
||||||
|
public Entity newInstance(World world)
|
||||||
|
{
|
||||||
|
return this.factory.apply(world);
|
||||||
|
}
|
||||||
public ModContainer getContainer()
|
public ModContainer getContainer()
|
||||||
{
|
{
|
||||||
return container;
|
return container;
|
||||||
|
|
Loading…
Reference in New Issue