From 108e5ceccc878ac98e47dd1353a21c7b8903e33f Mon Sep 17 00:00:00 2001 From: Fenn Date: Mon, 15 Sep 2014 11:14:40 +0100 Subject: [PATCH] WIP left click chisel stuff --- build.gradle | 2 +- .../info/jbcs/minecraft/chisel/Chisel.java | 148 +------------ .../jbcs/minecraft/chisel/ChiselBlocks.java | 12 +- .../minecraft/chisel/ChiselLeftClick.java | 194 ++++++++++++++++++ .../chisel/ChiselWorldGenerator.java | 1 + .../info/jbcs/minecraft/chisel/Waila.java | 30 +-- .../jbcs/minecraft/chisel/api/ChiselMode.java | 14 ++ .../minecraft/chisel/api/IChiselMode.java | 14 ++ .../chisel/block/BlockHolystone.java | 7 +- .../chisel/block/BlockLavastone.java | 2 +- .../minecraft/chisel/item/ItemChisel.java | 25 +-- src/main/resources/mcmod.info | 2 +- 12 files changed, 265 insertions(+), 186 deletions(-) create mode 100644 src/main/java/info/jbcs/minecraft/chisel/ChiselLeftClick.java create mode 100644 src/main/java/info/jbcs/minecraft/chisel/api/ChiselMode.java create mode 100644 src/main/java/info/jbcs/minecraft/chisel/api/IChiselMode.java diff --git a/build.gradle b/build.gradle index 2e6ee15c..526d3cf7 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { } apply plugin: 'forge' -version = "1.5.6c" +version = "1.5.7" group = "info.jbcs.minecraft.chisel" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Chisel" diff --git a/src/main/java/info/jbcs/minecraft/chisel/Chisel.java b/src/main/java/info/jbcs/minecraft/chisel/Chisel.java index 0bad2b43..b218595c 100644 --- a/src/main/java/info/jbcs/minecraft/chisel/Chisel.java +++ b/src/main/java/info/jbcs/minecraft/chisel/Chisel.java @@ -13,8 +13,6 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.Type; import info.jbcs.minecraft.chisel.carving.Carving; -import info.jbcs.minecraft.chisel.carving.CarvingVariation; -import info.jbcs.minecraft.chisel.client.GeneralChiselClient; import info.jbcs.minecraft.chisel.client.gui.GuiChisel; import info.jbcs.minecraft.chisel.entity.EntityBallOMoss; import info.jbcs.minecraft.chisel.entity.EntityCloudInABottle; @@ -29,18 +27,12 @@ import info.jbcs.minecraft.utilities.General; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.world.BlockEvent; import java.io.File; -import java.util.HashMap; -import java.util.Random; @Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = "@MOD_VERSION@", guiFactory = "info.jbcs.minecraft.chisel.client.gui.GuiFactory"/*, dependencies = "after:ForgeMicroblock;"*/) @@ -197,6 +189,7 @@ public class Chisel proxy.init(); MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(new ChiselLeftClick()); FMLCommonHandler.instance().bus().register(instance); FMLInterModComms.sendMessage("Waila", "register", "info.jbcs.minecraft.chisel.Waila.register"); @@ -206,12 +199,6 @@ public class Chisel public void postInit(FMLPostInitializationEvent event) { Compatibility.init(event); - - if(Loader.isModLoaded("ProjRed|Exploration") && GameRegistry.findBlock("ProjRed|Exploration", "projectred.exploration.stone") != null) - { - Carving.chisel.addVariation("marble", GameRegistry.findBlock("ProjRed|Exploration", "projectred.exploration.stone"), 0, 99); - GameRegistry.findBlock("ProjRed|Exploration", "projectred.exploration.stone").setHarvestLevel("chisel", 0, 0); - } } @@ -224,138 +211,5 @@ public class Chisel } } - HashMap chiselUseTime = new HashMap(); - HashMap chiselUseLocation = new HashMap(); - Random random = new Random(); - @SubscribeEvent - public void onPlayerClick(PlayerInteractEvent event) - { - if(event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; - if(!Configurations.enableChiseling) return; - EntityPlayer player = event.entityPlayer; - ItemStack stack = player.getHeldItem(); - if(stack == null || stack.getItem() != chisel) return; - - World world = event.world; - int x = event.x; - int y = event.y; - int z = event.z; - - Block block = world.getBlock(x, y, z); - int blockMeta = world.getBlockMetadata(x, y, z); - - ItemStack chiselTarget = null; - - if(stack.stackTagCompound != null) - { - chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget")); - } - - boolean chiselHasBlockInside = true; - - if(chiselTarget == null) - { - chiselHasBlockInside = false; - - Long useTime = chiselUseTime.get(player.getCommandSenderName()); - String loc = chiselUseLocation.get(player.getCommandSenderName()); - - if(useTime != null && chiselUseLocation != null && loc.equals(x + "|" + y + "|" + z)) - { - long cooldown = 20; - long time = world.getWorldInfo().getWorldTotalTime(); - - if(time > useTime - cooldown && time < useTime + cooldown) return; //noReplace = true; - } - - CarvingVariation[] variations = ItemChisel.carving.getVariations(block, blockMeta); - if(variations == null || variations.length < 2) return; //noReplace = true; - else - { - int index = blockMeta + 1; - while(variations[index].block.equals(block) && variations[index].damage == blockMeta) - { - index++; - if(index >= variations.length) index = 0; - } - CarvingVariation var = variations[index]; - chiselTarget = new ItemStack(var.block, 1, var.damage); - } - } - Item result = null; - int targetMeta = 0; - - Item target = chiselTarget.getItem(); - - targetMeta = chiselTarget.getItemDamage(); - - boolean match = ItemChisel.carving.isVariationOfSameClass(Block.getBlockFromItem(target), targetMeta, block, blockMeta); - result = target; - - /* special case: stone can be carved to cobble and bricks */ - if(Configurations.chiselStoneToCobbleBricks) - { - if(!match && block.equals(Blocks.stone) && Block.getBlockFromItem(target).equals(ChiselBlocks.blockCobblestone)) - match = true; - if(!match && block.equals(Blocks.stone) && Block.getBlockFromItem(target).equals(ChiselBlocks.stoneBrick)) - match = true; - } - if(!match) - return; //noReplace = true; - - int updateValue = 1; - - if(!world.isRemote || chiselHasBlockInside) - { - world.setBlock(x, y, z, Block.getBlockFromItem(result), targetMeta, updateValue); - world.markBlockForUpdate(x, y, z); - } - - switch(FMLCommonHandler.instance().getEffectiveSide()) - { - case SERVER: - chiselUseTime.put(player.getCommandSenderName(), world.getWorldInfo().getWorldTotalTime()); - chiselUseLocation.put(player.getCommandSenderName(), x + "|" + y + "|" + z); - - try - { - //TODO chisel left click thingy - // Packet packet = Chisel.packet.create(Packets.CHISELED).writeInt(x).writeInt(y).writeInt(z); - // Chisel.packet.sendToAllAround(packet, new TargetPoint(player.dimension, x, y, z, 30.0f)); - } catch(Exception e) - { - e.printStackTrace(); - } - break; - - case CLIENT: - if(chiselHasBlockInside) - { - String sound = ItemChisel.carving.getVariationSound(result, chiselTarget.getItemDamage()); - GeneralChiselClient.spawnChiselEffect(x, y, z, sound); - } - break; - - default: - break; - } - - stack.damageItem(1, player); - if(stack.stackSize == 0) - { - player.inventory.mainInventory[player.inventory.currentItem] = chiselHasBlockInside ? chiselTarget : null; - } - } - - @SubscribeEvent - public void onBlockBreak(BlockEvent.BreakEvent event) - { - if(!Configurations.enableChiseling) return; - EntityPlayer player = event.getPlayer(); - ItemStack stack = player.getHeldItem(); - if(stack == null || stack.getItem() != chisel) return; - - event.setCanceled(true); - } } diff --git a/src/main/java/info/jbcs/minecraft/chisel/ChiselBlocks.java b/src/main/java/info/jbcs/minecraft/chisel/ChiselBlocks.java index fc2b8566..c8a2b9ae 100644 --- a/src/main/java/info/jbcs/minecraft/chisel/ChiselBlocks.java +++ b/src/main/java/info/jbcs/minecraft/chisel/ChiselBlocks.java @@ -1240,12 +1240,12 @@ public class ChiselBlocks blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.7.desc"), 7, "laboratory/floortile"); blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.8.desc"), 8, "laboratory/checkertile"); blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.9.desc"), 9, "laboratory/clearscreen"); - blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.10.desc"),10, "laboratory/fuzzscreen"); - blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.11.desc"),11,"laboratory/largesteel"); - blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.12.desc"),12,"laboratory/smallsteel"); - blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.13.desc"),13,"laboratory/directionright"); - blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.14.desc"),14,"laboratory/directionleft"); - blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.15.desc"),15,"laboratory/infocon"); + blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.10.desc"), 10, "laboratory/fuzzscreen"); + blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.11.desc"), 11, "laboratory/largesteel"); + blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.12.desc"), 12, "laboratory/smallsteel"); + blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.13.desc"), 13, "laboratory/directionright"); + blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.14.desc"), 14, "laboratory/directionleft"); + blockLaboratory.carverHelper.addVariation(StatCollector.translateToLocal("chisel.tile.blockLaboratory.15.desc"), 15, "laboratory/infocon"); blockLaboratory.carverHelper.register(blockLaboratory, "blockLaboratory"); } diff --git a/src/main/java/info/jbcs/minecraft/chisel/ChiselLeftClick.java b/src/main/java/info/jbcs/minecraft/chisel/ChiselLeftClick.java new file mode 100644 index 00000000..c50f81ea --- /dev/null +++ b/src/main/java/info/jbcs/minecraft/chisel/ChiselLeftClick.java @@ -0,0 +1,194 @@ +package info.jbcs.minecraft.chisel; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import info.jbcs.minecraft.chisel.api.ChiselMode; +import info.jbcs.minecraft.chisel.carving.CarvingVariation; +import info.jbcs.minecraft.chisel.client.GeneralChiselClient; +import info.jbcs.minecraft.chisel.item.ItemChisel; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.world.BlockEvent; + +import java.util.HashMap; +import java.util.Random; + +/** + * Created by Pokefenn. + * Licensed under MIT (If this is one of my Mods) + */ +public class ChiselLeftClick +{ + + HashMap chiselUseTime = new HashMap(); + HashMap chiselUseLocation = new HashMap(); + Random random = new Random(); + + @SubscribeEvent + public void onPlayerClick(PlayerInteractEvent event) + { + if(event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; + if(!Configurations.enableChiseling) return; + EntityPlayer player = event.entityPlayer; + ItemStack stack = player.getHeldItem(); + if(stack == null || stack.getItem() != Chisel.chisel) return; + + World world = event.world; + int x = event.x; + int y = event.y; + int z = event.z; + + Block block = world.getBlock(x, y, z); + int blockMeta = world.getBlockMetadata(x, y, z); + + ItemStack chiselTarget = null; + + if(stack.stackTagCompound != null) + { + chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget")); + } + + boolean chiselHasBlockInside = true; + + if(chiselTarget == null) + { + chiselHasBlockInside = false; + + Long useTime = chiselUseTime.get(player.getCommandSenderName()); + String loc = chiselUseLocation.get(player.getCommandSenderName()); + + if(useTime != null && chiselUseLocation != null && loc.equals(x + "|" + y + "|" + z)) + { + long cooldown = 20; + long time = world.getWorldInfo().getWorldTotalTime(); + + if(time > useTime - cooldown && time < useTime + cooldown) return; //noReplace = true; + } + + CarvingVariation[] variations = ItemChisel.carving.getVariations(block, blockMeta); + if(variations == null || variations.length < 2) return; //noReplace = true; + else + { + int index = blockMeta + 1; + while(variations[index].block.equals(block) && variations[index].damage == blockMeta) + { + index++; + if(index >= variations.length) index = 0; + } + CarvingVariation var = variations[index]; + chiselTarget = new ItemStack(var.block, 1, var.damage); + } + } + Item result = null; + int targetMeta = 0; + + Item target = chiselTarget.getItem(); + + targetMeta = chiselTarget.getItemDamage(); + + boolean match = ItemChisel.carving.isVariationOfSameClass(Block.getBlockFromItem(target), targetMeta, block, blockMeta); + result = target; + + /* special case: stone can be carved to cobble and bricks */ + if(Configurations.chiselStoneToCobbleBricks) + { + if(!match && block.equals(Blocks.stone) && Block.getBlockFromItem(target).equals(ChiselBlocks.blockCobblestone)) + match = true; + if(!match && block.equals(Blocks.stone) && Block.getBlockFromItem(target).equals(ChiselBlocks.stoneBrick)) + match = true; + } + if(!match) + return; //noReplace = true; + + int updateValue = 1; + + if(!world.isRemote || chiselHasBlockInside) + { + world.setBlock(x, y, z, Block.getBlockFromItem(result), targetMeta, updateValue); + world.markBlockForUpdate(x, y, z); + } + + switch(FMLCommonHandler.instance().getEffectiveSide()) + { + case SERVER: + chiselUseTime.put(player.getCommandSenderName(), world.getWorldInfo().getWorldTotalTime()); + chiselUseLocation.put(player.getCommandSenderName(), x + "|" + y + "|" + z); + + try + { + //TODO chisel left click thingy + // Packet packet = Chisel.packet.create(Packets.CHISELED).writeInt(x).writeInt(y).writeInt(z); + // Chisel.packet.sendToAllAround(packet, new TargetPoint(player.dimension, x, y, z, 30.0f)); + } catch(Exception e) + { + e.printStackTrace(); + } + break; + + case CLIENT: + if(chiselHasBlockInside) + { + String sound = ItemChisel.carving.getVariationSound(result, chiselTarget.getItemDamage()); + GeneralChiselClient.spawnChiselEffect(x, y, z, sound); + } + break; + + default: + break; + } + + stack.damageItem(1, player); + if(stack.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = chiselHasBlockInside ? chiselTarget : null; + } + } + + @SubscribeEvent + public void onBlockBreak(BlockEvent.BreakEvent event) + { + if(!Configurations.enableChiseling) return; + EntityPlayer player = event.getPlayer(); + ItemStack stack = player.getHeldItem(); + if(stack == null || stack.getItem() != Chisel.chisel) return; + + event.setCanceled(true); + } + + + public static void setBlock(World world, int x, int y, int z, ChiselMode chiselMode, Block previousBlock, int previousMetadata, Block newBlock, int newMetadata, ForgeDirection direction) + { + if(chiselMode == ChiselMode.SINGLE) + { + world.setBlock(x, y, z, newBlock, newMetadata, 2); + } else if(chiselMode == ChiselMode.CIRCLETHREE) + { + int radius = 1; + for(int i = -radius; i <= radius; i++) + for(int j = -radius; j <= radius; j++) + { + //TODO facing stuff so this can be anywhere + if(world.getBlock(x + i, y, z + j) != null) + { + if(world.getBlock(x + i, y, z + j) == previousBlock && world.getBlockMetadata(x + i, y, z + j) == previousMetadata) + { + int shiftedX = x; + int shiftedY = y; + int shiftedZ = z; + + world.setBlock(shiftedX, shiftedY, shiftedZ, newBlock, newMetadata, 2); + } + } + } + + } + + } + +} diff --git a/src/main/java/info/jbcs/minecraft/chisel/ChiselWorldGenerator.java b/src/main/java/info/jbcs/minecraft/chisel/ChiselWorldGenerator.java index 5cbadcfe..50c599f5 100644 --- a/src/main/java/info/jbcs/minecraft/chisel/ChiselWorldGenerator.java +++ b/src/main/java/info/jbcs/minecraft/chisel/ChiselWorldGenerator.java @@ -23,6 +23,7 @@ public class ChiselWorldGenerator implements IWorldGenerator { for(int l = 0; l < amount; ++l) { + //TODO change the values if its marble or limestone, thanks to tahg for finding all of this. int i1 = x + random.nextInt(16); int j1 = bot + random.nextInt(top - bot); int k1 = z + random.nextInt(16); diff --git a/src/main/java/info/jbcs/minecraft/chisel/Waila.java b/src/main/java/info/jbcs/minecraft/chisel/Waila.java index 95ad90f1..38cf3ddc 100644 --- a/src/main/java/info/jbcs/minecraft/chisel/Waila.java +++ b/src/main/java/info/jbcs/minecraft/chisel/Waila.java @@ -1,42 +1,48 @@ package info.jbcs.minecraft.chisel; -import java.util.List; - -import net.minecraft.item.ItemStack; - import info.jbcs.minecraft.chisel.block.BlockCarvable; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataProvider; import mcp.mobius.waila.api.IWailaRegistrar; +import net.minecraft.item.ItemStack; -public class Waila implements IWailaDataProvider { +import java.util.List; + +public class Waila implements IWailaDataProvider +{ @Override - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler configHandler) { + public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler configHandler) + { return null; } @Override - public List getWailaHead(ItemStack stack, List strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) { + public List getWailaHead(ItemStack stack, List strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) + { return strings; } @Override - public List getWailaBody(ItemStack stack, List strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) { - if(accessor.getBlock() instanceof BlockCarvable) { - BlockCarvable block = (BlockCarvable)accessor.getBlock(); + public List getWailaBody(ItemStack stack, List strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) + { + if(accessor.getBlock() instanceof BlockCarvable) + { + BlockCarvable block = (BlockCarvable) accessor.getBlock(); strings.add(block.getVariation(accessor.getMetadata()).description); } return strings; } @Override - public List getWailaTail(ItemStack stack, List strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) { + public List getWailaTail(ItemStack stack, List strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) + { return strings; } - public static void register(IWailaRegistrar registrar) { + public static void register(IWailaRegistrar registrar) + { Waila instance = new Waila(); registrar.registerBodyProvider(instance, BlockCarvable.class); } diff --git a/src/main/java/info/jbcs/minecraft/chisel/api/ChiselMode.java b/src/main/java/info/jbcs/minecraft/chisel/api/ChiselMode.java new file mode 100644 index 00000000..b9a0866e --- /dev/null +++ b/src/main/java/info/jbcs/minecraft/chisel/api/ChiselMode.java @@ -0,0 +1,14 @@ +package info.jbcs.minecraft.chisel.api; + +/** + * Created by Pokefenn. + * Licensed under MIT (If this is one of my Mods) + */ +public enum ChiselMode +{ + + SINGLE, + CIRCLETHREE, + COLLUM, + SIDEWAYS +} diff --git a/src/main/java/info/jbcs/minecraft/chisel/api/IChiselMode.java b/src/main/java/info/jbcs/minecraft/chisel/api/IChiselMode.java new file mode 100644 index 00000000..7a7adeec --- /dev/null +++ b/src/main/java/info/jbcs/minecraft/chisel/api/IChiselMode.java @@ -0,0 +1,14 @@ +package info.jbcs.minecraft.chisel.api; + +import net.minecraft.item.ItemStack; + +/** + * Created by Pokefenn. + * Licensed under MIT (If this is one of my Mods) + */ +public interface IChiselMode +{ + + public ChiselMode getChiselMode(ItemStack itemStack); + +} diff --git a/src/main/java/info/jbcs/minecraft/chisel/block/BlockHolystone.java b/src/main/java/info/jbcs/minecraft/chisel/block/BlockHolystone.java index 8aaf77fe..b9b342e2 100644 --- a/src/main/java/info/jbcs/minecraft/chisel/block/BlockHolystone.java +++ b/src/main/java/info/jbcs/minecraft/chisel/block/BlockHolystone.java @@ -2,14 +2,13 @@ package info.jbcs.minecraft.chisel.block; import info.jbcs.minecraft.chisel.client.GeneralChiselClient; import info.jbcs.minecraft.utilities.General; - -import java.util.Random; - import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import java.util.Random; + public class BlockHolystone extends BlockCarvable { public IIcon iconStar; @@ -24,7 +23,7 @@ public class BlockHolystone extends BlockCarvable @Override public void randomDisplayTick(World world, int x, int y, int z, Random random) { - if(General.rand.nextInt(4) == 0) + if(General.rand.nextInt(4) == 0 && world.isRemote) GeneralChiselClient.spawnHolystoneFX(world, this, x, y, z); } diff --git a/src/main/java/info/jbcs/minecraft/chisel/block/BlockLavastone.java b/src/main/java/info/jbcs/minecraft/chisel/block/BlockLavastone.java index 18885af1..5ef96453 100644 --- a/src/main/java/info/jbcs/minecraft/chisel/block/BlockLavastone.java +++ b/src/main/java/info/jbcs/minecraft/chisel/block/BlockLavastone.java @@ -18,7 +18,7 @@ public class BlockLavastone extends BlockMarbleTexturedOre @Override public void randomDisplayTick(World world, int x, int y, int z, Random random) { - if(random.nextInt(8) == 0) + if(random.nextInt(8) == 0 && world.isRemote) GeneralChiselClient.spawnLavastoneFX(world, this, x, y, z); } diff --git a/src/main/java/info/jbcs/minecraft/chisel/item/ItemChisel.java b/src/main/java/info/jbcs/minecraft/chisel/item/ItemChisel.java index 39d2d475..03a42bcb 100644 --- a/src/main/java/info/jbcs/minecraft/chisel/item/ItemChisel.java +++ b/src/main/java/info/jbcs/minecraft/chisel/item/ItemChisel.java @@ -1,29 +1,19 @@ package info.jbcs.minecraft.chisel.item; -import cpw.mods.fml.common.FMLCommonHandler; import info.jbcs.minecraft.chisel.Chisel; -import info.jbcs.minecraft.chisel.ChiselBlocks; -import info.jbcs.minecraft.chisel.Configurations; +import info.jbcs.minecraft.chisel.api.ChiselMode; +import info.jbcs.minecraft.chisel.api.IChiselMode; import info.jbcs.minecraft.chisel.carving.CarvableHelper; import info.jbcs.minecraft.chisel.carving.Carving; -import info.jbcs.minecraft.chisel.carving.CarvingVariation; -import info.jbcs.minecraft.chisel.client.GeneralChiselClient; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeHooks; -import java.util.HashMap; import java.util.HashSet; -import java.util.Random; import java.util.Set; -public class ItemChisel extends ItemTool +public class ItemChisel extends ItemTool implements IChiselMode { public static Carving carving = Carving.chisel; private static final HashSet toolSet = new HashSet(); @@ -56,7 +46,14 @@ public class ItemChisel extends ItemTool } @Override - public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) { + public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) + { return true; } + + @Override + public ChiselMode getChiselMode(ItemStack itemStack) + { + return ChiselMode.values()[itemStack.stackTagCompound.getInteger("chiselMode")]; + } } diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 421816d2..22b32935 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "chisel", "name": "Chisel", "description": "A mod that adds in many fancy blocks for decoration, which are crafted utilising the Chisel.", - "version": "1.5.6b", + "version": "1.5.7", "credits": "This mod uses a lot of textures from the Painterly pack: http://painterlypack.net/. Also one stone variation is designed to look like a block from Doku. Oh, and asie for porting the mod to 1.7.2", "logoFile": "", "mcversion": "1.7.10",