mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
fixed a merge issue
This commit is contained in:
parent
9e0a2a65d1
commit
be408e2d70
3 changed files with 10 additions and 15 deletions
|
@ -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,7 @@ 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, 0, 0, 0);
|
this.entityClient = this.currentRecipe.makeEntity(this.world, BlockPos.ZERO);
|
||||||
this.entityClient.setPosition(this.spawnX, this.pos.getY() + 1, this.spawnZ);
|
this.entityClient.setPosition(this.spawnX, this.pos.getY() + 1, this.spawnZ);
|
||||||
}
|
}
|
||||||
AxisAlignedBB bounds = this.entityClient.getBoundingBox();
|
AxisAlignedBB bounds = this.entityClient.getBoundingBox();
|
||||||
|
|
|
@ -23,6 +23,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 net.minecraft.util.math.vector.Quaternion;
|
import net.minecraft.util.math.vector.Quaternion;
|
||||||
import net.minecraft.util.math.vector.Vector3f;
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
|
|
||||||
|
@ -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.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
@ -39,18 +40,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((ServerWorld) 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((ServerWorld) world, world.getDifficultyForLocation(living.getPosition()), SpawnReason.SPAWNER, null, null);
|
|
||||||
}
|
|
||||||
return entity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue