mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
Fixed some mobs causing client crashes when spawning with the altar of birthing
Closes #140
This commit is contained in:
parent
71742c5b3a
commit
1ccdc83c1f
4 changed files with 12 additions and 16 deletions
|
@ -110,7 +110,7 @@ dependencies {
|
||||||
compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2:api")
|
compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2:api")
|
||||||
|
|
||||||
compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.15.1:6.0.0.4")
|
compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.15.1:6.0.0.4")
|
||||||
compile fg.deobf("quarris.enchantability:Enchantability:8.4.23")
|
compile fg.deobf("quarris.enchantability:Enchantability:8.1.17")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example for how to get properties into the manifest for reading by the runtime..
|
// Example for how to get properties into the manifest for reading by the runtime..
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
||||||
|
|
||||||
this.time += 10;
|
this.time += 10;
|
||||||
if (this.time >= this.currentRecipe.time) {
|
if (this.time >= this.currentRecipe.time) {
|
||||||
Entity entity = this.currentRecipe.makeEntity(this.world, this.spawnX, this.pos.getY() + 1, this.spawnZ);
|
Entity entity = this.currentRecipe.makeEntity(this.world, new BlockPos(this.spawnX, this.pos.getY() + 1, this.spawnZ));
|
||||||
this.world.addEntity(entity);
|
this.world.addEntity(entity);
|
||||||
|
|
||||||
this.currentRecipe = null;
|
this.currentRecipe = null;
|
||||||
|
@ -121,7 +121,8 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
||||||
this.world.rand.nextFloat() + 0.5F);
|
this.world.rand.nextFloat() + 0.5F);
|
||||||
|
|
||||||
if (this.entityClient == null) {
|
if (this.entityClient == null) {
|
||||||
this.entityClient = this.currentRecipe.makeEntity(this.world, this.spawnX, this.pos.getY() + 1, this.spawnZ);
|
this.entityClient = this.currentRecipe.makeEntity(this.world, BlockPos.ZERO);
|
||||||
|
this.entityClient.setPosition(this.spawnX, this.pos.getY() + 1, this.spawnZ);
|
||||||
}
|
}
|
||||||
AxisAlignedBB bounds = this.entityClient.getBoundingBox();
|
AxisAlignedBB bounds = this.entityClient.getBoundingBox();
|
||||||
for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--)
|
for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.SpawnEggItem;
|
import net.minecraft.item.SpawnEggItem;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -126,7 +127,7 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
||||||
Minecraft minecraft = Minecraft.getInstance();
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
Entity entity = this.entityCache.get(recipe.entity);
|
Entity entity = this.entityCache.get(recipe.entity);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = recipe.makeEntity(minecraft.world, 0, 0, 0);
|
entity = recipe.makeEntity(minecraft.world, BlockPos.ZERO);
|
||||||
this.entityCache.put(recipe.entity, entity);
|
this.entityCache.put(recipe.entity, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.item.crafting.IRecipeType;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
@ -37,18 +38,11 @@ public class AnimalSpawnerRecipe extends ModRecipe {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity makeEntity(World world, double x, double y, double z) {
|
public Entity makeEntity(World world, BlockPos pos) {
|
||||||
Entity entity = this.entity.create(world);
|
// passed position is zero on the client, so we don't want to do initialization stuff for the entity
|
||||||
if (x == 0 && y == 0 && z == 0)
|
if (pos == BlockPos.ZERO)
|
||||||
return entity;
|
return this.entity.create(world);
|
||||||
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360F), 0F);
|
return this.entity.create(world, null, null, null, pos, SpawnReason.SPAWNER, false, false);
|
||||||
if (entity instanceof MobEntity) {
|
|
||||||
MobEntity living = (MobEntity) entity;
|
|
||||||
living.rotationYawHead = entity.rotationYaw;
|
|
||||||
living.renderYawOffset = entity.rotationYaw;
|
|
||||||
living.onInitialSpawn(world, world.getDifficultyForLocation(living.getPosition()), SpawnReason.SPAWNER, null, null);
|
|
||||||
}
|
|
||||||
return entity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue