Update to new Calclavia-Core, respect creative-mode players for insulating, and use ore dict for dying, no painters yet...
This commit is contained in:
parent
77d73c5f2f
commit
3f4c3cb255
6 changed files with 56 additions and 10 deletions
|
@ -1,10 +1,12 @@
|
||||||
package resonantinduction;
|
package resonantinduction;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import codechicken.lib.vec.BlockCoord;
|
import codechicken.lib.vec.BlockCoord;
|
||||||
import codechicken.multipart.TileMultipart;
|
import codechicken.multipart.TileMultipart;
|
||||||
|
|
||||||
|
@ -33,4 +35,36 @@ public class Utility
|
||||||
return true;
|
return true;
|
||||||
return b.isBlockSolidOnSide(w, x, y, z, side);
|
return b.isBlockSolidOnSide(w, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int isDye(ItemStack is)
|
||||||
|
{
|
||||||
|
String[] dyes =
|
||||||
|
{
|
||||||
|
"dyeBlack",
|
||||||
|
"dyeRed",
|
||||||
|
"dyeGreen",
|
||||||
|
"dyeBrown",
|
||||||
|
"dyeBlue",
|
||||||
|
"dyePurple",
|
||||||
|
"dyeCyan",
|
||||||
|
"dyeLightGray",
|
||||||
|
"dyeGray",
|
||||||
|
"dyePink",
|
||||||
|
"dyeLime",
|
||||||
|
"dyeYellow",
|
||||||
|
"dyeLightBlue",
|
||||||
|
"dyeMagenta",
|
||||||
|
"dyeOrange",
|
||||||
|
"dyeWhite"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < dyes.length; i++)
|
||||||
|
{
|
||||||
|
if (OreDictionary.getOreID(is) != -1 && OreDictionary.getOreName(OreDictionary.getOreID(is)).equals(dyes[i]))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class TileBattery extends TileAdvanced implements IPacketSender, IPacketR
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player)
|
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
{
|
{
|
||||||
structure.isMultiblock = data.readBoolean();
|
structure.isMultiblock = data.readBoolean();
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInt
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player)
|
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -504,7 +504,7 @@ public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player)
|
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
{
|
{
|
||||||
suck = data.readBoolean();
|
suck = data.readBoolean();
|
||||||
dyeID = data.readInt();
|
dyeID = data.readInt();
|
||||||
|
|
|
@ -325,7 +325,7 @@ public class TileTesla extends TileElectrical implements ITesla, IPacketSender,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player)
|
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.item.ItemShears;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import resonantinduction.Utility;
|
||||||
import resonantinduction.wire.EnumWireMaterial;
|
import resonantinduction.wire.EnumWireMaterial;
|
||||||
import universalelectricity.api.CompatibilityModule;
|
import universalelectricity.api.CompatibilityModule;
|
||||||
import universalelectricity.api.UniversalElectricity;
|
import universalelectricity.api.UniversalElectricity;
|
||||||
|
@ -179,16 +180,23 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
{
|
{
|
||||||
if (itemStack != null)
|
if (itemStack != null)
|
||||||
{
|
{
|
||||||
if (itemStack.itemID == Item.dyePowder.itemID && this.isInsulated())
|
int dyeColor = Utility.isDye(itemStack);
|
||||||
|
|
||||||
|
if (dyeColor != -1 && this.isInsulated())
|
||||||
{
|
{
|
||||||
this.setColor(itemStack.getItemDamage());
|
if (!player.capabilities.isCreativeMode)
|
||||||
|
{
|
||||||
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setColor(dyeColor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (itemStack.itemID == Block.cloth.blockID)
|
else if (itemStack.itemID == Block.cloth.blockID)
|
||||||
{
|
{
|
||||||
if (this.isInsulated())
|
if (this.isInsulated())
|
||||||
{
|
{
|
||||||
if (!world().isRemote)
|
if (!world().isRemote && player.capabilities.isCreativeMode)
|
||||||
{
|
{
|
||||||
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
|
tile().dropItems(Collections.singletonList(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(color))));
|
||||||
}
|
}
|
||||||
|
@ -198,12 +206,16 @@ public abstract class PartAdvancedWire extends PartConductor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.setInsulated(BlockColored.getDyeFromBlock(itemStack.getItemDamage()));
|
if (!player.capabilities.isCreativeMode)
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
{
|
||||||
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setInsulated(BlockColored.getDyeFromBlock(itemStack.getItemDamage()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((itemStack.itemID == Item.shears.itemID || itemStack.getItem() instanceof ItemShears) && isInsulated())
|
else if (itemStack.getItem() instanceof ItemShears && isInsulated())
|
||||||
{
|
{
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue