Added insulation item for wires

This commit is contained in:
Calclavia 2014-03-13 20:04:19 +08:00
parent b3e5e8cf7c
commit bf08756a82
9 changed files with 58 additions and 15 deletions

View file

@ -115,7 +115,6 @@ public class Archaic
proxy.preInit();
Settings.CONFIGURATION.save();
TabRI.ITEMSTACK = new ItemStack(blockEngineeringTable);
PacketAnnotation.register(TileFirebox.class);
PacketAnnotation.register(TileFilter.class);
@ -132,6 +131,8 @@ public class Archaic
@EventHandler
public void postInit(FMLPostInitializationEvent evt)
{
TabRI.ITEMSTACK = new ItemStack(blockEngineeringTable);
// Add recipes
GameRegistry.addRecipe(new ShapedOreRecipe(blockEngineeringTable, "P", "C", 'P', Block.pressurePlatePlanks, 'C', Block.workbench));
GameRegistry.addRecipe(new ShapedOreRecipe(blockFilter, "B", "P", "B", 'B', Block.fenceIron, 'P', Item.paper));

View file

@ -11,6 +11,7 @@ import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.Settings;
import resonantinduction.core.TabRI;
import resonantinduction.core.resource.ItemResourcePart;
import resonantinduction.electrical.battery.BlockBattery;
import resonantinduction.electrical.battery.ItemBlockBattery;
import resonantinduction.electrical.battery.TileBattery;
@ -89,6 +90,7 @@ public class Electrical
public static Item itemLevitator;
public static Block blockArmbot;
public static Item itemDisk;
public static Item itemInsulation;
// Quantum
public static Block blockQuantumGate;
@ -110,9 +112,11 @@ public class Electrical
// Transport
itemLevitator = contentRegistry.createItem(ItemLevitator.class);
// blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class);
// blockEncoder = contentRegistry.createTile(BlockEncoder.class, TileEncoder.class);
// blockArmbot = contentRegistry.createTile(BlockArmbot.lass, TileEncoder.clclass,
// TileArmbot.class);
// blockEncoder = contentRegistry.createTile(BlockEncoder.cass);
itemDisk = contentRegistry.createItem(ItemDisk.class);
itemInsulation = contentRegistry.createItem("insulation", ItemResourcePart.class);
// Generator
blockSolarPanel = (BlockSolarPanel) contentRegistry.createTile(BlockSolarPanel.class, TileSolarPanel.class);
@ -173,6 +177,9 @@ public class Electrical
GameRegistry.addRecipe(new ShapedOreRecipe(tierThreeBattery, "RRR", "RIR", "RRR", 'R', tierTwoBattery, 'I', Block.blockDiamond));
/** Wires **/
GameRegistry.addRecipe(new ShapelessOreRecipe(itemInsulation, Item.slimeBall, new ItemStack(Block.cloth, 2, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapelessOreRecipe(itemInsulation, "slimeball", new ItemStack(Block.cloth, 2, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.COPPER.getWire(3), "MMM", 'M', "ingotCopper"));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.TIN.getWire(3), "MMM", 'M', "ingotTin"));
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.IRON.getWire(3), "MMM", 'M', Item.ingotIron));

View file

