mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-11 15:57:31 +00:00
WIP left click chisel stuff
This commit is contained in:
1 parent
00c81ac21e
commit
108e5ceccc
12 files changed
+265
-186
No files matched your search
@@ -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<String, Long> chiselUseTime = new HashMap<String, Long>();
|
||||
HashMap<String, String> chiselUseLocation = new HashMap<String, String>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String, Long> chiselUseTime = new HashMap<String, Long>();
|
||||
HashMap<String, String> chiselUseLocation = new HashMap<String, String>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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<String> getWailaHead(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
public List<String> getWailaHead(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler)
|
||||
{
|
||||
return strings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
if(accessor.getBlock() instanceof BlockCarvable) {
|
||||
BlockCarvable block = (BlockCarvable)accessor.getBlock();
|
||||
public List<String> getWailaBody(ItemStack stack, List<String> 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<String> getWailaTail(ItemStack stack, List<String> strings, IWailaDataAccessor accessor, IWailaConfigHandler configHandler) {
|
||||
public List<String> getWailaTail(ItemStack stack, List<String> 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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> toolSet = new HashSet<String>();
|
||||
@@ -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")];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user