Update forge, Replace spawn->addEntity, misc fixes in TE's

This commit is contained in:
Vincent Lee committed 2019-06-21 23:43:52 -07:00
1 parent cce2f81d15
commit 070093c9e5
68 files changed
+136 -169

No files matched your search

@@ -22,7 +22,7 @@ public interface IManaBurst {
boolean isFake();
void setMotion(double x, double y, double z);
void setBurstMotion(double x, double y, double z);
int getColor();
@@ -74,7 +74,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
blaze.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() - 1.95D, pos.getZ() + 0.5D, 0.0F, 0.0F);
blaze.deathLootTable = LOOT_TABLE;
blaze.onInitialSpawn(world, world.getDifficultyForLocation(pos), SpawnReason.EVENT, null, null);
world.spawnEntity(blaze);
world.addEntity(blaze);
}
}
@@ -39,7 +39,7 @@ public class BlockManaBomb extends BlockMod implements IManaTrigger, ILexiconabl
world.removeBlock(pos);
EntityManaStorm storm = new EntityManaStorm(world);
storm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
world.spawnEntity(storm);
world.addEntity(storm);
}
}
@@ -218,7 +218,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
world.setBlockState(pos.offset(dir), ModBlocks.pistonRelay.getDefaultState());
else if(!world.isRemote) {
ItemStack stack = new ItemStack(ModBlocks.pistonRelay);
world.spawnEntity(new ItemEntity(world, x + dir.getXOffset(), y + dir.getYOffset(), z + dir.getZOffset(), stack));
world.addEntity(new ItemEntity(world, x + dir.getXOffset(), y + dir.getYOffset(), z + dir.getZOffset(), stack));
}
checkedCoords.add(s);
newPos = new DimWithPos(world.getDimension().getType(), pos.offset(dir));
@@ -67,7 +67,7 @@ public class BehaviourPoolMinecart extends DefaultDispenseItemBehavior {
entityminecart.setCustomName(stack.getDisplayName());
}
world.spawnEntity(entityminecart);
world.addEntity(entityminecart);
stack.shrink(1);
return stack;
}
@@ -116,7 +116,7 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
if(!enchanter.itemToEnchant.isEmpty()) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
}
world.updateComparatorOutputLevel(pos, state.getBlock());
@@ -176,7 +176,7 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, ILex
if(inv.paddingColor != null) {
ItemStack padding = new ItemStack(ColorHelper.WOOL_MAP.get(inv.paddingColor));
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), padding));
world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), padding));
}
InventoryHelper.dropInventory(inv, world, state, pos);
@@ -69,7 +69,7 @@ public class BlockTerraPlate extends BlockMod implements ILexiconable {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, target);
item.setPickupDelay(40);
item.setMotion(Vec3d.ZERO);
world.spawnEntity(item);
world.addEntity(item);
}
return true;
@@ -62,7 +62,7 @@ public class SubTileClayconia extends TileEntityFunctionalFlower {
if(ConfigHandler.COMMON.blockBreakParticles.get())
getWorld().playEvent(2001, coords, Block.getStateId(Blocks.SAND.getDefaultState()));
ItemEntity item = new ItemEntity(getWorld(), coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, new ItemStack(Items.CLAY_BALL));
getWorld().spawnEntity(item);
getWorld().addEntity(item);
mana -= COST;
}
}
@@ -156,7 +156,7 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
entity.getEntityData().put(TAG_ITEMSTACK_TO_DROP, cmp);
entity.onInitialSpawn(world.getDifficultyForLocation(pos), null, null);
world.spawnEntity(entity);
world.addEntity(entity);
entity.spawnExplosionParticle();
mana -= COST;
@@ -28,6 +28,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.BotaniaAPI;
@@ -183,7 +184,8 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
blockParticle(state);
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.ALFPORTAL_STATE, newState), 1 | 2);
} else if(explode) {
world.createExplosion(null, pos.getX() + .5, pos.getY() + 2.0, pos.getZ() + .5, 3f, true);
world.createExplosion(null, pos.getX() + .5, pos.getY() + 2.0, pos.getZ() + .5,
3f, Explosion.Mode.DESTROY);
explode = false;
}
}
@@ -276,7 +278,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
private void spawnItem(ItemStack stack) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, stack);
item.getEntityData().putBoolean(TAG_PORTAL_FLAG, true);
world.spawnEntity(item);
world.addEntity(item);
ticksSinceLastItem = 0;
}
@@ -158,7 +158,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
ItemStack output = recipe.getOutput().copy();
ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
outputItem.addTag(ITEM_TAG_APOTHECARY_SPAWNED);
world.spawnEntity(outputItem);
world.addEntity(outputItem);
setWater(false);
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
@@ -35,7 +35,7 @@ public class TileBifrost extends TileMod implements ITickableTileEntity {
public void tick() {
if(!world.isRemote) {
if(ticks <= 0) {
world.removeBlock(pos);
world.removeBlock(pos, false);
} else ticks--;
}
}
@@ -140,7 +140,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
ItemStack output = recipe.getOutput(itemHandler.getStackInSlot(0));
ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.spawnEntity(outputItem);
world.addEntity(outputItem);
world.addBlockEvent(getPos(), ModBlocks.brewery, CRAFT_EFFECT_EVENT, recipe.getBrew().getColor(output));
for(int i = 0; i < getSizeInventory(); i++)
@@ -52,7 +52,7 @@ public class TileCamo extends TileMod {
public void onDataPacket(NetworkManager manager, SUpdateTileEntityPacket packet) {
super.onDataPacket(manager, packet);
requestModelDataUpdate();
world.markBlockRangeForRenderUpdate(pos, pos);
world.markForRerender(pos);
}
@Nonnull
@@ -48,7 +48,7 @@ public class TileCell extends TileMod {
validCoords = getPos();
ticked = true;
} else if(!matchCoords(validCoords, this) || !matchCoords(flowerCoords, flower))
world.removeBlock(pos);
world.removeBlock(pos, false);
}
public boolean isSameFlower(TileEntity flower) {
@@ -15,6 +15,7 @@ import net.minecraft.entity.AgeableEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.merchant.villager.VillagerData;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.ShulkerEntity;
import net.minecraft.entity.passive.ChickenEntity;
@@ -36,11 +37,11 @@ import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.passive.WolfEntity;
import net.minecraft.entity.passive.horse.LlamaEntity;
import net.minecraft.entity.villager.IVillagerType;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -87,7 +88,10 @@ public class TileCocoon extends TileMod implements ITickableTileEntity{
entity = EntityType.SHULKER.create(world);
} else if(Math.random() < villagerChance) {
VillagerEntity villager = EntityType.VILLAGER.create(world);
VillagerRegistry.setRandomProfession(villager, world.rand);
if(villager != null) {
IVillagerType type = IVillagerType.byBiome(world.getBiome(pos));
villager.setVillagerData(villager.getVillagerData().withType(type));
}
entity = villager;
} else {
float specialChance = 0.05F;
@@ -139,7 +143,7 @@ public class TileCocoon extends TileMod implements ITickableTileEntity{
if(entity instanceof AgeableEntity)
((AgeableEntity) entity).setGrowingAge(-24000);
entity.onInitialSpawn(world, world.getDifficultyForLocation(getPos()), SpawnReason.EVENT, null, null);
world.spawnEntity(entity);
world.addEntity(entity);
entity.spawnExplosionParticle();
}
}
@@ -16,14 +16,16 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.world.World;
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -35,6 +37,7 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Optional;
public class TileCraftCrate extends TileOpenCrate {
@ObjectHolder(LibMisc.MOD_ID + ":" + LibBlockNames.CRAFT_CRATE)
@@ -104,7 +107,7 @@ public class TileCraftCrate extends TileOpenCrate {
if(fullCheck && !isFull())
return false;
CraftingInventory craft = new CraftingInventory(new Container() {
CraftingInventory craft = new CraftingInventory(new Container(ContainerType.CRAFTING, -1) {
@Override
public boolean canInteractWith(@Nonnull PlayerEntity player) {
return false;
@@ -119,22 +122,21 @@ public class TileCraftCrate extends TileOpenCrate {
craft.setInventorySlotContents(i, stack);
}
for(IRecipe recipe : world.getRecipeManager().getRecipes(VanillaRecipeTypes.CRAFTING))
if(recipe.matches(craft, world)) {
itemHandler.setStackInSlot(9, recipe.getCraftingResult(craft));
Optional<ICraftingRecipe> matchingRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, craft, world);
matchingRecipe.ifPresent(recipe -> {
itemHandler.setStackInSlot(9, recipe.getCraftingResult(craft));
List<ItemStack> remainders = recipe.getRemainingItems(craft);
for(int i = 0; i < craft.getSizeInventory(); i++) {
ItemStack s = remainders.get(i);
if(!itemHandler.getStackInSlot(i).isEmpty()
List<ItemStack> remainders = recipe.getRemainingItems(craft);
for(int i = 0; i < craft.getSizeInventory(); i++) {
ItemStack s = remainders.get(i);
if(!itemHandler.getStackInSlot(i).isEmpty()
&& itemHandler.getStackInSlot(i).getItem() == ModItems.placeholder)
continue;
itemHandler.setStackInSlot(i, s);
}
return true;
continue;
itemHandler.setStackInSlot(i, s);
}
});
return false;
return matchingRecipe.isPresent();
}
boolean isFull() {
@@ -120,7 +120,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
for(BlockPos f : FLOWER_LOCATIONS)
mb.addComponent(new FlowerComponent(f.up(), ModBlocks.whiteFlower));
mb.addComponent(BlockPos.ORIGIN.up(), Blocks.LAPIS_BLOCK.getDefaultState());
mb.addComponent(BlockPos.ZERO.up(), Blocks.LAPIS_BLOCK.getDefaultState());
return mb.makeSet();
}
@@ -20,6 +20,7 @@ import net.minecraft.particles.RedstoneParticleData;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.ServerWorld;
import net.minecraftforge.registries.ObjectHolder;
@@ -54,7 +55,7 @@ public class TileEnderEye extends TileMod implements ITickableTileEntity {
continue;
RayTraceResult pos = ToolCommons.raytraceFromEntity(world, player, true, 64);
if(pos != null && pos.getBlockPos() != null && pos.getBlockPos().equals(getPos())) {
if(pos.getType() == RayTraceResult.Type.BLOCK && ((BlockRayTraceResult) pos).getPos().equals(getPos())) {
looking = true;
break;
}
@@ -30,7 +30,7 @@ public class TileFakeAir extends TileMod {
private static final String TAG_FLOWER_Y = "flowerY";
private static final String TAG_FLOWER_Z = "flowerZ";
private BlockPos flowerPos = BlockPos.ORIGIN;
private BlockPos flowerPos = BlockPos.ZERO;
public TileFakeAir() {
super(TYPE);
@@ -79,7 +79,7 @@ public class TileFloatingFlower extends TileMod {
IFloatingFlower.IslandType oldType = floatingData.getIslandType();
super.onDataPacket(net, packet);
if(oldType != floatingData.getIslandType()) {
world.markBlockRangeForRenderUpdate(pos, pos);
world.markForRerender(pos);
}
}
@@ -29,6 +29,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
@@ -79,7 +80,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
return;
EntityPlayerMover mover = new EntityPlayerMover(world, pos, nextDest);
world.spawnEntity(mover);
world.addEntity(mover);
e.startRiding(mover);
if(!(e instanceof ItemEntity)) {
mover.playSound(ModSounds.lightRelay, 0.2F, (float) Math.random() * 0.3F + 0.7F);
@@ -259,7 +260,6 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
public EntityPlayerMover(World world) {
super(TYPE, world);
setSize(0F, 0F);
noClip = true;
}
@@ -271,7 +271,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
@Override
protected void registerData() {
dataManager.register(EXIT_POS, BlockPos.ORIGIN);
dataManager.register(EXIT_POS, BlockPos.ZERO);
}
@Override
@@ -358,6 +358,12 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
cmp.putInt(TAG_EXIT_Z, exit.getZ());
}
@Override
public IPacket<?> createSpawnPacket() {
// todo 1.14 ??
return null;
}
public BlockPos getExitPos() {
return dataManager.get(EXIT_POS);
}
@@ -21,6 +21,7 @@ import net.minecraft.util.Direction;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -75,14 +76,12 @@ public class TileOpenCrate extends TileSimpleInventory implements ITickableTileE
public void eject(ItemStack stack, boolean redstone) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() - 0.5, pos.getZ() + 0.5, stack);
item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
item.setMotion(Vec3d.ZERO);
if (redstone)
item.age = -200;
itemHandler.setStackInSlot(0, ItemStack.EMPTY);
world.spawnEntity(item);
world.addEntity(item);
}
public boolean onWanded(World world, PlayerEntity player, ItemStack stack) {
@@ -27,6 +27,7 @@ import net.minecraft.util.Hand;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.registries.ObjectHolder;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
@@ -83,8 +84,8 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
ItemStack toSpawn = player != null && player.abilities.isCreativeMode ? stack.copy().split(1) : stack.split(1);
ItemEntity item = new ItemEntity(world, getPos().getX() + 0.5, getPos().getY() + 1, getPos().getZ() + 0.5, toSpawn);
item.setPickupDelay(40);
item.motionX = item.motionY = item.motionZ = 0;
world.spawnEntity(item);
item.setMotion(Vec3d.ZERO);
world.addEntity(item);
}
return true;
@@ -262,7 +263,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
recieveMana(-mana);
ItemStack output = recipe.getOutput().copy();
ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.spawnEntity(outputItem);
world.addEntity(outputItem);
currentRecipe = null;
world.addBlockEvent(getPos(), ModBlocks.runeAltar, SET_COOLDOWN_EVENT, 60);
world.addBlockEvent(getPos(), ModBlocks.runeAltar, CRAFT_EFFECT_EVENT, 0);
@@ -273,7 +274,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemRune && (player == null || !player.abilities.isCreativeMode)) {
ItemEntity outputRune = new ItemEntity(world, getPos().getX() + 0.5, getPos().getY() + 1.5, getPos().getZ() + 0.5, stack.copy());
world.spawnEntity(outputRune);
world.addEntity(outputRune);
}
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
@@ -112,7 +112,7 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable
((MobEntity)entity).onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), (ILivingEntityData)null, (CompoundNBT)null);
}
AnvilChunkLoader.spawnEntity(entity, world);
AnvilChunkLoader.addEntity(entity, world);
world.playEvent(2004, blockpos, 0);
if (entityliving != null) {
entityliving.spawnExplosionParticle();
@@ -164,7 +164,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
for(ItemStack reqStack : stacks)
if(requestTarget != null) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, reqStack);
world.spawnEntity(item);
world.addEntity(item);
itemCount -= reqStack.getCount();
did = true;
}
@@ -94,7 +94,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
ItemHandlerHelper.insertItemStacked(inv, reqStack, false);
else {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, reqStack);
world.spawnEntity(item);
world.addEntity(item);
}
}
}
@@ -226,7 +226,7 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
for(ItemStack stack : stacks)
if(!stack.isEmpty()) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, stack);
world.spawnEntity(item);
world.addEntity(item);
}
}
@@ -41,7 +41,7 @@ public class TileCorporeaRetainer extends TileMod {
private static final int REQUEST_STRING = 2;
private boolean pendingRequest = false;
private BlockPos requestPos = BlockPos.ORIGIN;
private BlockPos requestPos = BlockPos.ZERO;
private Object request;
private int requestCount;
private int compValue;
@@ -198,7 +198,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
ItemStack output = recipe.getOutput().copy();
ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
outputItem.age = 105;
world.spawnEntity(outputItem);
world.addEntity(outputItem);
craftingFanciness();
return true;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.block.tile.mana;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
@@ -58,7 +57,9 @@ public class TilePrism extends TileSimpleInventory {
burst.setMinManaLoss(properties.ticksBeforeManaLoss);
burst.setManaLossPerTick(properties.manaLossPerTick);
burst.setGravity(properties.gravity);
burst.setMotion(burstEntity.motionX * properties.motionModifier, burstEntity.motionY * properties.motionModifier,burstEntity.motionZ * properties.motionModifier);
burst.setBurstMotion(burstEntity.getMotion().getX() * properties.motionModifier,
burstEntity.getMotion().getY() * properties.motionModifier,
burstEntity.getMotion().getZ() * properties.motionModifier);
}
}
}
@@ -24,6 +24,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
@@ -40,7 +41,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceFluidMode;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShape;
@@ -403,7 +404,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.ding, SoundCategory.PLAYERS, 0.1F, 1);
} else {
RayTraceResult pos = rayTraceFromEntity(world, player, true);
RayTraceResult pos = Item.rayTrace(world, player, RayTraceContext.FluidMode.ANY);
if(pos instanceof BlockRayTraceResult && !world.isRemote) {
double x = pos.getHitVec().x - getPos().getX() - 0.5;
double y = pos.getHitVec().y - getPos().getY() - 0.5;
@@ -454,7 +455,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
if(!world.isRemote) {
mana -= burst.getStartingMana();
burst.setShooterUUID(getIdentifier());
world.spawnEntity(burst);
world.addEntity(burst);
burst.ping();
if(!ConfigHandler.COMMON.silentSpreaders.get())
world.playSound(null, pos, ModSounds.spreaderFire, SoundCategory.BLOCKS, 0.05F * (paddingColor != null ? 0.2F : 1F), 0.7F + 0.3F * (float) Math.random());
@@ -71,7 +71,7 @@ public final class PixieHandler {
pixie.setProps((LivingEntity) event.getSource().getTrueSource(), player, 0, dmg);
pixie.onInitialSpawn(player.world.getDifficultyForLocation(new BlockPos(pixie)), null, null);
player.world.spawnEntity(pixie);
player.world.addEntity(pixie);
}
}
}
@@ -262,7 +262,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
e.playSound(SoundEvents.ENTITY_ENDER_DRAGON_GROWL, 10F, 0.1F);
e.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(e)), null, null);
world.spawnEntity(e);
world.addEntity(e);
}
return true;
@@ -636,7 +636,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
pixie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(pixie)), null, null);
world.spawnEntity(pixie);
world.addEntity(pixie);
}
}
break;
@@ -652,7 +652,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
if(entity instanceof WitherSkeletonEntity && hardMode) {
entity.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(ModItems.elementiumSword));
}
world.spawnEntity(entity);
world.addEntity(entity);
}
}
}
@@ -764,7 +764,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
EntityMagicLandmine landmine = new EntityMagicLandmine(world);
landmine.setPosition(x + 0.5, y, z + 0.5);
landmine.summoner = this;
world.spawnEntity(landmine);
world.addEntity(landmine);
}
}
@@ -776,7 +776,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
pixie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(pixie)), null, null);
world.spawnEntity(pixie);
world.addEntity(pixie);
}
tpDelay = hardMode ? dying ? 35 : 45 : dying ? 40 : 60;
@@ -827,7 +827,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
missile.setPosition(posX + (Math.random() - 0.5 * 0.1), posY + 2.4 + (Math.random() - 0.5 * 0.1), posZ + (Math.random() - 0.5 * 0.1));
if(missile.findTarget()) {
playSound(ModSounds.missile, 0.6F, 0.8F + (float) Math.random() * 0.2F);
world.spawnEntity(missile);
world.addEntity(missile);
}
}
@@ -24,25 +24,20 @@ import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraft.block.BushBlock;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.BushBlock;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.block.Blocks;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@@ -143,7 +138,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
double my = MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
setMotion(mx, my, mz);
setBurstMotion(mx, my, mz);
}
public EntityManaBurst(PlayerEntity player, Hand hand) {
@@ -161,7 +156,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
double my = MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
setMotion(mx, my, mz);
setBurstMotion(mx, my, mz);
}
private void superUpdate() {
@@ -320,7 +315,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
particles();
setMotion(motionX, motionY, motionZ);
setBurstMotion(motionX, motionY, motionZ);
fullManaLastTick = getMana() == getStartingMana();
@@ -434,7 +429,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
double lastMotionY = cmp.getDouble(TAG_LAST_MOTION_Y);
double lastMotionZ = cmp.getDouble(TAG_LAST_MOTION_Z);
setMotion(lastMotionX, lastMotionY, lastMotionZ);
setBurstMotion(lastMotionX, lastMotionY, lastMotionZ);
boolean hasShooter = cmp.getBoolean(TAG_HAS_SHOOTER);
if(hasShooter) {
@@ -744,10 +739,8 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
@Override
public void setMotion(double x, double y, double z) {
motionX = x;
motionY = y;
motionZ = z;
public void setBurstMotion(double x, double y, double z) {
this.setMotion(x, y, z);
}
@Override
@@ -18,7 +18,6 @@ import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.lens.ItemLens;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
@@ -81,8 +80,8 @@ public class EntityManaStorm extends Entity {
burst.setSourceLens(new ItemStack(ModItems.lensStorm));
Vector3 motion = new Vector3(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize().multiply(motionModifier);
burst.setMotion(motion.x, motion.y, motion.z);
world.spawnEntity(burst);
burst.setBurstMotion(motion.x, motion.y, motion.z);
world.addEntity(burst);
}
@Override
@@ -131,7 +131,7 @@ public class EntityThornChakram extends ThrowableEntity {
private void dropAndKill() {
ItemStack stack = getItemStack();
ItemEntity item = new ItemEntity(world, posX, posY, posZ, stack);
world.spawnEntity(item);
world.addEntity(item);
remove();
}
@@ -105,7 +105,7 @@ public class EntityThrownItem extends ItemEntity {
Entity item = getItem().getItem().createEntity(world, this, getItem());
if (item == null) {
item = new ItemEntity(world, posX, posY, posZ, getItem());
world.spawnEntity(item);
world.addEntity(item);
item.motionX = motionX*0.25F;
item.motionY = motionY*0.25F;
item.motionZ = motionZ*0.25F;
@@ -130,7 +130,7 @@ public class EntityThrownItem extends ItemEntity {
Entity item = getItem().getItem().createEntity(world, this, getItem());
if (item == null) {
item = new ItemEntity(world, posX, posY, posZ, getItem());
world.spawnEntity(item);
world.addEntity(item);
item.motionX = motionX;
item.motionY = motionY;
item.motionZ = motionZ;
@@ -68,6 +68,7 @@ public final class ModEntities {
.tracker(80, 3, false).build("")
.setRegistryName(LibEntityNames.PINK_WITHER));
evt.getRegistry().register(EntityType.Builder.create(EntityPlayerMover.class, EntityPlayerMover::new)
.size(0, 0)
.tracker(40, 3, true).build("")
.setRegistryName(LibEntityNames.PLAYER_MOVER));
evt.getRegistry().register(EntityType.Builder.create(EntityManaStorm.class, EntityManaStorm::new)
@@ -163,7 +163,7 @@ public class ItemBottledMana extends ItemMod {
flare.setColor(living.world.rand.nextInt(16));
flare.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 40F, (1.0F + (living.world.rand.nextFloat() - living.world.rand.nextFloat()) * 0.2F) * 0.7F);
living.world.spawnEntity(flare);
living.world.addEntity(flare);
int range = 5;
List<LivingEntity> entities = living.world.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(living.posX - range, living.posY - range, living.posZ - range, living.posX + range, living.posY + range, living.posZ + range));
@@ -178,7 +178,7 @@ public class ItemBottledMana extends ItemMod {
if(!living.world.isRemote) {
EntityPixie pixie = new EntityPixie(living.world);
pixie.setPosition(living.posX, living.posY + 1.5, living.posZ);
living.world.spawnEntity(pixie);
living.world.addEntity(pixie);
}
break;
}
@@ -50,7 +50,7 @@ public class ItemCorporeaSpark extends ItemMod {
if(this == ModItems.corporeaSparkMaster)
spark.setMaster(true);
spark.setPosition(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5);
world.spawnEntity(spark);
world.addEntity(spark);
}
return ActionResultType.SUCCESS;
}
@@ -14,13 +14,9 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FallingBlock;
import net.minecraft.block.BlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.block.Blocks;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
@@ -30,17 +26,12 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.particles.BlockParticleData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraft.world.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
@@ -50,15 +41,11 @@ import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ILaputaImmobile;
import vazkii.botania.api.mana.ILensEffect;
import vazkii.botania.api.mana.ITinyPlanetExcempt;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.advancements.UseItemSuccessTrigger;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.List;
@@ -186,7 +173,7 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
ItemNBTHelper.setInt(copyLens, TAG_ITERATION_K, k);
EntityManaBurst burst = getBurst(world, pos_, copyLens);
world.spawnEntity(burst);
world.addEntity(burst);
return;
}
}
@@ -218,7 +205,7 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
burst.setMinManaLoss(0);
burst.setManaLossPerTick(0F);
burst.setGravity(0F);
burst.setMotion(0, 0.5, 0);
burst.setBurstMotion(0, 0.5, 0);
burst.setSourceLens(stack);
return burst;
@@ -12,11 +12,8 @@ package vazkii.botania.common.item;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.nbt.CompoundNBT;
@@ -24,24 +21,17 @@ import net.minecraft.potion.Effects;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.ServerWorld;
import net.minecraft.world.World;
import net.minecraft.world.ServerWorld;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.mana.BurstProperties;
@@ -53,11 +43,9 @@ import vazkii.botania.common.advancements.UseItemSuccessTrigger;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -99,7 +87,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem {
if(burst != null && ManaItemHandler.requestManaExact(stack, player, burst.getMana(), true)) {
if(!world.isRemote) {
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.manaBlaster, SoundCategory.PLAYERS, 0.6F, 1);
world.spawnEntity(burst);
world.addEntity(burst);
UseItemSuccessTrigger.INSTANCE.trigger((ServerPlayerEntity) player, stack, (ServerWorld) world, player.posX, player.posY, player.posZ);
} else {
player.swingArm(hand);
@@ -173,7 +161,7 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem {
burst.setMinManaLoss(props.ticksBeforeManaLoss);
burst.setManaLossPerTick(props.manaLossPerTick);
burst.setGravity(props.gravity);
burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
burst.setBurstMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
return burst;
}
@@ -62,7 +62,7 @@ public class ItemPinkinator extends ItemMod {
EntityPinkWither pink = new EntityPinkWither(world);
pink.setLocationAndAngles(wither.posX, wither.posY, wither.posZ, wither.rotationYaw, wither.rotationPitch);
pink.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(pink)), null, null);
world.spawnEntity(pink);
world.addEntity(pink);
pink.spawnExplosionParticle();
pink.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 4F, (1F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
UseItemSuccessTrigger.INSTANCE.trigger((ServerPlayerEntity) player, stack, (ServerWorld) world, player.posX, player.posY, player.posZ);
@@ -62,7 +62,7 @@ public class ItemPoolMinecart extends ItemMod {
entityminecart.setCustomName(itemstack.getDisplayName());
}
world.spawnEntity(entityminecart);
world.addEntity(entityminecart);
}
itemstack.shrink(1);
@@ -59,7 +59,7 @@ public class ItemSlingshot extends ItemMod {
ball.motionX *= 1.6;
ball.motionY *= 1.6;
ball.motionZ *= 1.6;
world.spawnEntity(ball);
world.addEntity(ball);
world.playSound(null, living.posX, living.posY, living.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F));
}
}
@@ -48,7 +48,7 @@ public class ItemSpark extends ItemMod implements IManaGivingItem {
stack.shrink(1);
EntitySpark spark = new EntitySpark(world);
spark.setPosition(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5);
world.spawnEntity(spark);
world.addEntity(spark);
attach.attachSpark(spark);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
}
@@ -44,7 +44,7 @@ public class ItemThornChakram extends ItemMod {
c.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
if(stack.getItem() == ModItems.flareChakram)
c.setFire(true);
world.spawnEntity(c);
world.addEntity(c);
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F));
stack.shrink(1);
}
@@ -44,7 +44,7 @@ public class ItemVineBall extends ItemMod {
if(!world.isRemote) {
EntityVineBall ball = new EntityVineBall(player, true);
ball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
world.spawnEntity(ball);
world.addEntity(ball);
}
return ActionResult.newResult(ActionResultType.SUCCESS, player.getHeldItem(hand));
@@ -99,7 +99,7 @@ public class ItemVirus extends ItemMod {
newHorse.playSound(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0F + living.world.rand.nextFloat(), living.world.rand.nextFloat() * 0.7F + 1.3F);
newHorse.onInitialSpawn(player.world.getDifficultyForLocation(new BlockPos(newHorse)), null, null);
newHorse.setGrowingAge(horse.getGrowingAge());
player.world.spawnEntity(newHorse);
player.world.addEntity(newHorse);
newHorse.spawnExplosionParticle();
stack.shrink(1);
@@ -16,12 +16,9 @@ import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -90,7 +87,7 @@ public class ItemTinyPlanet extends ItemBauble {
Vector3 currentVec = new Vector3(entity.posX, entity.posY, entity.posZ);
Vector3 moveVector = targetVec.subtract(currentVec);
burst.setMotion(moveVector.x, moveVector.y, moveVector.z);
burst.setBurstMotion(moveVector.x, moveVector.y, moveVector.z);
incrementOrbitTime(entity);
}
@@ -58,7 +58,7 @@ public class ItemStarSword extends ItemManasteelSword {
star.motionX = motVec.x;
star.motionY = motVec.y;
star.motionZ = motVec.z;
world.spawnEntity(star);
world.addEntity(star);
if (!world.isRaining()
&& Math.abs(world.getDayTime() - 18000) < 1800
@@ -68,7 +68,7 @@ public class ItemStarSword extends ItemManasteelSword {
bonusStar.motionX = motVec.x + Math.random() - 0.5;
bonusStar.motionY = motVec.y + Math.random() - 0.5;
bonusStar.motionZ = motVec.z + Math.random() - 0.5;
world.spawnEntity(bonusStar);
world.addEntity(bonusStar);
}
ToolCommons.damageItem(par1ItemStack, 1, player, MANA_PER_DAMAGE);
@@ -141,7 +141,7 @@ public class ItemLivingwoodBow extends BowItem implements IManaUsingItem {
entityarrow.pickupStatus = AbstractArrowEntity.PickupStatus.CREATIVE_ONLY;
}
world.spawnEntity(entityarrow);
world.addEntity(entityarrow);
onFire(stack, shooter, infinite, entityarrow);
}
@@ -97,7 +97,7 @@ public class ItemManasteelShears extends ShearsItem implements IManaUsingItem {
ItemEntity entityitem = new ItemEntity(player.world, pos.getX() + d, pos.getY() + d1, pos.getZ() + d2, stack);
entityitem.setPickupDelay(10);
player.world.spawnEntity(entityitem);
player.world.addEntity(entityitem);
}
ToolCommons.damageItem(itemstack, 1, player, MANA_PER_DAMAGE);
@@ -11,8 +11,6 @@
package vazkii.botania.common.item.equipment.tool.terrasteel;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
@@ -24,7 +22,6 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
@@ -33,14 +30,11 @@ import vazkii.botania.api.mana.ILensEffect;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelSword;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.network.PacketLeftClick;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
@@ -73,7 +67,7 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
&& player.getHeldItemMainhand().getItem() == this
&& player.getCooledAttackStrength(0) == 1) {
EntityManaBurst burst = getBurst(player, player.getHeldItemMainhand());
player.world.spawnEntity(burst);
player.world.addEntity(burst);
ToolCommons.damageItem(player.getHeldItemMainhand(), 1, player, MANA_PER_DAMAGE);
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.terraBlade, SoundCategory.PLAYERS, 0.4F, 1.4F);
}
@@ -95,7 +89,7 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
burst.setMinManaLoss(40);
burst.setManaLossPerTick(4F);
burst.setGravity(0F);
burst.setMotion(burst.motionX * motionModifier, burst.motionY * motionModifier, burst.motionZ * motionModifier);
burst.setBurstMotion(burst.motionX * motionModifier, burst.motionY * motionModifier, burst.motionZ * motionModifier);
ItemStack lens = stack.copy();
ItemNBTHelper.setString(lens, TAG_ATTACKER_USERNAME, player.getGameProfile().getName());
@@ -10,11 +10,9 @@
*/
package vazkii.botania.common.item.lens;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import vazkii.botania.api.internal.IManaBurst;
@@ -32,7 +30,7 @@ public class LensBounce extends Lens {
Vector3 normalVector = new Vector3(dir.getXOffset(), dir.getYOffset(), dir.getZOffset()).normalize();
Vector3 movementVec = normalVector.multiply(-2 * currentMovementVec.dotProduct(normalVector)).add(currentMovementVec);
burst.setMotion(movementVec.x, movementVec.y, movementVec.z);
burst.setBurstMotion(movementVec.x, movementVec.y, movementVec.z);
dead = false;
}
}
@@ -35,7 +35,7 @@ public class LensFirework extends Lens {
ItemStack fireworkStack = generateFirework(burst.getColor());
FireworkRocketEntity rocket = new FireworkRocketEntity(entity.world, entity.posX, entity.posY, entity.posZ, fireworkStack);
entity.world.spawnEntity(rocket);
entity.world.addEntity(rocket);
}
} else dead = false;
@@ -15,11 +15,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.item.FallingBlockEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.item.FallingBlockEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.AxisAlignedBB;
@@ -51,7 +47,7 @@ public class LensInfluence extends Lens {
if(!lens.isEmpty() && lens.getItem() == ModItems.lensInfluence)
continue;
((IManaBurst) movable).setMotion(entity.motionX, entity.motionY, entity.motionZ);
((IManaBurst) movable).setBurstMotion(entity.motionX, entity.motionY, entity.motionZ);
} else {
movable.motionX = entity.motionX;
movable.motionY = entity.motionY;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.item.lens;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -67,7 +66,7 @@ public class LensMagnet extends Lens {
entity.getEntityData().putInt(TAG_MAGNETIZED_Z, tile.getPos().getZ());
}
burst.setMotion(finalMotionVec.x, finalMotionVec.y, finalMotionVec.z);
burst.setBurstMotion(finalMotionVec.x, finalMotionVec.y, finalMotionVec.z);
break magnetize;
}
}
@@ -44,7 +44,7 @@ public class LensWeight extends Lens {
falling.fallTime = 1;
entity.world.removeBlock(bPos);
((ServerWorld) entity.world).spawnParticle(new BlockParticleData(ParticleTypes.FALLING_DUST, state), bPos.getX() + 0.5, bPos.getY() + 0.5, bPos.getZ() + 0.5, 10, 0.45, 0.45, 0.45, 5);
entity.world.spawnEntity(falling);
entity.world.addEntity(falling);
}
}
@@ -67,7 +67,7 @@ public class ItemEnderAir extends ItemMod {
if(!world.isRemote) {
EntityEnderAirBottle b = new EntityEnderAirBottle(player, world);
b.shoot(player, player.rotationPitch, player.rotationYaw, 0F, 1.5F, 1F);
world.spawnEntity(b);
world.addEntity(b);
}
else player.swingArm(hand);
return ActionResult.newResult(ActionResultType.SUCCESS, stack);
@@ -103,7 +103,7 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
weapon.setDelay(spawned);
weapon.setRotation(MathHelper.wrapDegrees(-living.rotationYaw + 180));
living.world.spawnEntity(weapon);
living.world.addEntity(weapon);
weapon.playSound(ModSounds.babylonSpawn, 1F, 1F + living.world.rand.nextFloat() * 3F);
setWeaponsSpawned(stack, spawned + 1);
}
@@ -57,7 +57,7 @@ public class ItemFireRod extends ItemMod implements IManaUsingItem, IAvatarWield
if(!world.isRemote && player != null && ManaItemHandler.requestManaExactForTool(stack, player, COST, false)) {
EntityFlameRing entity = new EntityFlameRing(world);
entity.setPosition(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5);
world.spawnEntity(entity);
world.addEntity(entity);
player.getCooldownTracker().setCooldown(this, IManaProficiencyArmor.Helper.hasProficiency(player, stack) ? COOLDOWN / 2 : COOLDOWN);
ManaItemHandler.requestManaExactForTool(stack, player, COST, true);
@@ -81,7 +81,7 @@ public class ItemFireRod extends ItemMod implements IManaUsingItem, IAvatarWield
if(!world.isRemote && tile.getCurrentMana() >= COST && tile.getElapsedFunctionalTicks() % 300 == 0 && tile.isEnabled()) {
EntityFlameRing entity = new EntityFlameRing(world);
entity.setPosition(te.getPos().getX() + 0.5, te.getPos().getY(), te.getPos().getZ() + 0.5);
world.spawnEntity(entity);
world.addEntity(entity);
tile.recieveMana(-COST);
}
}
@@ -222,7 +222,7 @@ public class ItemGravityRod extends ItemMod implements IManaUsingItem {
item.motionZ = moveVector.z * mot;
if(!player.world.isRemote) {
EntityThrownItem thrown = new EntityThrownItem(item.world, item.posX, item.posY, item.posZ, (ItemEntity) item);
item.world.spawnEntity(thrown);
item.world.addEntity(thrown);
}
item.remove();
} else {
@@ -81,7 +81,7 @@ public class ItemMissileRod extends ItemMod implements IManaUsingItem, IAvatarWi
if(missile.findTarget()) {
if(!world.isRemote) {
missile.playSound(ModSounds.missile, 0.6F, 0.8F + (float) Math.random() * 0.2F);
world.spawnEntity(missile);
world.addEntity(missile);
}
return true;