@ -8,12 +8,14 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemShears;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.MultipartUtility;
import resonantinduction.electrical.Electrical;
import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.energy.IConductor;
import calclavia.lib.CustomDamageSource;
@ -26,6 +28,7 @@ import codechicken.multipart.TMultiPart;
* @author Calclavia
*
*/
@Deprecated
public abstract class PartAdvancedWire extends PartConductor
{
public static final int DEFAULT_COLOR = 15;
@ -33,6 +36,7 @@ public abstract class PartAdvancedWire extends PartConductor
public EnumWireMaterial material = EnumWireMaterial.COPPER;
public boolean isInsulated = false;
protected Item insulationType = Electrical.itemInsulation;
/**
* INTERNAL USE.
@ -216,13 +220,13 @@ public abstract class PartAdvancedWire extends PartConductor
this.setColor(dyeColor);
return true;
}
else if (itemStack.itemID == Block.cloth.blockID)
else if (itemStack.getItem() == insulationType)
{
if (this.isInsulated())
{
if (!world().isRemote && player.capabilities.isCreativeMode)
{
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
tile().dropItems(Collections.singletonList(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color))));
}
this.setInsulated(false);
@ -243,7 +247,7 @@ public abstract class PartAdvancedWire extends PartConductor
{
if (!world().isRemote && !player.capabilities.isCreativeMode)
{
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
tile().dropItems(Collections.singletonList(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color))));
}
this.setInsulated(false);
@ -268,7 +272,7 @@ public abstract class PartAdvancedWire extends PartConductor
if (this.isInsulated)
{
drops.add(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color)));
drops.add(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color)));
}
return drops;

View file

@ -19,6 +19,7 @@ import universalelectricity.api.vector.VectorHelper;
import codechicken.multipart.TMultiPart;
@UniversalClass
@Deprecated
public abstract class PartConductor extends PartAdvanced implements IConductor
{
private IEnergyNetwork network;

View file

@ -7,11 +7,13 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemShears;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import resonantinduction.core.MultipartUtility;
import resonantinduction.electrical.Electrical;
import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
@ -27,6 +29,7 @@ public abstract class PartColorableMaterial<M extends Enum> extends PartAdvanced
public M material;
public boolean isInsulated = false;
public boolean requiresInsulation = true;
protected Item insulationType = Electrical.itemInsulation;
/**
* Material Methods
@ -136,13 +139,13 @@ public abstract class PartColorableMaterial<M extends Enum> extends PartAdvanced
}
else if (requiresInsulation)
{
if (itemStack.itemID == Block.cloth.blockID)
if (itemStack.getItem() == insulationType)
{
if (this.isInsulated())
{
if (!world().isRemote && player.capabilities.isCreativeMode)
{
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
tile().dropItems(Collections.singletonList(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color))));
}
this.setInsulated(false);
@ -163,7 +166,7 @@ public abstract class PartColorableMaterial<M extends Enum> extends PartAdvanced
{
if (!world().isRemote && !player.capabilities.isCreativeMode)
{
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
tile().dropItems(Collections.singletonList(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color))));
}
this.setInsulated(false);
@ -183,7 +186,7 @@ public abstract class PartColorableMaterial<M extends Enum> extends PartAdvanced
if (requiresInsulation && isInsulated)
{
drops.add(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color)));
drops.add(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color)));
}
return drops;

View file

@ -0,0 +1,17 @@
package resonantinduction.core.resource;
import net.minecraft.item.Item;
/**
* A general item class that does nothing but act as recipe resource item.
*
* @author Calclavia
*
*/
public class ItemResourcePart extends Item
{
public ItemResourcePart(int par1)
{
super(par1);
}
}

View file

@ -73,6 +73,7 @@ public class ResourceGenerator implements IVirtualObject
static
{
OreDetectionBlackList.addIngot("ingotRefinedIron");
OreDetectionBlackList.addIngot("uranium");
SaveManager.registerClass("resourceGenerator", ResourceGenerator.class);
SaveManager.register(INSTANCE);
}
@ -136,7 +137,14 @@ public class ResourceGenerator implements IVirtualObject
if (list.size() > 0)
{
ItemStack type = list.get(0);
localizedName = type.getDisplayName().replace(LanguageUtility.getLocal("misc.resonantinduction.ingot"), "").replaceAll("^ ", "").replaceAll(" $", "");
localizedName = type.getDisplayName();
if (LanguageUtility.getLocal(localizedName) != null && LanguageUtility.getLocal(localizedName) != "")
{
localizedName = LanguageUtility.getLocal(localizedName);
}
localizedName.replace(LanguageUtility.getLocal("misc.resonantinduction.ingot"), "").replaceAll("^ ", "").replaceAll(" $", "");
}
/** Generate molten fluids */

View file

@ -14,6 +14,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.oredict.OreDictionary;
import resonantinduction.core.Reference;
import resonantinduction.core.TabRI;
import resonantinduction.core.resource.ItemOreResource;
@ -47,6 +48,7 @@ public class ItemOreResourceBucket extends Item
public String getItemDisplayName(ItemStack is)
{
String material = getMaterialFromStack(is);
if (material != null)
{
String fluidID = isMolten ? ResourceGenerator.materialNameToMolten(material) : ResourceGenerator.materialNameToMixture(material);

@ -1 +1 @@
Subproject commit 1614b4d84a023bfac276ced7e0654035e8ecd0b3
Subproject commit ba68b2470ce81b56a7f9dd201586ccaba32b9764