diff --git a/build.properties b/build.properties index 3b70375ec..604dedbd6 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ # -#Sun Nov 20 17:03:58 GMT 2016 +#Sat Jan 21 17:42:42 GMT 2017 mod_name=Botania cf_meta_version=1.11.2 forge_version=13.20.0.2206 diff --git a/src/main/java/vazkii/botania/common/block/BlockAltar.java b/src/main/java/vazkii/botania/common/block/BlockAltar.java index d58ba3ace..5a16ccfae 100644 --- a/src/main/java/vazkii/botania/common/block/BlockAltar.java +++ b/src/main/java/vazkii/botania/common/block/BlockAltar.java @@ -32,8 +32,10 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -105,7 +107,7 @@ public class BlockAltar extends BlockMod implements ILexiconable { @Nonnull @Override public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity te = worldIn.getTileEntity(pos); + TileEntity te = worldIn instanceof ChunkCache ? ((ChunkCache)worldIn).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : worldIn.getTileEntity(pos); if (te instanceof TileAltar) { TileAltar altar = (TileAltar) te; diff --git a/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java b/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java index 2496fdd9a..c38d53182 100644 --- a/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java @@ -32,8 +32,10 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.ChunkCache; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; @@ -76,7 +78,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I @Override public IBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) { state = super.getExtendedState(state, world, pos); - TileEntity te = world.getTileEntity(pos); + TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos); if (te instanceof TileFloatingSpecialFlower) { state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.SUBTILE_ID, ((TileFloatingSpecialFlower) te).subTileName); } diff --git a/src/main/java/vazkii/botania/common/block/BlockOpenCrate.java b/src/main/java/vazkii/botania/common/block/BlockOpenCrate.java index 9bae0c51e..34fccf087 100644 --- a/src/main/java/vazkii/botania/common/block/BlockOpenCrate.java +++ b/src/main/java/vazkii/botania/common/block/BlockOpenCrate.java @@ -30,8 +30,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -89,8 +91,9 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable, @Nonnull @Override public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) { - if (world.getTileEntity(pos) instanceof TileCraftCrate) { - TileCraftCrate tile = (TileCraftCrate) world.getTileEntity(pos); + TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos); + if (te instanceof TileCraftCrate) { + TileCraftCrate tile = (TileCraftCrate) te; state = state.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.values()[tile.pattern + 1]); } else { state = state.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE); diff --git a/src/main/java/vazkii/botania/common/block/BlockPlatform.java b/src/main/java/vazkii/botania/common/block/BlockPlatform.java index 10b1be769..0d4cf8e1d 100644 --- a/src/main/java/vazkii/botania/common/block/BlockPlatform.java +++ b/src/main/java/vazkii/botania/common/block/BlockPlatform.java @@ -31,9 +31,11 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -96,8 +98,9 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable, state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.HELD_WORLD, world) .withProperty(BotaniaStateProps.HELD_POS, pos); - if (world.getTileEntity(pos) instanceof TileCamo) { - TileCamo tile = (TileCamo) world.getTileEntity(pos); + TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos); + if (te instanceof TileCamo) { + TileCamo tile = (TileCamo) te; return ((IExtendedBlockState) state).withProperty(BotaniaStateProps.HELD_STATE, tile.camoState); } else { return state; diff --git a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java index f0a69e711..55085e72a 100644 --- a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java @@ -40,8 +40,10 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.ChunkCache; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -146,7 +148,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I @Nonnull @Override public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) { - TileEntity te = world.getTileEntity(pos); + TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos); if (te instanceof TileSpecialFlower && ((TileSpecialFlower) te).getSubTile() != null) { Class clazz = ((TileSpecialFlower) te).getSubTile().getClass(); String id = BotaniaAPI.getSubTileStringMapping(clazz); diff --git a/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java b/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java index fd458b297..702866e3c 100644 --- a/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java +++ b/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java @@ -35,8 +35,10 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -126,7 +128,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu @Override public IBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) { state = getActualState(state, world, pos); - TileEntity te = world.getTileEntity(pos); + TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos); if (te instanceof TileFloatingFlower) { state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.ISLAND_TYPE, ((TileFloatingFlower) te).getIslandType()); } else if (te instanceof TileFloatingSpecialFlower) { diff --git a/src/main/java/vazkii/botania/common/block/mana/BlockPool.java b/src/main/java/vazkii/botania/common/block/mana/BlockPool.java index 2b00adff1..e89481af8 100644 --- a/src/main/java/vazkii/botania/common/block/mana/BlockPool.java +++ b/src/main/java/vazkii/botania/common/block/mana/BlockPool.java @@ -37,8 +37,10 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; @@ -104,7 +106,7 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon @Nonnull @Override public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) { - TileEntity te = world.getTileEntity(pos); + TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos); if (te instanceof TilePool) { return state.withProperty(BotaniaStateProps.COLOR, ((TilePool) te).color); } else { diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileGourmaryllis.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileGourmaryllis.java index 56036d78c..c374e8d53 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileGourmaryllis.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileGourmaryllis.java @@ -19,6 +19,7 @@ import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.WorldServer; import vazkii.botania.api.lexicon.LexiconEntry; @@ -44,9 +45,10 @@ public class SubTileGourmaryllis extends SubTileGenerating { if(cooldown > -1) cooldown--; - if(cooldown == 0) { + if(cooldown == 0 && storedMana != 0) { mana = Math.min(getMaxMana(), mana + storedMana); storedMana = 0; + getWorld().playSound(null, supertile.getPos(), SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.BLOCKS, 1, 1); sync(); } diff --git a/src/main/java/vazkii/botania/common/block/tile/TileCraftCrate.java b/src/main/java/vazkii/botania/common/block/tile/TileCraftCrate.java index 81497942f..7f3a61499 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileCraftCrate.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileCraftCrate.java @@ -106,7 +106,7 @@ public class TileCraftCrate extends TileOpenCrate { if (world.isRemote) return; - if(craft(true) && canEject() || isFull()) + if(canEject() && isFull() && craft(true)) ejectAll(); int newSignal = 0; @@ -190,7 +190,7 @@ public class TileCraftCrate extends TileOpenCrate { @Override public boolean onWanded(World world, EntityPlayer player, ItemStack stack) { - if(!world.isRemote) { + if(!world.isRemote && canEject()) { craft(false); ejectAll(); } diff --git a/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java b/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java index 33c6eb2be..d1f830627 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java @@ -104,10 +104,11 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver { EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F); - if (entityliving == null || entityliving.getCanSpawnHere()) + if (entityliving == null || net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(entityliving, logic.getSpawnerWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ)) { if (randomEntity.getNbt().getSize() == 1 && randomEntity.getNbt().hasKey("id", 8) && entity instanceof EntityLiving) { + if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, logic.getSpawnerWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ)) ((EntityLiving)entity).onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), null); } diff --git a/src/main/java/vazkii/botania/common/block/tile/TileTerraPlate.java b/src/main/java/vazkii/botania/common/block/tile/TileTerraPlate.java index 9f4a78b36..613011515 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileTerraPlate.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileTerraPlate.java @@ -35,6 +35,8 @@ import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.block.tile.mana.TilePool; import vazkii.botania.common.item.ModItems; +import vazkii.botania.common.network.PacketBotaniaEffect; +import vazkii.botania.common.network.PacketHandler; public class TileTerraPlate extends TileMod implements ISparkAttachable { @@ -71,6 +73,9 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable { @Override public void update() { + if(world.isRemote) + return; + boolean removeMana = true; if(hasValidPlatform()) { @@ -88,10 +93,13 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable { otherSpark.registerTransfer(spark); } } - if(mana > 0) - doParticles(); + if(mana > 0) { + VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos); + PacketHandler.sendToNearby(world, getPos(), + new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.TERRA_PLATE, getPos().getX(), getPos().getY(), getPos().getZ())); + } - if(mana >= MAX_MANA && !world.isRemote) { + if(mana >= MAX_MANA) { EntityItem item = items.get(0); for(EntityItem otherItem : items) if(otherItem != item) @@ -109,38 +117,6 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable { recieveMana(-1000); } - void doParticles() { - if(world.isRemote) { - int ticks = (int) (100.0 * ((double) getCurrentMana() / (double) MAX_MANA)); - - int totalSpiritCount = 3; - double tickIncrement = 360D / totalSpiritCount; - - int speed = 5; - double wticks = ticks * speed - tickIncrement; - - double r = Math.sin((ticks - 100) / 10D) * 2; - double g = Math.sin(wticks * Math.PI / 180 * 0.55); - - for(int i = 0; i < totalSpiritCount; i++) { - double x = pos.getX() + Math.sin(wticks * Math.PI / 180) * r + 0.5; - double y = pos.getY() + 0.25 + Math.abs(r) * 0.7; - double z = pos.getZ() + Math.cos(wticks * Math.PI / 180) * r + 0.5; - - wticks += tickIncrement; - float[] colorsfx = new float[] { - 0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100 - }; - Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F); - Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F); - - if(ticks == 100) - for(int j = 0; j < 15; j++) - Botania.proxy.wispFX(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F); - } - } - } - List getItems() { return world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1))); } diff --git a/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java b/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java index 1993a89bc..67eb9a069 100644 --- a/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/InternalMethodHandler.java @@ -48,13 +48,17 @@ import vazkii.botania.api.recipe.RecipeElvenTrade; import vazkii.botania.api.recipe.RecipeManaInfusion; import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.api.recipe.RecipeRuneAltar; +import vazkii.botania.api.subtile.ISpecialFlower; import vazkii.botania.api.subtile.SubTileEntity; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.api.subtile.SubTileGenerating; import vazkii.botania.client.core.handler.BossBarHandler; import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.common.Botania; +import vazkii.botania.common.block.BlockModFlower; +import vazkii.botania.common.block.BlockSpecialFlower; import vazkii.botania.common.block.ModBlocks; +import vazkii.botania.common.block.decor.BlockFloatingFlower; import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia; import vazkii.botania.common.integration.corporea.WrappedDeepStorage; import vazkii.botania.common.integration.corporea.WrappedIInventory; @@ -255,7 +259,7 @@ public class InternalMethodHandler extends DummyMethodHandler { @Override public boolean isBotaniaFlower(World world, BlockPos pos) { Block block = world.getBlockState(pos).getBlock(); - return block == ModBlocks.flower || block == ModBlocks.shinyFlower || block == ModBlocks.specialFlower; + return block instanceof BlockModFlower || block instanceof BlockFloatingFlower || block instanceof ISpecialFlower; } @Override diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemCrystalBow.java b/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemCrystalBow.java index 5f5046946..83e907908 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemCrystalBow.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemCrystalBow.java @@ -45,10 +45,4 @@ public class ItemCrystalBow extends ItemLivingwoodBow { if(living instanceof EntityPlayer) ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) living, ARROW_COST / (infinity ? 2 : 1), false); } - - @Override - protected ItemStack getAmmo(EntityLivingBase player) { - return new ItemStack(Items.ARROW); - } - } diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java b/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java index 86efe80e2..588faf50f 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java @@ -105,17 +105,14 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel @Override public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, EntityLivingBase shooter, int useTicks) { - - boolean isPlayer = shooter instanceof EntityPlayer; - EntityPlayer player = isPlayer ? (EntityPlayer) shooter : null; + EntityPlayer player = (EntityPlayer) shooter; // Begin copy modified ItemBow.onPlayerStoppedUsing - boolean flag = !isPlayer || canFire(stack, player); // Botania - Custom canFire check - ItemStack itemstack = getAmmo(shooter); + boolean flag = canFire(stack, player); // Botania - Custom canFire check + ItemStack itemstack = getAmmo(player); int i = (int) ((getMaxItemUseDuration(stack) - useTicks) * chargeVelocityMultiplier()); // Botania - velocity multiplier - if(isPlayer) - i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, world, player, i, !itemstack.isEmpty() || flag); + i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, world, player, i, !itemstack.isEmpty() || flag); if (i < 0) return; if (!itemstack.isEmpty() || flag) @@ -129,7 +126,7 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel if (f >= 0.1D) { - boolean infinite = !isPlayer || player.capabilities.isCreativeMode || itemstack.getItem() instanceof ItemArrow && ((ItemArrow) itemstack.getItem()).isInfinite(itemstack, stack, player); + boolean infinite = player.capabilities.isCreativeMode || (itemstack.getItem() instanceof ItemArrow ? ((ItemArrow)itemstack.getItem()).isInfinite(itemstack, stack, player) : false); if (!world.isRemote) { @@ -175,10 +172,7 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel world.playSound(null, shooter.posX, shooter.posY, shooter.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); - // Botania - move ammo consumption into onFire (above) - - if(isPlayer) - player.addStat(StatList.getObjectUseStats(this)); + player.addStat(StatList.getObjectUseStats(this)); } } // End modified ItemBow.onPlayerStoppedUsing @@ -195,7 +189,8 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel void onFire(ItemStack bow, EntityLivingBase living, boolean infinity, EntityArrow arrow) { if(living instanceof EntityPlayerMP) { ToolCommons.damageItem(bow, 1, living, MANA_PER_DAMAGE); - if(((EntityPlayerMP) living).interactionManager.getGameType().isSurvivalOrAdventure()) + + if(((EntityPlayerMP) living).interactionManager.getGameType().isSurvivalOrAdventure() && !infinity) PlayerHelper.consumeAmmo((EntityPlayerMP) living, AMMO_FUNC); } } @@ -216,10 +211,19 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel return true; } - protected ItemStack getAmmo(EntityLivingBase shooter) { - if(shooter instanceof EntityPlayer) - return PlayerHelper.getAmmo((EntityPlayer) shooter, AMMO_FUNC); - else return new ItemStack(Items.ARROW); + private ItemStack getAmmo(EntityPlayer player) { + if(isArrow(player.getHeldItem(EnumHand.OFF_HAND))) + return player.getHeldItem(EnumHand.OFF_HAND); + else if(isArrow(player.getHeldItem(EnumHand.MAIN_HAND))) + return player.getHeldItem(EnumHand.MAIN_HAND); + else for(int i = 0; i < player.inventory.getSizeInventory(); ++i) { + ItemStack itemstack = player.inventory.getStackInSlot(i); + + if (isArrow(itemstack)) + return itemstack; + } + + return ItemStack.EMPTY; } @SideOnly(Side.CLIENT) diff --git a/src/main/java/vazkii/botania/common/item/relic/ItemKingKey.java b/src/main/java/vazkii/botania/common/item/relic/ItemKingKey.java index 7524666fd..ec5850086 100644 --- a/src/main/java/vazkii/botania/common/item/relic/ItemKingKey.java +++ b/src/main/java/vazkii/botania/common/item/relic/ItemKingKey.java @@ -65,7 +65,13 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem { int spawned = getWeaponsSpawned(stack); if(count != getMaxItemUseDuration(stack) && spawned < 20 && !living.world.isRemote && (!(living instanceof EntityPlayer) || ManaItemHandler.requestManaExact(stack, (EntityPlayer) living, 150, true))) { - Vector3 look = new Vector3(living.getLookVec()).multiply(1, 0, 1).normalize().multiply(-2);; + Vector3 look = new Vector3(living.getLookVec()).multiply(1, 0, 1); + + double playerRot = Math.toRadians(living.rotationYaw + 90); + if(look.x == 0 && look.z == 0) + look = new Vector3(Math.cos(playerRot), 0, Math.sin(playerRot)); + + look = look.normalize().multiply(-2); int div = spawned / 5; int mod = spawned % 5; diff --git a/src/main/java/vazkii/botania/common/item/relic/ItemLokiRing.java b/src/main/java/vazkii/botania/common/item/relic/ItemLokiRing.java index baa881da1..48303dfcb 100644 --- a/src/main/java/vazkii/botania/common/item/relic/ItemLokiRing.java +++ b/src/main/java/vazkii/botania/common/item/relic/ItemLokiRing.java @@ -29,6 +29,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; @@ -69,7 +70,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) { EntityPlayer player = event.getEntityPlayer(); ItemStack lokiRing = getLokiRing(player); - if(lokiRing == null || player.world.isRemote) + if(lokiRing.isEmpty() || player.world.isRemote || event.getHand() == EnumHand.OFF_HAND) return; int slot = -1; @@ -136,7 +137,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat public static void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) { ItemStack lokiRing = getLokiRing(player); - if(lokiRing == null || player.world.isRemote || !(item instanceof ISequentialBreaker)) + if(lokiRing.isEmpty() || player.world.isRemote || !(item instanceof ISequentialBreaker)) return; List cursors = getCursorList(lokiRing); @@ -198,7 +199,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat IItemHandler baubles = BaublesApi.getBaublesHandler(player); ItemStack stack1 = baubles.getStackInSlot(1); ItemStack stack2 = baubles.getStackInSlot(2); - return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : null; + return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : ItemStack.EMPTY; } private static boolean isLokiRing(ItemStack stack) { @@ -235,6 +236,9 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat } private static void setCursorList(ItemStack stack, List cursors) { + if(stack == null) + return; + NBTTagCompound cmp = new NBTTagCompound(); if(cursors != null) { int i = 0; diff --git a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java index a453d1de4..7f23780cb 100644 --- a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java +++ b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java @@ -6,6 +6,7 @@ import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.EnumDyeColor; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; @@ -15,6 +16,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import vazkii.botania.common.Botania; +import vazkii.botania.common.block.tile.TileTerraPlate; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.helper.MathHelper; import vazkii.botania.common.core.helper.Vector3; @@ -251,6 +253,38 @@ public class PacketBotaniaEffect implements IMessage { Botania.proxy.wispFX(message.x + 0.7 - Math.random() * 0.4, message.y + 0.9 - Math.random() * 0.2, message.z + 0.7 - Math.random() * 0.4, 0.2F, 0.2F, 0.2F, 0.1F + (float) Math.random() * 0.2F, 0.05F - (float) Math.random() * 0.1F, 0.05F + (float) Math.random() * 0.03F, 0.05F - (float) Math.random() * 0.1F); } } + case TERRA_PLATE: { + TileEntity te = world.getTileEntity(new BlockPos(message.x, message.y, message.z)); + if(te instanceof TileTerraPlate) { + int ticks = (int) (100.0 * ((double) ((TileTerraPlate) te).getCurrentMana() / (double) TileTerraPlate.MAX_MANA)); + + int totalSpiritCount = 3; + double tickIncrement = 360D / totalSpiritCount; + + int speed = 5; + double wticks = ticks * speed - tickIncrement; + + double r = Math.sin((ticks - 100) / 10D) * 2; + double g = Math.sin(wticks * Math.PI / 180 * 0.55); + + for(int i = 0; i < totalSpiritCount; i++) { + double x = message.x + Math.sin(wticks * Math.PI / 180) * r + 0.5; + double y = message.y + 0.25 + Math.abs(r) * 0.7; + double z = message.z + Math.cos(wticks * Math.PI / 180) * r + 0.5; + + wticks += tickIncrement; + float[] colorsfx = new float[] { + 0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100 + }; + Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F); + Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F); + + if(ticks == 100) + for(int j = 0; j < 15; j++) + Botania.proxy.wispFX(message.x + 0.5, message.y + 0.5, message.z + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F); + } + } + } } } }); @@ -271,7 +305,8 @@ public class PacketBotaniaEffect implements IMessage { ENCHANTER_DESTROY(0), ENTROPINNYUM(0), BLACK_LOTUS_DISSOLVE(0), - BREWERY_FINISH(1); // Arg: RGB + BREWERY_FINISH(1), // Arg: RGB + TERRA_PLATE(0); private final int argCount; diff --git a/version/1.10.2.txt b/version/1.10.2.txt index 26b6d3990..84cc279a6 100644 --- a/version/1.10.2.txt +++ b/version/1.10.2.txt @@ -1 +1 @@ -r1.9-339 \ No newline at end of file +r1.9-340 \ No newline at end of file diff --git a/web/changelog.txt b/web/changelog.txt index 33eeb2ef0..194b0acbf 100644 --- a/web/changelog.txt +++ b/web/changelog.txt @@ -1,3 +1,15 @@ +r1.9 340 +*Fixed a crash regarding tile entities and block states not playing together. (williewillus) +*Fixed crash on unequipping the Ring of Loki. +*Fixed the Crafty Crate destroying items if there's a block under it. +*Fixed the Gourmaryllis spamming packets and causing ridiculous network usage. (williewillus) +*Fixed the Key of the King's Law stacking portals together if the player is looking straight down. +*Fixed the Life Imbuer spawning mobs inside blocks. (williewillus) +*Fixed the livingwood bow not using 1.9 arrow priority and using arrows even if they have infinity. +*Fixed the Mana Enchanter not accepting floating flowers. +*Fixed the Ring of Loki checking your offhand item and thus negating the cursor addition if you have no item in either hand. +*Fixed the T.A. Plate not showing particles. (williewillus) +*The Gourmaryllis now plays a burp sound when it's done eating. (williewillus) r1.9 339 *Fixed a crash if a burst from a Manastorm Charge hits a mana container block. *Fixed a potential crash when crafting with baubles. diff --git a/web/versions.ini b/web/versions.ini index 5522501a5..e3f7597bf 100644 --- a/web/versions.ini +++ b/web/versions.ini @@ -290,4 +290,5 @@ r1.9-335=1.10.2 r1.9-336=1.10.2 r1.9-337=1.10.2 r1.9-338=1.10.2 -r1.9-339=1.10.2 \ No newline at end of file +r1.9-339=1.10.2 +r1.9-340=1.10.2 \ No newline at end of file