fix more texturing issues

This commit is contained in:
Raoul Van den Berge
2015-12-30 13:17:08 +01:00
parent 60829d6868
commit 41bd853d15
10 changed files with 65 additions and 22 deletions

View File

@@ -1,6 +1,8 @@
package storagecraft.item;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -35,10 +37,8 @@ public class ItemWirelessGrid extends ItemBase
@Override
public void getSubItems(Item item, CreativeTabs tab, List list)
{
for (int i = 0; i < 2; ++i)
{
list.add(new ItemStack(item, 1, i));
}
list.add(new ItemStack(item, 1, 0));
list.add(new ItemStack(item, 1, 1));
}
@Override
@@ -106,32 +106,27 @@ public class ItemWirelessGrid extends ItemBase
return stack;
}
public boolean isCrafting(ItemStack stack)
{
return stack.getItemDamage() == 1;
}
public int getX(ItemStack stack)
public static int getX(ItemStack stack)
{
return stack.getTagCompound().getInteger(NBT_WIRELESS_TRANSMITTER_X);
}
public int getY(ItemStack stack)
public static int getY(ItemStack stack)
{
return stack.getTagCompound().getInteger(NBT_WIRELESS_TRANSMITTER_Y);
}
public int getZ(ItemStack stack)
public static int getZ(ItemStack stack)
{
return stack.getTagCompound().getInteger(NBT_WIRELESS_TRANSMITTER_Z);
}
public boolean isInRange(ItemStack stack, EntityPlayer player)
public static boolean isInRange(ItemStack stack, EntityPlayer player)
{
return (int) Math.sqrt(Math.pow(getX(stack) - player.posX, 2) + Math.pow(getY(stack) - player.posY, 2) + Math.pow(getZ(stack) - player.posZ, 2)) < 64;
}
public boolean isValid(ItemStack stack)
public static boolean isValid(ItemStack stack)
{
return stack.hasTagCompound() && stack.getTagCompound().hasKey(NBT_WIRELESS_TRANSMITTER_X) && stack.getTagCompound().hasKey(NBT_WIRELESS_TRANSMITTER_Y) && stack.getTagCompound().hasKey(NBT_WIRELESS_TRANSMITTER_Z);
}

View File

@@ -1,10 +1,12 @@
package storagecraft.proxy;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.ItemModelMesher;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
@@ -14,10 +16,7 @@ import storagecraft.StorageCraftItems;
import storagecraft.block.BlockController;
import storagecraft.block.EnumControllerType;
import storagecraft.block.EnumGridType;
import storagecraft.item.ItemCore;
import storagecraft.item.ItemProcessor;
import storagecraft.item.ItemStorageCell;
import storagecraft.item.ItemStoragePart;
import storagecraft.item.*;
import storagecraft.render.BlockCableRenderer;
import storagecraft.render.ItemCableRenderer;
import storagecraft.tile.TileCable;
@@ -59,6 +58,11 @@ public class ClientProxy extends CommonProxy
"storagecraft:destruction_core"
);
ModelBakery.addVariantName(StorageCraftItems.WIRELESS_GRID,
"storagecraft:wireless_grid_connected",
"storagecraft:wireless_grid_disconnected"
);
ClientRegistry.bindTileEntitySpecialRenderer(TileCable.class, new BlockCableRenderer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(StorageCraftBlocks.CABLE), new ItemCableRenderer());
@@ -99,6 +103,14 @@ public class ClientProxy extends CommonProxy
mesher.register(StorageCraftItems.CORE, ItemCore.TYPE_DESTRUCTION, new ModelResourceLocation("storagecraft:destruction_core", "inventory"));
mesher.register(StorageCraftItems.WIRELESS_GRID_PLATE, 0, new ModelResourceLocation("storagecraft:wireless_grid_plate", "inventory"));
mesher.register(StorageCraftItems.WIRELESS_GRID, new ItemMeshDefinition()
{
@Override
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return new ModelResourceLocation("storagecraft:wireless_grid_" + (ItemWirelessGrid.isValid(stack) ? "connected" : "disconnected"), "inventory");
}
});
// Blocks
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.GRID), EnumGridType.NORMAL.getId(), new ModelResourceLocation("storagecraft:grid", "inventory"));

View File

@@ -64,8 +64,8 @@ public class CommonProxy
GameRegistry.registerBlock(StorageCraftBlocks.DESTRUCTOR, "destructor");
GameRegistry.registerBlock(StorageCraftBlocks.CONSTRUCTOR, "constructor");
GameRegistry.registerItem(StorageCraftItems.STORAGE_CELL, "storageCell");
GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID, "wirelessGrid");
GameRegistry.registerItem(StorageCraftItems.STORAGE_CELL, "storage_cell");
GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID, "wireless_grid");
GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID_PLATE, "wireless_grid_plate");
GameRegistry.registerItem(StorageCraftItems.QUARTZ_ENRICHED_IRON, "quartz_enriched_iron");
GameRegistry.registerItem(StorageCraftItems.CORE, "core");

View File

@@ -11,8 +11,8 @@ import storagecraft.tile.TileCable;
public class CableModel extends ModelBase
{
public static final ResourceLocation CABLE_RESOURCE = new ResourceLocation("storagecraft:textures/blocks/cable.png");
public static final ResourceLocation CABLE_UNPOWERED_RESOURCE = new ResourceLocation("storagecraft:textures/blocks/cableUnpowered.png");
public static final ResourceLocation CABLE_POWERED_RESOURCE = new ResourceLocation("storagecraft:textures/blocks/cablePowered.png");
public static final ResourceLocation CABLE_UNPOWERED_RESOURCE = new ResourceLocation("storagecraft:textures/blocks/cable_sensitive_unpowered.png");
public static final ResourceLocation CABLE_POWERED_RESOURCE = new ResourceLocation("storagecraft:textures/blocks/cable_sensitive_powered.png");
private ModelRenderer core;
private ModelRenderer up;

View File

@@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "storagecraft:items/wireless_grid_connected"
},
"display": {
"thirdperson": {
"rotation": [-90, 0, 0],
"translation": [0, 1, -3],
"scale": [0.55, 0.55, 0.55]
},
"firstperson": {
"rotation": [0, -135, 25],
"translation": [0, 4, 2],
"scale": [1.7, 1.7, 1.7]
}
}
}

View File

@@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "storagecraft:items/wireless_grid_disconnected"
},
"display": {
"thirdperson": {
"rotation": [-90, 0, 0],
"translation": [0, 1, -3],
"scale": [0.55, 0.55, 0.55]
},
"firstperson": {
"rotation": [0, -135, 25],
"translation": [0, 4, 2],
"scale": [1.7, 1.7, 1.7]
}
}
}