mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-10-26 14:33:50 +00:00
Merge pull request #1114 from MikeLydeamore/master
Added /dev/null block placing functionality
This commit is contained in:
commit
ed9615a93d
3 files changed
+21
-3
No files matched your search
@@ -85,6 +85,8 @@ public class TConstruct
|
||||
public static final Logger logger = LogManager.getLogger(modID);
|
||||
public static final PacketPipeline packetPipeline = new PacketPipeline();
|
||||
public static Random random = new Random();
|
||||
|
||||
|
||||
|
||||
/* Instance of this mod, used for grabbing prototype fields */
|
||||
@Instance(modID)
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
/* Base class for tools that should be harvesting blocks */
|
||||
@@ -153,7 +153,8 @@ public abstract class HarvestTool extends ToolCore
|
||||
if (nearbyStack != null)
|
||||
{
|
||||
Item item = nearbyStack.getItem();
|
||||
if (item instanceof ItemBlock)
|
||||
|
||||
if (item instanceof ItemBlock || (item != null && item == TinkerTools.openBlocksDevNull))
|
||||
{
|
||||
int posX = x;
|
||||
int posY = y;
|
||||
@@ -197,8 +198,17 @@ public abstract class HarvestTool extends ToolCore
|
||||
|
||||
int dmg = nearbyStack.getItemDamage();
|
||||
int count = nearbyStack.stackSize;
|
||||
if (item == TinkerTools.openBlocksDevNull)
|
||||
{
|
||||
//Openblocks uses current inventory slot, so we have to do this...
|
||||
player.inventory.currentItem=itemSlot;
|
||||
item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
|
||||
player.inventory.currentItem=hotbarSlot;
|
||||
player.swingItem();
|
||||
}
|
||||
else
|
||||
used = item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
|
||||
|
||||
used = item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
|
||||
// handle creative mode
|
||||
if(player.capabilities.isCreativeMode) {
|
||||
// fun fact: vanilla minecraft does it exactly the same way
|
||||
|
||||
@@ -124,6 +124,9 @@ public class TinkerTools
|
||||
|
||||
// recipe stuff
|
||||
public static boolean thaumcraftAvailable;
|
||||
|
||||
//Dev/Null Stuff
|
||||
public static Item openBlocksDevNull;
|
||||
|
||||
@Handler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
@@ -718,6 +721,9 @@ public class TinkerTools
|
||||
{
|
||||
} // No need to handle
|
||||
}
|
||||
|
||||
//OpenBlocks
|
||||
openBlocksDevNull = GameRegistry.findItem("OpenBlocks", "devnull");
|
||||
}
|
||||
|
||||
void registerMaterials ()
|
||||
|
||||
Reference in new issue
Block a user