mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 10:45:02 +00:00
Trying to add multiblock but it aint working
This commit is contained in:
1 parent
ab2cd0f372
commit
f7e2dc0c07
16 files changed
+169
-8
No files matched your search
@@ -1,10 +1,13 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,6 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAutoChisel extends BlockContainer {
|
||||
@@ -51,6 +55,18 @@ public class BlockAutoChisel extends BlockContainer {
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata){
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int metadata, CreativeTabs creativeTabs, List subItems){
|
||||
for(int x = 0; x < 4; x++){
|
||||
subItems.add(new ItemStack(this, 1, x));
|
||||
}
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z) {
|
||||
Random random = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockAutoChisel extends ItemBlock{
|
||||
|
||||
private final String[] names = {"base", "speed", "automation", "stack"};
|
||||
private int metadata;
|
||||
|
||||
public ItemBlockAutoChisel(Block block) {
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta){
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack){
|
||||
return getUnlocalizedName() + "." + names[itemStack.getItemDamage()];
|
||||
}
|
||||
|
||||
}
|
||||
+18
-1
@@ -10,7 +10,7 @@ import org.lwjgl.opengl.GL11;
|
||||
public class ItemAutoChiselRenderer implements IItemRenderer{
|
||||
|
||||
private final ModelAutoChisel model = new ModelAutoChisel();
|
||||
private final ResourceLocation texture = new ResourceLocation("chisel:textures/blocks/autoChisel.png");
|
||||
private ResourceLocation texture;
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
@@ -24,6 +24,23 @@ public class ItemAutoChiselRenderer implements IItemRenderer{
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (item.getItemDamage()){
|
||||
case 0:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
case 1:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_speed.png");
|
||||
break;
|
||||
case 2:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_automation.png");
|
||||
break;
|
||||
case 3:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_stack.png");
|
||||
break;
|
||||
default:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
}
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
|
||||
switch (type){
|
||||
case ENTITY:
|
||||
|
||||
@@ -21,7 +21,7 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer {
|
||||
private static EntityItem ghostItem;
|
||||
private static TileEntityAutoChisel autoChisel;
|
||||
private final ModelAutoChisel model;
|
||||
private final ResourceLocation texture = new ResourceLocation("chisel:textures/blocks/autoChisel.png");
|
||||
private ResourceLocation texture;
|
||||
private final RenderItem renderTargetAndChisel, renderBase;
|
||||
|
||||
public RenderAutoChisel(){
|
||||
@@ -46,6 +46,23 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
|
||||
switch (tile.getBlockMetadata()){
|
||||
case 0:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
case 1:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_speed.png");
|
||||
break;
|
||||
case 2:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_automation.png");
|
||||
break;
|
||||
case 3:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_stack.png");
|
||||
break;
|
||||
default:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
}
|
||||
bindTexture(texture);
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
|
||||
@@ -87,7 +87,7 @@ public class ModBlocks {
|
||||
{
|
||||
if(Configurations.featureEnabled("autoChisel")){
|
||||
autoChisel = new BlockAutoChisel().setBlockTextureName("Chisel:autoChisel").setCreativeTab(ModTabs.tabChisel).setBlockName("autoChisel");
|
||||
GameRegistry.registerBlock(autoChisel, autoChisel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(autoChisel, ItemBlockAutoChisel.class, "autoChisel");
|
||||
Chisel.proxy.registerTileEntities();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,16 +7,14 @@ import info.jbcs.minecraft.chisel.Configurations;
|
||||
import info.jbcs.minecraft.chisel.entity.EntityBallOMoss;
|
||||
import info.jbcs.minecraft.chisel.entity.EntityCloudInABottle;
|
||||
import info.jbcs.minecraft.chisel.entity.EntitySmashingRock;
|
||||
import info.jbcs.minecraft.chisel.item.ItemBallOMoss;
|
||||
import info.jbcs.minecraft.chisel.item.ItemChisel;
|
||||
import info.jbcs.minecraft.chisel.item.ItemCloudInABottle;
|
||||
import info.jbcs.minecraft.chisel.item.ItemSmashingRock;
|
||||
import info.jbcs.minecraft.chisel.item.*;
|
||||
|
||||
public class ModItems {
|
||||
public static ItemChisel chisel;
|
||||
public static ItemCloudInABottle itemCloudInABottle;
|
||||
public static ItemBallOMoss itemBallOMoss;
|
||||
public static ItemSmashingRock smashingRock;
|
||||
public static ItemUpgrade upgrade;
|
||||
|
||||
public static void load() {
|
||||
chisel = (ItemChisel) new ItemChisel().setTextureName("chisel:chisel").setCreativeTab(ModTabs.tabChisel);
|
||||
@@ -39,5 +37,10 @@ public class ModItems {
|
||||
EntityRegistry.registerModEntity(EntitySmashingRock.class, "SmashingRock", 2, Chisel.instance, 40, 1, true);
|
||||
GameRegistry.registerItem(smashingRock, "smashingrock");
|
||||
}
|
||||
|
||||
if(Configurations.featureEnabled("autoChiselUpgrades")){
|
||||
upgrade = (ItemUpgrade) new ItemUpgrade("upgrade").setCreativeTab(ModTabs.tabChisel);
|
||||
GameRegistry.registerItem(upgrade, upgrade.getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package info.jbcs.minecraft.chisel.item;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemUpgrade extends Item{
|
||||
|
||||
public IIcon[] icons = new IIcon[6];
|
||||
|
||||
public ItemUpgrade(String unlocalizedName) {
|
||||
super();
|
||||
this.setUnlocalizedName(unlocalizedName);
|
||||
this.setCreativeTab(CreativeTabs.tabMaterials);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){
|
||||
System.out.println(this.getIconFromDamage(itemStack.getItemDamage()));
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4){
|
||||
list.add(StatCollector.translateToLocal(this.getUnlocalizedName(itemStack) + ".desc"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta > 3)
|
||||
meta = 0;
|
||||
|
||||
return this.icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
for (int i = 0; i < 3; i ++) {
|
||||
this.icons[i] = reg.registerIcon(Chisel.MOD_ID + ":upgradeItem_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 3; i ++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0:
|
||||
return this.getUnlocalizedName() + "_speed";
|
||||
case 1:
|
||||
return this.getUnlocalizedName() + "_automation";
|
||||
case 2:
|
||||
return this.getUnlocalizedName() + "_stack";
|
||||
default:
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import info.jbcs.minecraft.chisel.entity.EntityCloudInABottle;
|
||||
import info.jbcs.minecraft.chisel.entity.EntitySmashingRock;
|
||||
import info.jbcs.minecraft.chisel.init.ModBlocks;
|
||||
import info.jbcs.minecraft.chisel.init.ModItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
Reference in new issue
Block a user