mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-18 11:39:14 +00:00
Finalizing AntiBlock prototype
This commit is contained in:
commit
dc4495e0b7
114 files changed
+826
-272
No files matched your search
@@ -1,6 +1,20 @@
|
||||
package com.cricketcraft.chisel;
|
||||
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.cricketcraft.chisel.block.BlockCarvable;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
|
||||
@@ -19,6 +33,7 @@ import com.cricketcraft.chisel.inventory.ContainerChisel;
|
||||
import com.cricketcraft.chisel.inventory.ContainerPresent;
|
||||
import com.cricketcraft.chisel.inventory.InventoryChiselSelection;
|
||||
import com.cricketcraft.chisel.item.chisel.ChiselController;
|
||||
import com.cricketcraft.chisel.network.PacketHandler;
|
||||
import com.cricketcraft.chisel.proxy.CommonProxy;
|
||||
import com.cricketcraft.chisel.utils.General;
|
||||
import com.cricketcraft.chisel.world.GeneratorChisel;
|
||||
@@ -30,8 +45,12 @@ import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
@@ -39,22 +58,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "com.cricketcraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft")
|
||||
@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "com.cricketcraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft;after:AWWayofTime")
|
||||
public class Chisel {
|
||||
|
||||
public static final List<String> modsSupported = new ArrayList<String>();
|
||||
@@ -71,7 +76,9 @@ public class Chisel {
|
||||
public static int renderCarpetId;
|
||||
public static int renderAutoChiselId;
|
||||
public static int renderGlowId;
|
||||
|
||||
public static int renderLayeredId;
|
||||
public static int roadLineId;
|
||||
|
||||
public static final Logger logger = LogManager.getLogger(MOD_ID);
|
||||
|
||||
@Instance(MOD_ID)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.cricketcraft.chisel;
|
||||
|
||||
import com.cricketcraft.chisel.item.chisel.ChiselController;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class PacketHandler {
|
||||
|
||||
public static final SimpleNetworkWrapper INSTANCE = new SimpleNetworkWrapper(Chisel.MOD_ID);
|
||||
|
||||
public static void init() {
|
||||
INSTANCE.registerMessage(ChiselController.PlaySoundHandler.class, ChiselController.PacketPlaySound.class, 0, Side.CLIENT);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.cricketcraft.chisel.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* To be implemented on blocks that "hide" another block inside, so connected textuers can still be
|
||||
|
||||
@@ -20,6 +20,7 @@ public class BlockAutoChisel extends BlockContainer {
|
||||
public BlockAutoChisel() {
|
||||
super(Material.rock);
|
||||
setHardness(1F);
|
||||
setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.8125f, 0.875f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +47,7 @@ public class BlockAutoChisel extends BlockContainer {
|
||||
if (tile != null && tile instanceof TileEntityAutoChisel && !player.isSneaking()) {
|
||||
player.openGui(Chisel.instance, 1, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ public class BlockCarvableGlow extends BlockCarvable {
|
||||
|
||||
public BlockCarvableGlow(String glowTexture) {
|
||||
super();
|
||||
this.setLightLevel(0.5F); //Same as redstone torch
|
||||
this.glowTexturePath = glowTexture;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCarvableGlowstone extends BlockCarvable {
|
||||
|
||||
public BlockCarvableGlowstone() {
|
||||
super(Material.glass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random) {
|
||||
return Blocks.glowstone.quantityDropped(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int a) {
|
||||
return Items.glowstone_dust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
Block glowstone = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return new ItemStack(Item.getItemFromBlock(glowstone), 1, meta);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableLayered extends BlockCarvable {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon baseTexture;
|
||||
private String baseTexLocation;
|
||||
|
||||
public BlockCarvableLayered(Material mat, String baseTexLocation) {
|
||||
super(mat);
|
||||
this.baseTexLocation = baseTexLocation;
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
super.registerBlockIcons(register);
|
||||
baseTexture = register.registerIcon(Chisel.MOD_ID + ":" + baseTexLocation);
|
||||
}
|
||||
public IIcon getBaseTex() {
|
||||
return baseTexture;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return Chisel.renderLayeredId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvableTorch extends BlockTorch implements ICarvable
|
||||
{
|
||||
public CarvableHelper carverHelper;
|
||||
private String texLocation;
|
||||
protected boolean emitsParticles = true;
|
||||
|
||||
public BlockCarvableTorch()
|
||||
{
|
||||
super();
|
||||
carverHelper = new CarvableHelper();
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
setLightLevel(0.9375F);
|
||||
setBlockName("torch");
|
||||
}
|
||||
@Override
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister icon){
|
||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/"+ texLocation);
|
||||
}
|
||||
public void setInformation(String textureLocation){
|
||||
this.texLocation = textureLocation;
|
||||
}
|
||||
public BlockCarvableTorch disableParticles()
|
||||
{
|
||||
this.emitsParticles = false;
|
||||
return this;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_)
|
||||
{
|
||||
if(emitsParticles)
|
||||
{
|
||||
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
||||
double d0 = (double)((float)p_149734_2_ + 0.5F);
|
||||
double d1 = (double)((float)p_149734_3_ + 0.7F);
|
||||
double d2 = (double)((float)p_149734_4_ + 0.5F);
|
||||
double d3 = 0.2199999988079071D;
|
||||
double d4 = 0.27000001072883606D;
|
||||
|
||||
if (l == 1)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 2)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 3)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 4)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BlockLightstoneCarvable extends BlockCarvable {
|
||||
|
||||
public BlockLightstoneCarvable() {
|
||||
super(Material.glass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random) {
|
||||
return Blocks.glowstone.quantityDropped(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random random, int a) {
|
||||
return Items.glowstone_dust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -6,19 +6,27 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.client.render.BlockRoadLineRenderer;
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
|
||||
public class BlockRoadLine extends Block {
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public IIcon aloneIcon;
|
||||
public IIcon halfLineIcon;
|
||||
public IIcon fullLineIcon;
|
||||
public class BlockRoadLine extends BlockCarvable {
|
||||
|
||||
public IIcon aloneIcon[] = new IIcon[4];
|
||||
public IIcon halfLineIcon[] = new IIcon[4];
|
||||
public IIcon fullLineIcon[] = new IIcon[4];
|
||||
|
||||
public BlockRoadLine() {
|
||||
super(Material.circuits);
|
||||
|
||||
if (Configurations.useRoadLineTool) {
|
||||
this.setHarvestLevel(Configurations.getRoadLineTool, Configurations.roadLineToolLevel);
|
||||
}
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.00390625f, 1.0f);
|
||||
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
}
|
||||
@@ -40,7 +48,7 @@ public class BlockRoadLine extends Block {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockRoadLineRenderer.id;
|
||||
return Chisel.roadLineId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,10 +70,25 @@ public class BlockRoadLine extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
blockIcon = aloneIcon = reg.registerIcon("Chisel:line-marking/white-center");
|
||||
halfLineIcon = reg.registerIcon("Chisel:line-marking/white-side");
|
||||
fullLineIcon = reg.registerIcon("Chisel:line-marking/white-long");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String[] texNames = { "white", "yellow", "double-white", "double-yellow" };
|
||||
aloneIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-center");
|
||||
halfLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-side");
|
||||
fullLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-long");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return aloneIcon[metadata % aloneIcon.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,9 @@ import net.minecraft.util.StatCollector;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.init.ChiselItems;
|
||||
import com.cricketcraft.chisel.network.PacketHandler;
|
||||
import com.cricketcraft.chisel.network.message.MessageAutoChisel;
|
||||
import com.cricketcraft.chisel.network.message.MessageSlotUpdate;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -42,7 +45,12 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
private ItemStack[] inventory = new ItemStack[7];
|
||||
private String name = "autoChisel";
|
||||
|
||||
public float xRot, yRot, zRot; // used for floating target client only
|
||||
// used for floating target client only
|
||||
public float xRot, yRot, zRot;
|
||||
|
||||
// used for chisel item rotation client only
|
||||
public float chiselRot;
|
||||
public boolean chiseling = false;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
@@ -122,22 +130,21 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
if (canMerge(chiseled)) {
|
||||
// if our output is empty, just use the current result
|
||||
if (output == null) {
|
||||
inventory[OUTPUT] = chiseled;
|
||||
setInventorySlotContents(OUTPUT, chiseled);
|
||||
} else {
|
||||
// otherwise just add our result to the existing stack
|
||||
inventory[OUTPUT].stackSize += chiseled.stackSize;
|
||||
slotChanged(OUTPUT);
|
||||
}
|
||||
// remove what we made from the stack
|
||||
base.stackSize -= chiseled.stackSize;
|
||||
slotChanged(BASE);
|
||||
if (base.stackSize <= 0) {
|
||||
inventory[BASE] = null; // clear out 0 size itemstacks
|
||||
setInventorySlotContents(BASE, null); // clear out 0 size itemstacks
|
||||
}
|
||||
|
||||
// TODO here we need to send a packet to the client so that the animation and sound can be played
|
||||
((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], inventory[TARGET]);
|
||||
|
||||
// we changed something, so we need to tell the chunk to save
|
||||
markDirty();
|
||||
chiselItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,7 +170,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
// need to check NBT as well as item
|
||||
if (toMerge.isItemEqual(inventory[OUTPUT]) && ItemStack.areItemStackTagsEqual(toMerge, inventory[OUTPUT])) {
|
||||
// we only care about metadata if the item has subtypes
|
||||
return toMerge.getHasSubtypes() && toMerge.getItemDamage() == inventory[OUTPUT].getItemDamage();
|
||||
return !toMerge.getHasSubtypes() || toMerge.getItemDamage() == inventory[OUTPUT].getItemDamage();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -173,6 +180,12 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
return inventory[CHISEL] != null && inventory[CHISEL].getItem() instanceof IChiselItem && inventory[CHISEL].stackSize >= 1;
|
||||
}
|
||||
|
||||
/** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */
|
||||
private void chiselItem() {
|
||||
((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], inventory[TARGET]);
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this), worldObj.provider.dimensionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
@@ -221,6 +234,14 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
slotChanged(slot);
|
||||
}
|
||||
}
|
||||
|
||||
private void slotChanged(int slot) {
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessageSlotUpdate(this, slot, inventory[slot]), worldObj.provider.dimensionId);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@@ -246,7 +267,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] { BASE, OUTPUT };
|
||||
return new int[] { BASE, TARGET, OUTPUT, CHISEL };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -270,7 +291,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||
return hasUpgrade(Upgrade.AUTOMATION) && slot == BASE;
|
||||
return hasUpgrade(Upgrade.AUTOMATION) && (slot == BASE || slot == TARGET || slot == CHISEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -337,4 +358,8 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
return Upgrade.values()[slotNumber - MIN_UPGRADE].getUnlocalizedName() + ".name";
|
||||
}
|
||||
}
|
||||
|
||||
public void doChiselAnim() {
|
||||
chiseling = true;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockCarvableGlow;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockCarvableLayered;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockLayeredRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockLayeredRenderer() {
|
||||
Chisel.renderLayeredId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, ((BlockCarvableLayered)block).getBaseTex(), renderer);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Drawing.renderAllFaces(renderer, block, x, y, z, ((BlockCarvableLayered) block).getBaseTex());
|
||||
Tessellator.instance.setBrightness(0xFFFFFF);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.renderLayeredId;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockRoadLine;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
@@ -15,10 +16,8 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int id;
|
||||
|
||||
public BlockRoadLineRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
Chisel.roadLineId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,10 +59,10 @@ public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
|
||||
boolean N = world.getBlock(x, y, z - 1).equals(block);
|
||||
boolean S = world.getBlock(x, y, z + 1).equals(block);
|
||||
boolean W = world.getBlock(x - 1, y, z).equals(block);
|
||||
boolean E = world.getBlock(x + 1, y, z).equals(block);
|
||||
boolean N = world.getBlock(x, y, z - 1).equals(block) && world.getBlockMetadata(x, y, z - 1) == meta;
|
||||
boolean S = world.getBlock(x, y, z + 1).equals(block) && world.getBlockMetadata(x, y, z + 1) == meta;
|
||||
boolean W = world.getBlock(x - 1, y, z).equals(block) && world.getBlockMetadata(x - 1, y, z) == meta;
|
||||
boolean E = world.getBlock(x + 1, y, z).equals(block) && world.getBlockMetadata(x + 1, y, z) == meta;
|
||||
|
||||
if (!N && !S && !W && !E) {
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -72,18 +71,18 @@ public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
if (N && S) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
} else {
|
||||
if (N) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (S) {
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
@@ -91,17 +90,17 @@ public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
if (E && W) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
} else {
|
||||
if (E) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (W) {
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon[meta];
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -118,6 +117,6 @@ public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
return Chisel.roadLineId;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
@@ -13,6 +14,7 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -27,6 +29,9 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.client.GeneralChiselClient;
|
||||
import com.cricketcraft.chisel.utils.GeneralClient;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@@ -169,21 +174,50 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer implements ISimp
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.35, y + 0.934, z + 0.5);
|
||||
item.getEntityItem().stackSize = autoChisel.getStackInSlot(TileEntityAutoChisel.BASE).stackSize;
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
item = autoChisel.getItemForRendering(TileEntityAutoChisel.CHISEL);
|
||||
if (item != null) {
|
||||
if (autoChisel.chiseling) {
|
||||
autoChisel.chiselRot += 1;
|
||||
if (autoChisel.chiselRot > 70) {
|
||||
chiselItem(autoChisel);
|
||||
}
|
||||
} else {
|
||||
autoChisel.chiselRot = Math.max(autoChisel.chiselRot - 1, 0);
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.7, y + 1, z + 0.5);
|
||||
GL11.glTranslated(x + 0.7, y + 1.01, z + 0.5);
|
||||
GL11.glRotatef(autoChisel.chiselRot, 0, 0, 1);
|
||||
GL11.glTranslated(-0.12, 0, 0);
|
||||
GL11.glScalef(0.9f, 0.9f, 0.9f);
|
||||
renderItem.doRender(item, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
autoChisel.chiselRot = 0;
|
||||
autoChisel.chiseling = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void chiselItem(TileEntityAutoChisel autoChisel) {
|
||||
World world = autoChisel.getWorldObj();
|
||||
ItemStack base = autoChisel.getStackInSlot(TileEntityAutoChisel.BASE);
|
||||
if (base != null) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
EntityDiggingFX particle = new EntityDiggingFX(world, autoChisel.xCoord + 0.5, autoChisel.yCoord + 1, autoChisel.zCoord + 0.5, 0, 0, 0, Block.getBlockFromItem(base.getItem()),
|
||||
base.getItemDamage());
|
||||
particle.setVelocity((world.rand.nextDouble() / 4) - 0.125, world.rand.nextDouble() / 8, (world.rand.nextDouble() / 4) - 0.125);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
||||
}
|
||||
String sound = Carving.chisel.getVariationSound(base.getItem(), base.getItemDamage());
|
||||
GeneralClient.playChiselSound(world, autoChisel.xCoord, autoChisel.yCoord, autoChisel.zCoord, sound);
|
||||
}
|
||||
autoChisel.chiseling = false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EntityItem getGhostItem(World world, ItemStack itemStack) {
|
||||
if (ghostItem == null) {
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.cricketcraft.chisel.config;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.cricketcraft.chisel.init.Features;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class Configurations {
|
||||
|
||||
public static Configuration config;
|
||||
@@ -39,6 +39,10 @@ public class Configurations {
|
||||
public static int diamondChiselMaxDamage;
|
||||
public static boolean ironChiselCanLeftClick;
|
||||
|
||||
public static boolean useRoadLineTool;
|
||||
public static String getRoadLineTool;
|
||||
public static int roadLineToolLevel;
|
||||
|
||||
public static boolean refreshConfig() {
|
||||
|
||||
String category;
|
||||
@@ -79,6 +83,12 @@ public class Configurations {
|
||||
diamondChiselMaxDamage = config.get(category, "diamondChiselMaxDamage", 5000, "The max damage of the diamond chisel. Default: 5000").getInt();
|
||||
ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean();
|
||||
|
||||
/* block */
|
||||
category = "block";
|
||||
useRoadLineTool = config.get(category, "useRoadLineTool", false, "Should the road line require a tool to break (If false, road lines can be broken in Adventure)").getBoolean();
|
||||
getRoadLineTool = config.get(category, "getRoadLineTool","pickaxe","The tool that is able to break roadLines (requires useRoadLineTool to be true to take effect)").getString();
|
||||
roadLineToolLevel = config.get(category, "roadLineToolLevel",0,"The lowest harvest level of the tool able to break the road lines (requires useRoadLineTool to be true to take effect) (0 = Wood/Gold, 1 = Stone, 2 = Iron, 3 = Diamond) Default: 0").getInt();
|
||||
|
||||
if (config.hasChanged()) {
|
||||
config.save();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.cricketcraft.chisel.init;
|
||||
|
||||
import com.cricketcraft.chisel.block.*;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
|
||||
import com.cricketcraft.chisel.block.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@ObjectHolder(Chisel.MOD_ID)
|
||||
public final class ChiselBlocks {
|
||||
@@ -29,7 +27,7 @@ public final class ChiselBlocks {
|
||||
public static final BlockCarvable iron_block = null;
|
||||
public static final BlockCarvable gold_block = null;
|
||||
public static final BlockCarvable diamond_block = null;
|
||||
public static final BlockLightstoneCarvable glowstone = null;
|
||||
public static final BlockCarvableGlowstone glowstone = null;
|
||||
public static final BlockCarvable lapis_block = null;
|
||||
public static final BlockCarvable emerald_block = null;
|
||||
public static final BlockCarvable nether_brick = null;
|
||||
@@ -78,13 +76,15 @@ public final class ChiselBlocks {
|
||||
public static final BlockCarvable technical = null;
|
||||
public static final BlockCarvableGlass technical2 = null;
|
||||
public static final BlockCarvable futura = null;
|
||||
public static final BlockCarvable bone = null;
|
||||
public static final BlockCarvable scorching = null;
|
||||
public static final BlockCarvable brickCustom = null;
|
||||
public static final BlockCarvable sign = null;
|
||||
public static final BlockCarvableLayered sign = null;
|
||||
public static final BlockCarvable arcane = null;
|
||||
public static final BlockCarvable thaumium = null;
|
||||
public static final BlockCarvable tallow = null;
|
||||
|
||||
public static final BlockCarvable bloodRune = null;
|
||||
public static final BlockCarvableSand colored_sand = null;
|
||||
public static BlockCarvableTorch[] torch = new BlockCarvableTorch[16];
|
||||
|
||||
// Arrays can't be final because of how @ObjectHolder works
|
||||
public static BlockCarvable[] planks = new BlockCarvable[6];
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
package com.cricketcraft.chisel.init;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.*;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import com.cricketcraft.chisel.entity.EntityBallOMoss;
|
||||
import com.cricketcraft.chisel.entity.EntityCloudInABottle;
|
||||
import com.cricketcraft.chisel.entity.EntitySmashingRock;
|
||||
import com.cricketcraft.chisel.item.*;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel.ChiselType;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -14,29 +28,8 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import com.cricketcraft.chisel.entity.EntityBallOMoss;
|
||||
import com.cricketcraft.chisel.entity.EntityCloudInABottle;
|
||||
import com.cricketcraft.chisel.entity.EntitySmashingRock;
|
||||
import com.cricketcraft.chisel.item.ItemBallOMoss;
|
||||
import com.cricketcraft.chisel.item.ItemCarvable;
|
||||
import com.cricketcraft.chisel.item.ItemCloudInABottle;
|
||||
import com.cricketcraft.chisel.item.ItemMarbleSlab;
|
||||
import com.cricketcraft.chisel.item.ItemSmashingRock;
|
||||
import com.cricketcraft.chisel.item.ItemUpgrade;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel.ChiselType;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import static com.cricketcraft.chisel.init.ChiselBlocks.*;
|
||||
import static com.cricketcraft.chisel.utils.General.*;
|
||||
import static com.cricketcraft.chisel.utils.General.sGNames;
|
||||
|
||||
public enum Features {
|
||||
|
||||
@@ -138,8 +131,47 @@ public enum Features {
|
||||
}
|
||||
},
|
||||
|
||||
THAUMIUM("Thaumcraft") {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable thaumium = (BlockCarvable) new BlockCarvable(Material.iron).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeMetal);
|
||||
Carving.chisel.addVariation("thaumium", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 4, 0);
|
||||
thaumium.carverHelper.addVariation(StatCollector.translateToLocal("tile.thaumium.0.desc"), 0, "thaumium/bevel");
|
||||
thaumium.carverHelper.addVariation(StatCollector.translateToLocal("tile.thaumium.1.desc"), 1, "thaumium/chunks");
|
||||
thaumium.carverHelper.addVariation(StatCollector.translateToLocal("tile.thaumium.2.desc"), 2, "thaumium/purplerunes");
|
||||
thaumium.carverHelper.addVariation(StatCollector.translateToLocal("tile.thaumium.3.desc"), 3, "thaumium/runes");
|
||||
thaumium.carverHelper.register(thaumium, "thaumium");
|
||||
Carving.chisel.registerOre("thaumium", "thaumium");
|
||||
}
|
||||
},
|
||||
|
||||
TALLOW("Thaumcraft") {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable tallow = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeSnow);
|
||||
Carving.chisel.addVariation("tallow", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 5, 0);
|
||||
tallow.carverHelper.register(tallow, "tallow");
|
||||
Carving.chisel.registerOre("tallow", "tallow");
|
||||
}
|
||||
},
|
||||
|
||||
AMBER("Thaumcraft") {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable amber = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeStone);
|
||||
Carving.chisel.addVariation("amber", GameRegistry.findBlock("Thaumcraft", "blockCosmeticOpaque"), 0, 0);
|
||||
Carving.chisel.addVariation("amber", GameRegistry.findBlock("Thaumcraft", "blockCosmeticOpaque"), 1, 1);
|
||||
amber.carverHelper.register(amber, "amber");
|
||||
Carving.chisel.registerOre("amber", "amber");
|
||||
}
|
||||
},
|
||||
|
||||
AUTO_CHISEL {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
Block autoChisel = new BlockAutoChisel().setBlockTextureName(Chisel.MOD_ID + ":autoChisel/autoChisel").setCreativeTab(ChiselTabs.tabChisel).setBlockName("autoChisel");
|
||||
GameRegistry.registerBlock(autoChisel, "autoChisel");
|
||||
@@ -147,8 +179,8 @@ public enum Features {
|
||||
|
||||
@Override
|
||||
void addRecipes() {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.autoChisel, 1), new Object[] { "XXX", "XYX", "XXX", Character.valueOf('X'), "plankWood", Character.valueOf('Y'),
|
||||
ChiselItems.chisel }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.autoChisel, 1), new Object[] { "XXX", " Y ", "YYY", Character.valueOf('X'), Blocks.stone_slab, Character.valueOf('Y'),
|
||||
"ingotIron" }));
|
||||
}
|
||||
},
|
||||
|
||||
@@ -176,12 +208,12 @@ public enum Features {
|
||||
}
|
||||
},
|
||||
|
||||
BLOOD_RUNE("AWWayOfTime") {
|
||||
BLOOD_RUNE("AWWayofTime") {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable bloodRune = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeStone);
|
||||
Carving.chisel.addVariation("bloodRune", GameRegistry.findBlock("AWWayOfTime", "bloodRune.blank"), 0, 0);
|
||||
Carving.chisel.addVariation("bloodRune", GameRegistry.findBlock("AWWayofTime", "AlchemicalWizardrybloodRune"), 0, 0);
|
||||
bloodRune.carverHelper.addVariation(StatCollector.translateToLocal("tile.bloodRune.0.desc"), 0, "bloodMagic/bloodRuneArranged");
|
||||
bloodRune.carverHelper.addVariation(StatCollector.translateToLocal("tile.bloodRune.1.desc"), 1, "bloodMagic/bloodRuneBricks");
|
||||
bloodRune.carverHelper.addVariation(StatCollector.translateToLocal("tile.bloodRune.2.desc"), 2, "bloodMagic/bloodRuneCarved");
|
||||
@@ -676,9 +708,10 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable futura = (BlockCarvable) new BlockCarvable(Material.rock/* , "futura/screenOverlay-ctm" */).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F)
|
||||
.setResistance(10F);
|
||||
futura.carverHelper.addVariation(StatCollector.translateToLocal("tile.futura.0.desc"), 0, "futura/screenMetallicWIP");
|
||||
futura.carverHelper.addVariation(StatCollector.translateToLocal("tile.futura.1.desc"), 1, "futura/screenCyanWIP");
|
||||
futura.carverHelper.addVariation(StatCollector.translateToLocal("tile.futura.2.desc"), 2, "futura/controllerWIP");
|
||||
futura.carverHelper.addVariation(StatCollector.translateToLocal("tile.futura.0.desc"), 0, "futura/WIP/screenMetallicWIP");
|
||||
futura.carverHelper.addVariation(StatCollector.translateToLocal("tile.futura.1.desc"), 1, "futura/WIP/screenCyanWIP");
|
||||
futura.carverHelper.addVariation(StatCollector.translateToLocal("tile.futura.2.desc"), 2, "futura/WIP/controllerWIP");
|
||||
futura.carverHelper.addVariation(StatCollector.translateToLocal("tile.futura.3.desc"), 3, "futura/WIP/wavyWIP");
|
||||
futura.carverHelper.register(futura, "futura");
|
||||
Carving.chisel.registerOre("futura", "futura");
|
||||
}
|
||||
@@ -732,6 +765,7 @@ public enum Features {
|
||||
|
||||
GLASS_STAINED {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
final String blockName = "stained_glass_" + sGNames[i].replaceAll(" ", "").toLowerCase();
|
||||
@@ -797,7 +831,7 @@ public enum Features {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockLightstoneCarvable glowstone = (BlockLightstoneCarvable) new BlockLightstoneCarvable().setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.3F).setLightLevel(1.0F)
|
||||
BlockCarvableGlowstone glowstone = (BlockCarvableGlowstone) new BlockCarvableGlowstone().setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.3F).setLightLevel(1.0F)
|
||||
.setStepSound(Block.soundTypeGlass);
|
||||
Carving.chisel.addVariation("glowstone", Blocks.glowstone, 0, 0);
|
||||
glowstone.carverHelper.addVariation(StatCollector.translateToLocal("tile.lightstone.1.desc"), 1, "lightstone/terrain-sulphur-cobble");
|
||||
@@ -1777,6 +1811,7 @@ public enum Features {
|
||||
|
||||
RC_QUARRIED_BLOCK(RAILCRAFT.getRequiredMod(), RAILCRAFT) {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
Carving.chisel.addVariation("RCQuarriedBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.quarried"), 0, 0);
|
||||
Carving.chisel.addVariation("RCQuarriedBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.quarried"), 1, 1);
|
||||
@@ -1835,6 +1870,10 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockRoadLine road_line = (BlockRoadLine) new BlockRoadLine().setStepSound(Block.soundTypeStone).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.01F)
|
||||
.setBlockName("roadLine");
|
||||
road_line.carverHelper.addVariation(StatCollector.translateToLocal("tile.roadLine.0.desc"), 0, "line-marking/white-center");
|
||||
road_line.carverHelper.addVariation(StatCollector.translateToLocal("tile.roadLine.1.desc"), 1, "line-marking/double-white-center");
|
||||
road_line.carverHelper.addVariation(StatCollector.translateToLocal("tile.roadLine.2.desc"), 2, "line-marking/yellow-center");
|
||||
road_line.carverHelper.addVariation(StatCollector.translateToLocal("tile.roadine.3.desc"), 3, "line-marking/double-yellow-center");
|
||||
GameRegistry.registerBlock(road_line, ItemCarvable.class, "road_line");
|
||||
Carving.chisel.registerOre("roadLine", "roadLine");
|
||||
}
|
||||
@@ -2082,6 +2121,7 @@ public enum Features {
|
||||
|
||||
TEMPLE_BLOCK_MOSSY {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable mossy_templeblock = (BlockCarvable) new BlockEldritch().setHardness(2.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setResistance(10F)
|
||||
.setStepSound(Chisel.soundTempleFootstep);
|
||||
@@ -2229,6 +2269,7 @@ public enum Features {
|
||||
|
||||
VOIDSTONE_PILLARS {
|
||||
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockVoidstonePillar voidstonePillar = (BlockVoidstonePillar) new BlockVoidstonePillar().setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setStepSound(Block.soundTypeStone);
|
||||
voidstonePillar.carvableHelper.addVariation(StatCollector.translateToLocal("tile.voidstonePillar.0.desc"), 0, "voidstone/pillar-side");
|
||||
@@ -2334,7 +2375,52 @@ public enum Features {
|
||||
boolean needsMetaRecipes() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
WARNING_SIGN {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvableLayered sign = (BlockCarvableLayered) new BlockCarvableLayered(Material.iron, "warning/base").setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10.0F);
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.0.desc"), 0, "warning/rad");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.1.desc"), 1, "warning/bio");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.2.desc"), 2, "warning/fire");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.3.desc"), 3, "warning/explosion");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.4.desc"), 4, "warning/death");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.5.desc"), 5, "warning/falling");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.6.desc"), 6, "warning/fall");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.7.desc"), 7, "warning/voltage");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.8.desc"), 8, "warning/generic");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.9.desc"), 9, "warning/acid");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.10.desc"), 10, "warning/underconstruction");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.11.desc"), 11, "warning/sound");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.12.desc"), 12, "warning/noentry");
|
||||
sign.carverHelper.addVariation(StatCollector.translateToLocal("tile.warningSign.13.desc"), 13, "warning/cryogenic");
|
||||
sign.carverHelper.register(sign, "warningSign");
|
||||
Carving.chisel.registerOre("warningSign", "warningSign");
|
||||
}
|
||||
@Override
|
||||
void addRecipes() {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.sign, 4, 0), new Object[]{"xxx", "xyx", "xxx", 'x', "stone", 'y', Items.sign}));
|
||||
}
|
||||
},
|
||||
|
||||
TORCH {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
Carving.chisel.addVariation("torch", Blocks.torch, 0, 0);
|
||||
for(int type = 0; type < 10; type++){
|
||||
if(type == 8 || type == 9)
|
||||
torch[type] = new BlockCarvableTorch().disableParticles();
|
||||
else
|
||||
torch[type] = new BlockCarvableTorch();
|
||||
|
||||
torch[type].setInformation("torch" + (type + 1));
|
||||
GameRegistry.registerBlock(torch[type], "torch" + (type + 1));
|
||||
Carving.chisel.addVariation("torch", torch[type], 0, (type + 1));
|
||||
}
|
||||
Carving.chisel.registerOre("torch", "torch");
|
||||
}
|
||||
},
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.cricketcraft.chisel.item.chisel;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -15,17 +11,14 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.PacketHandler;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.carving.CarvingVariation;
|
||||
import com.cricketcraft.chisel.client.GeneralChiselClient;
|
||||
import com.cricketcraft.chisel.network.PacketHandler;
|
||||
import com.cricketcraft.chisel.network.message.MessageChiselSound;
|
||||
import com.cricketcraft.chisel.utils.General;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public final class ChiselController {
|
||||
|
||||
@@ -95,56 +88,9 @@ public final class ChiselController {
|
||||
* Assumes that the player is holding a chisel
|
||||
*/
|
||||
private void setVariation(EntityPlayer player, World world, int x, int y, int z, CarvingVariation v, ItemStack target) {
|
||||
PacketHandler.INSTANCE.sendTo(new PacketPlaySound(x, y, z, v), (EntityPlayerMP) player);
|
||||
PacketHandler.INSTANCE.sendTo(new MessageChiselSound(x, y, z, v), (EntityPlayerMP) player);
|
||||
world.setBlock(x, y, z, v.block);
|
||||
world.setBlockMetadataWithNotify(x, y, z, v.meta, 3);
|
||||
((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.inventory, player.inventory.currentItem, player.getCurrentEquippedItem(), target);
|
||||
}
|
||||
|
||||
public static class PacketPlaySound implements IMessage {
|
||||
|
||||
public PacketPlaySound() {
|
||||
}
|
||||
|
||||
private int x, y, z;
|
||||
private int block;
|
||||
private byte meta;
|
||||
|
||||
public PacketPlaySound(int x, int y, int z, CarvingVariation v) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.block = Block.getIdFromBlock(v.block);
|
||||
this.meta = (byte) v.meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
buf.writeInt(block);
|
||||
buf.writeByte(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
block = buf.readInt();
|
||||
meta = buf.readByte();
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlaySoundHandler implements IMessageHandler<PacketPlaySound, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketPlaySound message, MessageContext ctx) {
|
||||
String sound = ItemChisel.carving.getVariationSound(Block.getBlockById(message.block), message.meta);
|
||||
GeneralChiselClient.spawnChiselEffect(message.x, message.y, message.z, sound);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cricketcraft.chisel.network;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.network.message.MessageAutoChisel;
|
||||
import com.cricketcraft.chisel.network.message.MessageChiselSound;
|
||||
import com.cricketcraft.chisel.network.message.MessageSlotUpdate;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class PacketHandler {
|
||||
|
||||
public static final SimpleNetworkWrapper INSTANCE = new SimpleNetworkWrapper(Chisel.MOD_ID);
|
||||
|
||||
public static void init() {
|
||||
int id = 0;
|
||||
|
||||
INSTANCE.registerMessage(MessageChiselSound.Handler.class, MessageChiselSound.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(MessageSlotUpdate.Handler.class, MessageSlotUpdate.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.cricketcraft.chisel.network.message;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import com.cricketcraft.chisel.network.message.base.MessageCoords;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class MessageAutoChisel extends MessageCoords {
|
||||
|
||||
public MessageAutoChisel() {
|
||||
}
|
||||
|
||||
public MessageAutoChisel(TileEntityAutoChisel tile) {
|
||||
super(tile);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<MessageAutoChisel, IMessage> {
|
||||
|
||||
public IMessage onMessage(MessageAutoChisel message, MessageContext ctx) {
|
||||
|
||||
TileEntity te = message.getTileEntity(ctx);
|
||||
if (te instanceof TileEntityAutoChisel) {
|
||||
((TileEntityAutoChisel) te).doChiselAnim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.cricketcraft.chisel.network.message;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import com.cricketcraft.chisel.carving.CarvingVariation;
|
||||
import com.cricketcraft.chisel.client.GeneralChiselClient;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel;
|
||||
import com.cricketcraft.chisel.network.message.base.MessageCoords;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class MessageChiselSound extends MessageCoords {
|
||||
|
||||
public MessageChiselSound() {
|
||||
super();
|
||||
}
|
||||
|
||||
private int block;
|
||||
private byte meta;
|
||||
|
||||
public MessageChiselSound(int x, int y, int z, CarvingVariation v) {
|
||||
super(x, y, z);
|
||||
this.block = Block.getIdFromBlock(v.block);
|
||||
this.meta = (byte) v.meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeInt(block);
|
||||
buf.writeByte(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
block = buf.readInt();
|
||||
meta = buf.readByte();
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<MessageChiselSound, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(MessageChiselSound message, MessageContext ctx) {
|
||||
String sound = ItemChisel.carving.getVariationSound(Block.getBlockById(message.block), message.meta);
|
||||
GeneralChiselClient.spawnChiselEffect(message.x, message.y, message.z, sound);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.cricketcraft.chisel.network.message;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.network.message.base.MessageCoords;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class MessageSlotUpdate extends MessageCoords {
|
||||
|
||||
public MessageSlotUpdate() {
|
||||
}
|
||||
|
||||
private int slot;
|
||||
private ItemStack stack;
|
||||
|
||||
public MessageSlotUpdate(TileEntity te, int slot, ItemStack stack) {
|
||||
super(te);
|
||||
this.slot = slot;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeInt(slot);
|
||||
ByteBufUtils.writeItemStack(buf, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
this.slot = buf.readInt();
|
||||
this.stack = ByteBufUtils.readItemStack(buf);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<MessageSlotUpdate, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(MessageSlotUpdate message, MessageContext ctx) {
|
||||
TileEntity te = Chisel.proxy.getClientWorld().getTileEntity(message.x, message.y, message.z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
((IInventory) te).setInventorySlotContents(message.slot, message.stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.cricketcraft.chisel.network.message.base;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public abstract class MessageCoords implements IMessage {
|
||||
|
||||
public int x, y, z;
|
||||
|
||||
protected MessageCoords() {
|
||||
;
|
||||
}
|
||||
|
||||
protected MessageCoords(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
protected MessageCoords(TileEntity te) {
|
||||
this(te.xCoord, te.yCoord, te.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.x = buf.readInt();
|
||||
this.y = buf.readInt();
|
||||
this.z = buf.readInt();
|
||||
}
|
||||
|
||||
protected Block getBlock(MessageContext ctx) {
|
||||
return getWorld(ctx).getBlock(x, y, z);
|
||||
}
|
||||
|
||||
protected TileEntity getTileEntity(MessageContext ctx) {
|
||||
return getWorld(ctx).getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
protected World getWorld(MessageContext ctx) {
|
||||
if (ctx.side == Side.CLIENT) {
|
||||
return Chisel.proxy.getClientWorld();
|
||||
} else {
|
||||
return ctx.getServerHandler().playerEntity.worldObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,8 @@
|
||||
package com.cricketcraft.chisel.proxy;
|
||||
|
||||
import com.cricketcraft.chisel.client.render.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
|
||||
import com.cricketcraft.chisel.client.render.*;
|
||||
import com.cricketcraft.chisel.client.render.item.ItemChiselRenderer;
|
||||
import com.cricketcraft.chisel.client.render.item.ItemPresentRenderer;
|
||||
import com.cricketcraft.chisel.client.render.tile.RenderAutoChisel;
|
||||
@@ -19,9 +12,14 @@ import com.cricketcraft.chisel.entity.EntityCloudInABottle;
|
||||
import com.cricketcraft.chisel.entity.EntitySmashingRock;
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
import com.cricketcraft.chisel.init.ChiselItems;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
@@ -44,6 +42,7 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerBlockHandler(new BlockCarpetRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockGlowRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockCTMNoLightRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockLayeredRenderer());
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new BlockTexturedOreRenderer());
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ package com.cricketcraft.chisel.utils;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GeneralClient {
|
||||
|
||||
public static Random rand = new Random();
|
||||
|
||||
Reference in new issue
Block a user