diff --git a/changelog b/changelog index 488519ded..6f92c7c05 100644 --- a/changelog +++ b/changelog @@ -1,14 +1,11 @@ ## Changed -* Removed the legacy assemblers and chemical plants -* Removed all legacy templates -* Removed legacy particle collider blocks with the exception of the coils -* Removed the unused anti proton and positron capsules -* Removed some ancient test blocks -* Removed the T-45 power armor completely -* Removed the old redcoil items -* Nuclear creepers now have an innate resistance to explosion damage (5/35%) -* Reduced the resistance stats on the ballistic jackets -* U233 and Pu241 are now custom nuke usable +* Improved buzzsaw tree detection + * Instead of just clearing a pillar, it now tries to detect branches + * The max size of trees that can be successfully harvested is now way bigger + * This means that things like 2x2 jungle trees can now be automated ## Fixed -* Fixed size 15 boxcar not being craftable \ No newline at end of file +* Fixed NBTStack serialization omitting the stack size most of the time, preventing deserialization (mainly in the precision assembler config) +* Fixed precision assembler not being listed in the creative inventory +* Fixed OpenComputers integration for the CCGT +* Fixed tool abilities switching when clicking on a block with a special interaction \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 63f593585..9513c33fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -64,6 +64,7 @@ credits=HbMinecraft,\ \ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\ \ Abel1502 (abilities GUI, optimization, crate upgrade recipes, strand caster improvements, varous tweaks),\ \ Darek505 (armor rendering compatibility fix),\ + \ mikkerlo (autosaw tree detection improvements),\ \ ranch21 (improved HUD gauges),\ \ SuperCraftAlex (tooltips)\ \ Ice-Arrow (research reactor tweaks),\ diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index c244059c7..e78099f48 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -2181,7 +2181,7 @@ public class ModBlocks { barricade = new BlockNoDrop(Material.sand).setBlockName("barricade").setHardness(1.0F).setResistance(2.5F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":barricade"); machine_assembly_machine = new MachineAssemblyMachine(Material.iron).setBlockName("machine_assembly_machine").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_assembly_factory = new MachineAssemblyFactory(Material.iron).setBlockName("machine_assembly_factory").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); - machine_precass = new MachinePrecAss(Material.iron).setBlockName("machine_precass").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null /* the world isn't ready for your beauty yet */).setBlockTextureName(RefStrings.MODID + ":block_steel"); + machine_precass = new MachinePrecAss(Material.iron).setBlockName("machine_precass").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_arc_welder = new MachineArcWelder(Material.iron).setBlockName("machine_arc_welder").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_soldering_station = new MachineSolderingStation(Material.iron).setBlockName("machine_soldering_station").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_chemical_plant = new MachineChemicalPlant(Material.iron).setBlockName("machine_chemical_plant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); diff --git a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java index 40301e583..b778b7342 100644 --- a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java +++ b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java @@ -264,8 +264,8 @@ public abstract class SerializableRecipe { if("nbt".equals(type)) { Item item = (Item) Item.itemRegistry.getObject(array.get(1).getAsString()); int meta = array.size() > 3 ? array.get(3).getAsInt() : 0; - NBTBase nbt = JsonToNBT.func_150315_a(array.get(array.size() - 1).getAsString()); - return new NBTStack(item, stacksize, meta).withNBT(nbt instanceof NBTTagCompound ? (NBTTagCompound) nbt : null); + NBTBase nbt = array.size() > 4 ? JsonToNBT.func_150315_a(array.get(4).getAsString()) : null; + return new NBTStack(item, stacksize, 0).withNBT(nbt instanceof NBTTagCompound ? (NBTTagCompound) nbt : null); } if("item".equals(type)) { Item item = (Item) Item.itemRegistry.getObject(array.get(1).getAsString()); @@ -296,11 +296,11 @@ public abstract class SerializableRecipe { writer.setIndent(""); if(astack instanceof NBTStack) { NBTStack comp = (NBTStack) astack; - writer.value(comp.nbt != null ? "nbt" : "item"); //NBT identifier - writer.value(Item.itemRegistry.getNameForObject(comp.toStack().getItem())); //item name - if(comp.stacksize != 1 || comp.meta > 0) writer.value(comp.stacksize); //stack size - if(comp.meta > 0 || comp.nbt != null) writer.value(comp.meta); //metadata - if(comp.nbt != null) writer.value(comp.nbt.toString()); //NBT + writer.value(comp.nbt != null ? "nbt" : "item"); //NBT identifier + writer.value(Item.itemRegistry.getNameForObject(comp.toStack().getItem())); //item name + if(comp.stacksize != 1 || comp.meta > 0 || comp.nbt != null) writer.value(comp.stacksize); //stack size + if(comp.meta > 0 || comp.nbt != null) writer.value(comp.meta); //metadata + if(comp.nbt != null) writer.value(comp.nbt.toString()); //NBT } else if(astack instanceof ComparableStack) { ComparableStack comp = (ComparableStack) astack; writer.value("item"); //ITEM identifier diff --git a/src/main/java/com/hbm/items/tool/ItemToolAbility.java b/src/main/java/com/hbm/items/tool/ItemToolAbility.java index dfcac8ae8..6483867c2 100644 --- a/src/main/java/com/hbm/items/tool/ItemToolAbility.java +++ b/src/main/java/com/hbm/items/tool/ItemToolAbility.java @@ -33,6 +33,7 @@ import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.PlayerInformPacket; import com.hbm.tileentity.IGUIProvider; +import com.hbm.util.EntityDamageUtil; import com.hbm.util.Tuple.Pair; import api.hbm.item.IDepthRockTool; @@ -63,6 +64,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.network.play.server.S23PacketBlockChange; import net.minecraft.stats.StatList; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; @@ -563,6 +565,29 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro World world = player.worldObj; if(!canOperate(stack)) return; + + EntityPlayerMP playerMP = (EntityPlayerMP) player; + MovingObjectPosition mop = EntityDamageUtil.getMouseOver(playerMP, playerMP.theItemInWorldManager.getBlockReachDistance()); + + if(mop.typeOfHit == mop.typeOfHit.BLOCK) { + // this is horrifying and won't always produce the correct results, but it beats not having anything + // simply put, we check if we are aiming at a block, and if we do, we compare that block's onBlockActivated + // method to the one from Block.class. If the declaring class doesn't match, it's overridden, and we + // assume that something is going to happen, which it might not, but either way we cancel the ability switch. + Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); + // IDE + try { + Method m0 = b.getClass().getMethod("onBlockActivated", World.class, int.class, int.class, int.class, EntityPlayer.class, int.class, float.class, float.class, float.class); + Method m1 = Block.class.getMethod("onBlockActivated", World.class, int.class, int.class, int.class, EntityPlayer.class, int.class, float.class, float.class, float.class); + if(m0.getDeclaringClass() != m1.getDeclaringClass()) return; + } catch(Throwable e) { } + // COMP + try { + Method m0 = b.getClass().getMethod("func_149727_a", World.class, int.class, int.class, int.class, EntityPlayer.class, int.class, float.class, float.class, float.class); + Method m1 = Block.class.getMethod("func_149727_a", World.class, int.class, int.class, int.class, EntityPlayer.class, int.class, float.class, float.class, float.class); + if(m0.getDeclaringClass() != m1.getDeclaringClass()) return; + } catch(Throwable e) { } + } Configuration config = getConfiguration(stack); if(config.presets.size() < 2 || world.isRemote) return; @@ -574,7 +599,7 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro } setConfiguration(stack, config); - PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(config.getActivePreset().getMessage(), MainRegistry.proxy.ID_TOOLABILITY), (EntityPlayerMP) player); + PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(config.getActivePreset().getMessage(), MainRegistry.proxy.ID_TOOLABILITY), playerMP); world.playSoundAtEntity(player, "random.orb", 0.25F, config.getActivePreset().isNone() ? 0.75F : 1.25F); } }