<400 errors

This commit is contained in:
aidancbrady committed 2016-05-25 10:10:47 -04:00
1 parent af008b9395
commit c73eef6be8
90 files changed
+880 -749

No files matched your search

+3 -4
View File
@@ -1,8 +1,7 @@
package mekanism.api;
import net.minecraft.util.IStringSerializable;
import com.sun.imageio.plugins.common.I18N;
import net.minecraft.util.text.translation.I18n;
/**
* Simple color enum for adding colors to in-game GUI strings of text.
@@ -60,12 +59,12 @@ public enum EnumColor implements IStringSerializable
*/
public String getLocalizedName()
{
return I18N.getString("color." + unlocalizedName);
return I18n.translateToLocal("color." + unlocalizedName);
}
public String getDyeName()
{
return I18N.getString("dye." + unlocalizedName);
return I18n.translateToLocal("dye." + unlocalizedName);
}
public String getOreDictName()
+2 -1
View File
@@ -1,9 +1,10 @@
package mekanism.api;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
public interface IMekWrench
{
public boolean canUseWrench(EntityPlayer player, BlockPos pos);
public boolean canUseWrench(ItemStack stack, EntityPlayer player, BlockPos pos);
}
+2 -3
View File
@@ -6,11 +6,10 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import com.sun.imageio.plugins.common.I18N;
/**
* Gas - a class used to set specific properties of gasses when used or seen in-game.
* @author aidancbrady
@@ -98,7 +97,7 @@ public class Gas
*/
public String getLocalizedName()
{
return I18N.getString(getUnlocalizedName());
return I18n.translateToLocal(getUnlocalizedName());
}
/**
+2 -2
View File
@@ -1,6 +1,6 @@
package mekanism.api.gas;
import com.sun.imageio.plugins.common.I18N;
import net.minecraft.util.text.translation.I18n;
public class OreGas extends Gas
@@ -34,6 +34,6 @@ public class OreGas extends Gas
public String getOreName()
{
return I18N.getString(oreName);
return I18n.translateToLocal(oreName);
}
}
@@ -2,8 +2,7 @@ package mekanism.api.infuse;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import com.sun.imageio.plugins.common.I18N;
import net.minecraft.util.text.translation.I18n;
/**
* The types of infuse currently available in Mekanism.
@@ -44,6 +43,6 @@ public final class InfuseType
public String getLocalizedName()
{
return I18N.getString(unlocalizedName);
return I18n.translateToLocal(unlocalizedName);
}
}
@@ -2,8 +2,7 @@ package mekanism.api.transmitters;
import mekanism.api.gas.IGasTransmitter;
import net.minecraft.tileentity.TileEntity;
import com.sun.imageio.plugins.common.I18N;
import net.minecraft.util.text.translation.I18n;
public enum TransmissionType
{
@@ -34,7 +33,7 @@ public enum TransmissionType
public String localize()
{
return I18N.getString("transmission." + getTransmission());
return I18n.translateToLocal("transmission." + getTransmission());
}
public static boolean checkTransmissionType(ITransmitter sideTile, TransmissionType type)
@@ -18,7 +18,7 @@ public class ClientConnectionHandler
{
if(general.voiceServerEnabled)
{
if(event.isLocal)
if(event.isLocal())
{
//If the client is connecting to its own corresponding integrated server.
try {
@@ -32,7 +32,7 @@ public class ClientConnectionHandler
else {
//If the client is connecting to a foreign integrated or dedicated server.
try {
MekanismClient.voiceClient = new VoiceClient(((InetSocketAddress)event.manager/*TODO is this right?*/.getRemoteAddress()).getHostString());
MekanismClient.voiceClient = new VoiceClient(((InetSocketAddress)event.getManager().getRemoteAddress()).getHostString());
} catch(Throwable e) {
Mekanism.logger.error("Unable to establish VoiceClient on remote connection.");
e.printStackTrace();
@@ -206,6 +206,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.model.ModelLoader;
@@ -637,7 +638,7 @@ public class ClientProxy extends CommonProxy
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.BasicBlock), basicMesher);
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), basicMesher);
OBJLoader.instance.addDomain("mekanism");
OBJLoader.INSTANCE.addDomain("mekanism");
}
public void registerItemRender(Item item)
@@ -857,11 +858,11 @@ public class ClientProxy extends CommonProxy
for(String s : CUSTOM_RENDERS)
{
ModelResourceLocation model = new ModelResourceLocation("mekanism:" + s, "inventory");
Object obj = event.modelRegistry.getObject(model);
Object obj = event.getModelRegistry().getObject(model);
if(obj instanceof IBakedModel)
{
event.modelRegistry.putObject(model, new CustomItemModelFactory((IBakedModel)obj));
event.getModelRegistry().putObject(model, new CustomItemModelFactory((IBakedModel)obj));
}
}
}
@@ -27,6 +27,7 @@ import mekanism.common.util.LangUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentString;
@@ -129,7 +130,7 @@ public class MekanismKeyHandler extends MekKeyHandler
else if(kb == armorModeSwitchKey)
{
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
ItemStack chestStack = player.getCurrentArmor(2);
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
Item chestItem = StackUtils.getItem(chestStack);
if(chestItem instanceof ItemJetpack)
@@ -3,7 +3,9 @@ package mekanism.client.entity;
import mekanism.api.Pos3D;
import mekanism.client.render.MekanismRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumFacing;
@@ -15,7 +17,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class EntityLaser extends EntityFX
public class EntityLaser extends Particle
{
double length;
EnumFacing direction;
@@ -34,7 +36,7 @@ public class EntityLaser extends EntityFX
}
@Override
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
{
worldRendererIn.finishDrawing();
@@ -15,6 +15,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@@ -238,7 +239,7 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
}
}
public void handleMouse(Slot slot, int slotIndex, int button, int modifier)
public void handleMouse(Slot slot, int slotIndex, int button, ClickType modifier)
{
handleMouseClick(slot, slotIndex, button, modifier);
}
@@ -17,9 +17,12 @@ import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerRepair;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.CPacketCustomPayload;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -28,7 +31,7 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiRobitRepair extends GuiMekanism implements ICrafting
public class GuiRobitRepair extends GuiMekanism implements IContainerListener
{
public int entityId;
private ContainerRepair repairContainer;
@@ -58,8 +61,8 @@ public class GuiRobitRepair extends GuiMekanism implements ICrafting
itemNameField.setDisabledTextColour(-1);
itemNameField.setEnableBackgroundDrawing(false);
itemNameField.setMaxStringLength(30);
inventorySlots.removeCraftingFromCrafters(this);
inventorySlots.onCraftGuiOpened(this);
inventorySlots.removeListener(this);
inventorySlots.addListener(this);
}
@Override
@@ -67,7 +70,7 @@ public class GuiRobitRepair extends GuiMekanism implements ICrafting
{
super.onGuiClosed();
Keyboard.enableRepeatEvents(false);
inventorySlots.removeCraftingFromCrafters(this);
inventorySlots.removeListener(this);
}
@Override
@@ -80,7 +83,7 @@ public class GuiRobitRepair extends GuiMekanism implements ICrafting
{
int k = 8453920;
boolean flag = true;
String s = StatCollector.translateToLocalFormatted("container.repair.cost", repairContainer.maximumCost);
String s = I18n.translateToLocalFormatted("container.repair.cost", repairContainer.maximumCost);
if(repairContainer.maximumCost >= 40 && !mc.thePlayer.capabilities.isCreativeMode)
{
@@ -128,7 +131,7 @@ public class GuiRobitRepair extends GuiMekanism implements ICrafting
if(itemNameField.textboxKeyTyped(c, i))
{
repairContainer.updateItemName(itemNameField.getText());
mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText())));
mc.thePlayer.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText())));
}
else {
super.keyTyped(c, i);
@@ -266,7 +269,7 @@ public class GuiRobitRepair extends GuiMekanism implements ICrafting
if(itemstack != null)
{
repairContainer.updateItemName(itemNameField.getText());
mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText())));
mc.thePlayer.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText())));
}
}
}
@@ -147,7 +147,7 @@ public class GuiSeismicReader extends GuiScreen
{
renderString = nameStack.getDisplayName();
}
else if(blockList.get(currentLayer - 1).getRight() == Blocks.air)
else if(blockList.get(currentLayer - 1).getRight() == Blocks.AIR)
{
renderString = "Air";
}
@@ -100,12 +100,9 @@ import mekanism.common.recipe.machines.SolarNeutronRecipe;
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
import mekanism.common.recipe.machines.WasherRecipe;
import mekanism.common.util.ItemDataUtils;
import mezz.jei.api.IItemRegistry;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.IRecipeRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
@@ -284,15 +281,6 @@ public class MekanismJEI implements IModPlugin
registry.addRecipes(recipes);
}
@Override
public void onItemRegistryAvailable(IItemRegistry registry) {}
@Override
public void onJeiHelpersAvailable(IJeiHelpers helpers) {}
@Override
public void onRecipeRegistryAvailable(IRecipeRegistry registry) {}
@Override
public void onRuntimeAvailable(IJeiRuntime runtime) {}
}
@@ -26,7 +26,7 @@ public class PurificationChamberRecipeWrapper extends AdvancedMachineRecipeWrapp
{
if(gasType == GasRegistry.getGas("oxygen"))
{
return ListUtils.asList(new ItemStack(Items.flint), MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("oxygen")));
return ListUtils.asList(new ItemStack(Items.FLINT), MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("oxygen")));
}
return new ArrayList<ItemStack>();
@@ -152,7 +152,7 @@ public class MekanismRenderer
ModelResourceLocation loc = new ModelResourceLocation(domain + ":" + metaItem.getTexture(i), "inventory");
ModelLoader.setCustomModelResourceLocation(item, i, loc);
variants.add(loc);
ModelBakery.addVariantName(item, domain + ":" + metaItem.getTexture(i));
ModelBakery.registerItemVariants(item, new ResourceLocation(domain + ":" + metaItem.getTexture(i)));
}
return;
@@ -296,7 +296,7 @@ public class MekanismRenderer
}
}
public static BakedQuad iconTransform(BakedQuad quad, TextureAtlasSprite sprite)
public static BakedQuad iconTransform(BakedQuad quad, TextureAtlasSprite sprite) //TODO
{
int[] vertices = new int[28];
System.arraycopy(quad.getVertexData(), 0, vertices, 0, vertices.length);
@@ -313,10 +313,10 @@ public class MekanismRenderer
vertices[21+4] = Float.floatToRawIntBits(sprite.getInterpolatedU(0));
vertices[21+5] = Float.floatToRawIntBits(sprite.getInterpolatedV(16));
return new BakedQuad(vertices, quad.getTintIndex(), quad.getFace());
return new BakedQuad(vertices, quad.getTintIndex(), quad.getFace(), sprite, quad.shouldApplyDiffuseLighting(), quad.getFormat());
}
public static BakedQuad rotate(BakedQuad quad, int amount)
public static BakedQuad rotate(BakedQuad quad, int amount) //TODO
{
int[] vertices = new int[28];
System.arraycopy(quad.getVertexData(), 0, vertices, 0, vertices.length);
@@ -330,7 +330,7 @@ public class MekanismRenderer
vertices[7*i + 5] = quad.getVertexData()[7*nextIndex + 5];
}
return new BakedQuad(vertices, quad.getTintIndex(), quad.getFace());
return new BakedQuad(vertices, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat());
}
public static void prepFlowing(Model3D model, Fluid fluid)
@@ -13,6 +13,7 @@ import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -218,17 +219,17 @@ public class ModelCustomArmor extends ModelBiped
}
}
public static ModelBiped getGlow(int index)
public static ModelBiped getGlow(EntityEquipmentSlot index)
{
ModelBiped biped = index != 2 ? GLOW_BIG : GLOW_SMALL;
ModelBiped biped = index != EntityEquipmentSlot.LEGS ? GLOW_BIG : GLOW_SMALL;
biped.bipedHead.showModel = index == 0;
biped.bipedHeadwear.showModel = index == 0;
biped.bipedBody.showModel = index == 1 || index == 2;
biped.bipedRightArm.showModel = index == 1;
biped.bipedLeftArm.showModel = index == 1;
biped.bipedRightLeg.showModel = index == 2 || index == 3;
biped.bipedLeftLeg.showModel = index == 2 || index == 3;
biped.bipedHead.showModel = index == EntityEquipmentSlot.HEAD;
biped.bipedHeadwear.showModel = index == EntityEquipmentSlot.HEAD;
biped.bipedBody.showModel = index == EntityEquipmentSlot.CHEST || index == EntityEquipmentSlot.LEGS;
biped.bipedRightArm.showModel = index == EntityEquipmentSlot.CHEST;
biped.bipedLeftArm.showModel = index == EntityEquipmentSlot.CHEST;
biped.bipedRightLeg.showModel = index == EntityEquipmentSlot.LEGS || index == EntityEquipmentSlot.FEET;
biped.bipedLeftLeg.showModel = index == EntityEquipmentSlot.LEGS || index == EntityEquipmentSlot.FEET;
return biped;
}
@@ -6,6 +6,7 @@ import java.util.Map;
import mekanism.client.render.MekanismRenderer.Model3D;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -230,11 +231,12 @@ public class RenderResizableCuboid {
if (shadeTypes.isEnabled(EnumShadeType.AMBIENT_OCCLUSION)) {
applyLocalAO(wr, faceFormula.transformToWorld(face), locationFormula, access, shadeTypes, vertex);
} else if (shadeTypes.isEnabled(EnumShadeType.LIGHT)) {
}
else if (shadeTypes.isEnabled(EnumShadeType.LIGHT)) {
Vec3d transVertex = locationFormula.transformToWorld(vertex);
BlockPos pos = convertFloor(transVertex);
Block block = access.getBlockState(pos).getBlock();
int combindedLight = block.getMixedBrightnessForBlock(access, pos);
IBlockState block = access.getBlockState(pos);
int combindedLight = block.getPackedLightmapCoords(access, pos);
wr.lightmap(combindedLight >> 16 & 65535, combindedLight & 65535);
}
@@ -282,12 +284,13 @@ public class RenderResizableCuboid {
double totalDist = 0;
Vec3d transVertex = locationFormula.transformToWorld(vertex);
BlockPos pos = convertFloor(transVertex);
Block block = access.getBlockState(pos).getBlock();
int combindedLight = block.getMixedBrightnessForBlock(access, pos);
IBlockState state = access.getBlockState(pos);
Block block = state.getBlock();
int combindedLight = state.getPackedLightmapCoords(access, pos);
skyLight[0] = combindedLight / 0x10000;
blockLight[0] = combindedLight % 0x10000;
colorMultiplier[0] = block.getAmbientOcclusionLightValue();
colorMultiplier[0] = state.getAmbientOcclusionLightValue();
distances[0] = transVertex.distanceTo(convertMiddle(pos));
int index = 0;
@@ -295,14 +298,14 @@ public class RenderResizableCuboid {
for (EnumFacing otherFace : testArray) {
Vec3d nearestOther = vertex.add(convert(otherFace));
pos = convertFloor(locationFormula.transformToWorld(nearestOther));
block = access.getBlockState(pos).getBlock();
combindedLight = block.getMixedBrightnessForBlock(access, pos);
state = access.getBlockState(pos);
combindedLight = state.getPackedLightmapCoords(access, pos);
index++;
skyLight[index] = (int) (combindedLight / 0x10000);
blockLight[index] = (int) (combindedLight % 0x10000);
colorMultiplier[index] = block.getAmbientOcclusionLightValue();
colorMultiplier[index] = state.getAmbientOcclusionLightValue();
// The extra 0.1 is to stop any 1 divided by 0 errors
distances[index] = 1 / (transVertex.distanceTo(convertMiddle(pos)) + 0.1);
totalDist += distances[index];
@@ -390,7 +393,7 @@ public class RenderResizableCuboid {
arr[1] = new double[] { ri.xyz[U_MAX], cuboid.posY, ri.xyz[V_MAX], -1, ri.uv[U_MAX], ri.uv[V_MAX], 0 };
arr[2] = new double[] { ri.xyz[U_MIN], cuboid.posY, ri.xyz[V_MAX], -1, ri.uv[U_MIN], ri.uv[V_MAX], 0 };
arr[3] = new double[] { ri.xyz[U_MIN], cuboid.posY, ri.xyz[V_MIN], -1, ri.uv[U_MIN], ri.uv[V_MIN], 0 };
convertToDoubleQuads(quads, arr, EnumFacing.DOWN);
convertToDoubleQuads(quads, arr, EnumFacing.DOWN, sprites[0]);
}
}
@@ -405,7 +408,7 @@ public class RenderResizableCuboid {
arr[1] = new double[] { ri.xyz[U_MAX], sizeY + cuboid.posY, ri.xyz[V_MAX], -1, ri.uv[U_MAX], ri.uv[V_MAX], 0 };
arr[2] = new double[] { ri.xyz[U_MIN], sizeY + cuboid.posY, ri.xyz[V_MAX], -1, ri.uv[U_MIN], ri.uv[V_MAX], 0 };
arr[3] = new double[] { ri.xyz[U_MIN], sizeY + cuboid.posY, ri.xyz[V_MIN], -1, ri.uv[U_MIN], ri.uv[V_MIN], 0 };
convertToDoubleQuads(quads, arr, EnumFacing.UP);
convertToDoubleQuads(quads, arr, EnumFacing.UP, sprites[1]);
}
}
@@ -420,7 +423,7 @@ public class RenderResizableCuboid {
arr[1] = new double[] { ri.xyz[U_MAX], ri.xyz[V_MAX], cuboid.posZ, -1, ri.uv[U_MAX], ri.uv[V_MAX], 0 };
arr[2] = new double[] { ri.xyz[U_MIN], ri.xyz[V_MAX], cuboid.posZ, -1, ri.uv[U_MIN], ri.uv[V_MAX], 0 };
arr[3] = new double[] { ri.xyz[U_MIN], ri.xyz[V_MIN], cuboid.posZ, -1, ri.uv[U_MIN], ri.uv[V_MIN], 0 };
convertToDoubleQuads(quads, arr, EnumFacing.NORTH);
convertToDoubleQuads(quads, arr, EnumFacing.NORTH, sprites[2]);
}
}
@@ -435,7 +438,7 @@ public class RenderResizableCuboid {
arr[1] = new double[] { ri.xyz[U_MAX], ri.xyz[V_MAX], cuboid.posZ + sizeZ, -1, ri.uv[U_MAX], ri.uv[V_MAX], 0 };
arr[2] = new double[] { ri.xyz[U_MIN], ri.xyz[V_MAX], cuboid.posZ + sizeZ, -1, ri.uv[U_MIN], ri.uv[V_MAX], 0 };
arr[3] = new double[] { ri.xyz[U_MIN], ri.xyz[V_MIN], cuboid.posZ + sizeZ, -1, ri.uv[U_MIN], ri.uv[V_MIN], 0 };
convertToDoubleQuads(quads, arr, EnumFacing.SOUTH);
convertToDoubleQuads(quads, arr, EnumFacing.SOUTH, sprites[3]);
}
}
@@ -450,7 +453,7 @@ public class RenderResizableCuboid {
arr[1] = new double[] { cuboid.posX, ri.xyz[V_MAX], ri.xyz[U_MAX], -1, ri.uv[U_MAX], ri.uv[V_MAX], 0 };
arr[2] = new double[] { cuboid.posX, ri.xyz[V_MAX], ri.xyz[U_MIN], -1, ri.uv[U_MIN], ri.uv[V_MAX], 0 };
arr[3] = new double[] { cuboid.posX, ri.xyz[V_MIN], ri.xyz[U_MIN], -1, ri.uv[U_MIN], ri.uv[V_MIN], 0 };
convertToDoubleQuads(quads, arr, EnumFacing.WEST);
convertToDoubleQuads(quads, arr, EnumFacing.WEST, sprites[4]);
}
}
@@ -465,21 +468,21 @@ public class RenderResizableCuboid {
arr[1] = new double[] { cuboid.posX + sizeX, ri.xyz[V_MAX], ri.xyz[U_MAX], -1, ri.uv[U_MAX], ri.uv[V_MAX], 0 };
arr[2] = new double[] { cuboid.posX + sizeX, ri.xyz[V_MAX], ri.xyz[U_MIN], -1, ri.uv[U_MIN], ri.uv[V_MAX], 0 };
arr[3] = new double[] { cuboid.posX + sizeX, ri.xyz[V_MIN], ri.xyz[U_MIN], -1, ri.uv[U_MIN], ri.uv[V_MIN], 0 };
convertToDoubleQuads(quads, arr, EnumFacing.EAST);
convertToDoubleQuads(quads, arr, EnumFacing.EAST, sprites[5]);
}
}
}
private void convertToDoubleQuads(List<BakedQuad> quads, double[][] points, EnumFacing face) {
BakedQuad quad = convertToQuad(points, face);
private void convertToDoubleQuads(List<BakedQuad> quads, double[][] points, EnumFacing face, TextureAtlasSprite sprite) {
BakedQuad quad = convertToQuad(points, face, sprite);
quads.add(quad);
double[][] otherPoints = new double[][] { points[3], points[2], points[1], points[0] };
quad = convertToQuad(otherPoints, face);
quad = convertToQuad(otherPoints, face, sprite);
quads.add(quad);
}
private BakedQuad convertToQuad(double[][] points, EnumFacing face) {
private BakedQuad convertToQuad(double[][] points, EnumFacing face, TextureAtlasSprite sprite) {
int[] list = new int[points.length * points[0].length];
for (int i = 0; i < points.length; i++) {
double[] arr = points[i];
@@ -494,7 +497,7 @@ public class RenderResizableCuboid {
list[i * arr.length + j] = used;
}
}
return new BakedQuad(list, -1, face);
return new BakedQuad(list, -1, face, sprite);
}
/** Returns an array containing [uMin, uMax, vMin, vMax]. start* and end* must be doubles between 0 and 1 */
@@ -564,9 +567,8 @@ public class RenderResizableCuboid {
/** A way to automatically generate the different positions given the same arguments.
*
* @param rotation TODO */
private List<RenderInfo> getRenderInfos(float[] uv, double sizeU, double sizeV, double textureSizeU, double textureSizeV, double textureOffsetU,
double textureOffsetV) {
private List<RenderInfo> getRenderInfos(float[] uv, double sizeU, double sizeV, double textureSizeU, double textureSizeV, double textureOffsetU, double textureOffsetV)
{
List<RenderInfo> infos = Lists.newArrayList();
boolean firstU = true;
for (double u = 0; u < sizeU; u += textureSizeU) {
@@ -19,6 +19,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.particle.Particle;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.RayTraceResult;
@@ -73,9 +74,9 @@ public class RenderTickHandler
}
}
if(player != null && mc.currentScreen == null && player.getEquipmentInSlot(3) != null)
if(player != null && mc.currentScreen == null && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null)
{
ItemStack stack = player.getEquipmentInSlot(3);
ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
ScaledResolution scaledresolution = new ScaledResolution(mc);
@@ -11,20 +11,15 @@ import mekanism.common.block.states.BlockStateBasic;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.Attributes;
import net.minecraftforge.client.model.IFlexibleBakedModel;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.client.model.ISmartBlockModel;
import net.minecraftforge.client.model.ISmartItemModel;
import net.minecraftforge.client.model.TRSRTransformation;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.common.property.IExtendedBlockState;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -60,15 +55,21 @@ public class CTMModelFactory implements ISmartBlockModel, ISmartItemModel, IPers
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing facing)
public List<BakedQuad> getQuads(IBlockState stateIn, EnumFacing side, long rand)
{
return FluentIterable.from(face).filter(quad -> quad.getFace() == facing).toList();
}
@Override
public List<BakedQuad> getGeneralQuads()
{
return general;
CTMModelFactory baked;
if(stateIn.getBlock() instanceof ICTMBlock && stateIn instanceof IExtendedBlockState)
{
IExtendedBlockState state = (IExtendedBlockState)stateIn;
CTMBlockRenderContext ctxList = state.getValue(BlockStateBasic.ctmProperty);
baked = createModel(stateIn, model, ctxList);
}
else {
baked = this;
}
return side == null ? baked.general : FluentIterable.from(baked.face).filter(quad -> quad.getFace() == side).toList();
}
@Override
@@ -101,22 +102,6 @@ public class CTMModelFactory implements ISmartBlockModel, ISmartItemModel, IPers
return ItemCameraTransforms.DEFAULT;
}
// TODO implement model caching, returning a new model every time is a HUGE waste of memory and CPU
@Override
public IBakedModel handleBlockState(IBlockState stateIn)
{
if(stateIn.getBlock() instanceof ICTMBlock && stateIn instanceof IExtendedBlockState)
{
IExtendedBlockState state = (IExtendedBlockState) stateIn;
CTMBlockRenderContext ctxList = state.getValue(BlockStateBasic.ctmProperty);
return createModel(stateIn, model, ctxList);
}
else {
return this;
}
}
@Override
public IBakedModel handleItemState(ItemStack stack)
{
@@ -142,8 +127,8 @@ public class CTMModelFactory implements ISmartBlockModel, ISmartItemModel, IPers
int quadGoal = ctx == null ? 1 : CTM.QUADS_PER_SIDE;
IBakedModel baked = model.getModel(state);
List<BakedQuad> origFaceQuads = baked.getFaceQuads(facing);
List<BakedQuad> origGeneralQuads = FluentIterable.from(baked.getGeneralQuads()).filter(q -> q.getFace() == facing).toList();
List<BakedQuad> origFaceQuads = baked.getQuads(state, facing, 0);
List<BakedQuad> origGeneralQuads = FluentIterable.from(baked.getQuads(state, null, 0)).filter(q -> q.getFace() == facing).toList();
addAllQuads(origFaceQuads, face, ctx, state, quadGoal, faceQuads);
addAllQuads(origGeneralQuads, face, ctx, state, quadGoal, generalQuads);
}
@@ -159,18 +144,12 @@ public class CTMModelFactory implements ISmartBlockModel, ISmartItemModel, IPers
}
}
@Override
public VertexFormat getFormat()
{
return Attributes.DEFAULT_BAKED_FORMAT;
}
private Pair<IPerspectiveAwareModel, Matrix4f> thirdPersonTransform;
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
public Pair<? extends IPerspectiveAwareModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
{
if(cameraTransformType == TransformType.THIRD_PERSON)
if(cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND)
{
if(thirdPersonTransform == null)
{
@@ -37,21 +37,21 @@ public class CTMRegistry
{
for(TextureSpriteCallback callback : textures)
{
callback.stitch(event.map);
callback.stitch(event.getMap());
}
}
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) throws IOException
{
IModel model = event.modelLoader.getModel(baseResource);
IModel model = event.getModelLoader().getModel(baseResource);
baseModel = model.bake(new TRSRTransformation(ModelRotation.X0_Y0), Attributes.DEFAULT_BAKED_FORMAT, r -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(r.toString()));
for(Pair<String, String> pair : ctmTypes)
{
ModelCTM chiselModel = new ModelCTM(baseModel, pair.getRight());
chiselModel.load();
event.modelRegistry.putObject(new ModelResourceLocation(pair.getLeft() + ":" + pair.getRight()), new CTMModelFactory(chiselModel));
event.getModelRegistry().putObject(new ModelResourceLocation(pair.getLeft() + ":" + pair.getRight()), new CTMModelFactory(chiselModel));
}
}
@@ -7,15 +7,14 @@ import java.util.List;
import java.util.Map;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IFlexibleBakedModel;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.IModelState;
import net.minecraftforge.client.model.TRSRTransformation;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
@@ -54,7 +53,7 @@ public class ModelCTM implements IModel
}
@Override
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
return null;
}
@@ -72,6 +72,6 @@ public class RenderObsidianTNTPrimed extends Render<EntityObsidianTNT>
@Override
protected ResourceLocation getEntityTexture(EntityObsidianTNT entity)
{
return TextureMap.locationBlocksTexture;
return TextureMap.LOCATION_BLOCKS_TEXTURE;
}
}
@@ -48,10 +48,12 @@ import mekanism.common.tile.TileEntityFluidTank;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
@@ -60,11 +62,9 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.Attributes;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.fluids.Fluid;
@@ -119,7 +119,7 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
ItemBlockBasic itemBasic = (ItemBlockBasic)stack.getItem();
InventoryBin inv = new InventoryBin(stack);
binRenderer.render(EnumFacing.NORTH, inv.getItemType(), inv.getItemCount(), false, -0.5, -0.5, -0.5);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.enableRescaleNormal();
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
@@ -314,7 +314,7 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
GlStateManager.scale(1.4F, 1.4F, 1.4F);
GlStateManager.rotate(180, 0.0F, 0.0F, 1.0F);
if(type == TransformType.THIRD_PERSON)
if(type == TransformType.THIRD_PERSON_RIGHT_HAND)
{
GlStateManager.rotate(45, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(50, 1.0F, 0.0F, 0.0F);
@@ -347,7 +347,7 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
GlStateManager.rotate(135, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-20, 0.0F, 0.0F, 1.0F);
if(type == TransformType.FIRST_PERSON_RIGHT_HAND || type == TransformType.THIRD_PERSON)
if(type == TransformType.FIRST_PERSON_RIGHT_HAND || type == TransformType.THIRD_PERSON_RIGHT_HAND)
{
if(type == TransformType.FIRST_PERSON_RIGHT_HAND)
{
@@ -373,29 +373,28 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing facing)
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand)
{
List<BakedQuad> faceQuads = new LinkedList<BakedQuad>();
if(Block.getBlockFromItem(stack.getItem()) != null)
if(side != null)
{
MachineType machineType = MachineType.get(stack);
List<BakedQuad> faceQuads = new LinkedList<BakedQuad>();
if(machineType != MachineType.QUANTUM_ENTANGLOPORTER && machineType != MachineType.RESISTIVE_HEATER)
if(Block.getBlockFromItem(stack.getItem()) != null)
{
if(!(stack.getItem() instanceof ItemBlockEnergyCube))
MachineType machineType = MachineType.get(stack);
if(machineType != MachineType.QUANTUM_ENTANGLOPORTER && machineType != MachineType.RESISTIVE_HEATER)
{
faceQuads.addAll(baseModel.getFaceQuads(facing));
if(!(stack.getItem() instanceof ItemBlockEnergyCube))
{
faceQuads.addAll(baseModel.getQuads(state, side, rand));
}
}
}
return faceQuads;
}
return faceQuads;
}
@Override
public List<BakedQuad> getGeneralQuads()
{
Tessellator tessellator = Tessellator.getInstance();
tessellator.draw();
@@ -409,10 +408,10 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
GlStateManager.enableLight(1);
GlStateManager.enableColorMaterial();
GlStateManager.colorMaterial(1032, 5634);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.popMatrix();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
VertexBuffer worldrenderer = tessellator.getBuffer();
worldrenderer.begin(7, DefaultVertexFormats.ITEM);
if(Block.getBlockFromItem(stack.getItem()) != null)
@@ -421,7 +420,7 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
if(machineType != MachineType.DIGITAL_MINER)
{
generalQuads.addAll(baseModel.getGeneralQuads());
generalQuads.addAll(baseModel.getQuads(state, side, rand));
}
}
@@ -459,17 +458,11 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel
}
@Override
public VertexFormat getFormat()
{
return Attributes.DEFAULT_BAKED_FORMAT;
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
public Pair<? extends IPerspectiveAwareModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
{
prevTransform = cameraTransformType;
if(cameraTransformType == TransformType.THIRD_PERSON)
if(cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND)
{
ForgeHooksClient.multiplyCurrentGlMatrix(CTMModelFactory.DEFAULT_BLOCK_THIRD_PERSON_MATRIX);
}
@@ -91,7 +91,7 @@ public class GlowPanelModel extends OBJBakedModelBase implements ISmartMultipart
}
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance);
builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
TextureAtlasSprite missing = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(new ResourceLocation("missingno").toString());
for(String s : getModel().getMatLib().getMaterialNames())
@@ -134,7 +134,7 @@ public class GlowPanelModel extends OBJBakedModelBase implements ISmartMultipart
private Pair<IPerspectiveAwareModel, Matrix4f> thirdPersonTransform;
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
public Pair<? extends IPerspectiveAwareModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
{
if(cameraTransformType == TransformType.GUI)
{
@@ -142,11 +142,11 @@ public class GlowPanelModel extends OBJBakedModelBase implements ISmartMultipart
GlStateManager.rotate(90, 1, 0, 0);
GlStateManager.scale(1.6F, 1.6F, 1.6F);
}
else if(cameraTransformType == TransformType.FIRST_PERSON)
else if(cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND)
{
GlStateManager.translate(0.0F, 0.3F, 0.0F);
}
else if(cameraTransformType == TransformType.THIRD_PERSON)
else if(cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND)
{
GlStateManager.translate(0.0F, -0.1F, 0.0F);
@@ -14,8 +14,10 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.model.ICustomModelLoader;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.ModelLoaderRegistry;
@@ -30,7 +32,7 @@ import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
public class MekanismOBJLoader extends OBJLoader
public class MekanismOBJLoader implements ICustomModelLoader
{
public static final MekanismOBJLoader INSTANCE = new MekanismOBJLoader();
@@ -48,11 +50,11 @@ public class MekanismOBJLoader extends OBJLoader
for(String s : OBJ_RENDERS)
{
ModelResourceLocation model = new ModelResourceLocation("mekanism:" + s, "inventory");
Object obj = event.modelRegistry.getObject(model);
Object obj = event.getModelRegistry().getObject(model);
if(obj instanceof IBakedModel)
{
event.modelRegistry.putObject(model, createBakedObjItemModel((IBakedModel)obj, "mekanism:models/block/" + s + ".obj.mek", new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true), DefaultVertexFormats.ITEM));
event.getModelRegistry().putObject(model, createBakedObjItemModel((IBakedModel)obj, "mekanism:models/block/" + s + ".obj.mek", new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true), DefaultVertexFormats.ITEM));
}
}
}
@@ -69,10 +71,10 @@ public class MekanismOBJLoader extends OBJLoader
};
ResourceLocation modelLocation = new ResourceLocation(name);
OBJModel objModel = (OBJModel)OBJLoader.instance.loadModel(modelLocation);
OBJModel objModel = (OBJModel)OBJLoader.INSTANCE.loadModel(modelLocation);
objModel = (OBJModel)objModel.process(flipData);
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance);
builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
TextureAtlasSprite missing = textureGetter.apply(new ResourceLocation("missingno"));
for(String s : objModel.getMatLib().getMaterialNames())
@@ -104,13 +106,13 @@ public class MekanismOBJLoader extends OBJLoader
}
@Override
public IModel loadModel(ResourceLocation loc) throws IOException
public IModel loadModel(ResourceLocation loc) throws Exception
{
ResourceLocation file = new ResourceLocation(loc.getResourceDomain(), loc.getResourcePath());
if(!modelCache.containsKey(file))
{
IModel model = super.loadModel(file);
IModel model = OBJLoader.INSTANCE.loadModel(file);
if(model instanceof OBJModel)
{
@@ -136,4 +138,10 @@ public class MekanismOBJLoader extends OBJLoader
return mekModel;
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager)
{
modelCache.clear();
}
}
@@ -1,5 +1,6 @@
package mekanism.client.render.obj;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
@@ -24,9 +25,9 @@ public class MekanismOBJModel extends OBJModel
}
@Override
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
IFlexibleBakedModel preBaked = super.bake(state, format, bakedTextureGetter);
IBakedModel preBaked = super.bake(state, format, bakedTextureGetter);
if(modelType == OBJModelType.GLOW_PANEL)
{
@@ -12,6 +12,7 @@ import java.util.Set;
import javax.vecmath.Matrix4f;
import mekanism.client.render.MekanismRenderer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
@@ -33,6 +34,7 @@ import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
@@ -40,7 +42,9 @@ public abstract class OBJBakedModelBase extends OBJBakedModel
{
protected IBakedModel baseModel;
protected TextureAtlasSprite tempSprite = ModelLoader.White.instance;
protected TextureAtlasSprite tempSprite = ModelLoader.White.INSTANCE;
protected VertexFormat vertexFormat;
protected ImmutableMap<String, TextureAtlasSprite> textureMap;
@@ -54,6 +58,7 @@ public abstract class OBJBakedModelBase extends OBJBakedModel
baseModel = base;
transformationMap = transform;
textureMap = textures;
vertexFormat = format;
if(state instanceof OBJState)
{
@@ -62,8 +67,13 @@ public abstract class OBJBakedModelBase extends OBJBakedModel
}
@Override
public List<BakedQuad> getGeneralQuads()
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand)
{
if(side != null)
{
return ImmutableList.of();
}
if(bakedQuads == null)
{
bakedQuads = Collections.synchronizedSet(new LinkedHashSet<BakedQuad>());
@@ -125,7 +135,7 @@ public abstract class OBJBakedModelBase extends OBJBakedModel
}
}
tempSprite = ModelLoader.White.instance;
tempSprite = ModelLoader.White.INSTANCE;
}
else {
tempSprite = textureMap.get(f.getMaterialName());
@@ -139,18 +149,19 @@ public abstract class OBJBakedModelBase extends OBJBakedModel
}
EnumFacing facing = EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z);
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(getFormat());
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(vertexFormat);
builder.setContractUVs(true);
builder.setQuadOrientation(facing);
builder.setQuadColored();
builder.setTexture(tempSprite);
builder.setQuadTint(0);
Normal faceNormal = f.getNormal();
boolean rotate = shouldRotate(f, groupName);
putVertexData(builder, f.getVertices()[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], tempSprite, getFormat(), color);
putVertexData(builder, f.getVertices()[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], tempSprite, getFormat(), color);
putVertexData(builder, f.getVertices()[2], faceNormal, TextureCoordinate.getDefaultUVs()[2], tempSprite, getFormat(), color);
putVertexData(builder, f.getVertices()[3], faceNormal, TextureCoordinate.getDefaultUVs()[3], tempSprite, getFormat(), color);
putVertexData(builder, f.getVertices()[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], tempSprite, vertexFormat, color);
putVertexData(builder, f.getVertices()[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], tempSprite, vertexFormat, color);
putVertexData(builder, f.getVertices()[2], faceNormal, TextureCoordinate.getDefaultUVs()[2], tempSprite, vertexFormat, color);
putVertexData(builder, f.getVertices()[3], faceNormal, TextureCoordinate.getDefaultUVs()[3], tempSprite, vertexFormat, color);
BakedQuad quad = builder.build();
@@ -66,7 +66,7 @@ public class TransmitterModel extends OBJBakedModelBase implements ISmartMultipa
color = extended.getValue(ColorProperty.INSTANCE).color.ordinal();
}
OBJState obj = extended.getValue(OBJProperty.instance);
OBJState obj = extended.getValue(OBJProperty.INSTANCE);
if(layer != BlockRenderLayer.TRANSLUCENT)
{
@@ -17,8 +17,6 @@ public class EntityJetpackFlameFX extends ParticleFlame
public EntityJetpackFlameFX(World world, double posX, double posY, double posZ, double velX, double velY, double velZ)
{
super(world, posX, posY, posZ, velX, velY, velZ);
noClip = false;
}
@Override
@@ -17,8 +17,6 @@ public class EntityJetpackSmokeFX extends ParticleSmokeNormal
public EntityJetpackSmokeFX(World world, double posX, double posY, double posZ, double velX, double velY, double velZ)
{
super(world, posX, posY, posZ, velX, velY, velZ, 1.0F);
noClip = false;
}
@Override
@@ -20,6 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -108,7 +109,7 @@ public class RenderConfigurableMachine<S extends TileEntity & ISideConfiguration
}
Model3D toReturn = new Model3D();
toReturn.baseBlock = Blocks.stone;
toReturn.baseBlock = Blocks.STONE;
toReturn.setTexture(MekanismRenderer.overlays.get(type));
DisplayInteger display = DisplayInteger.createAndStart();
@@ -79,7 +79,7 @@ public class RenderTeleporter extends TileEntitySpecialRenderer<TileEntityTelepo
}
Model3D toReturn = new Model3D();
toReturn.baseBlock = Blocks.stone;
toReturn.baseBlock = Blocks.STONE;
toReturn.setTexture(GasRegistry.getGas("oxygen").getSprite());
DisplayInteger display = DisplayInteger.createAndStart();
@@ -24,6 +24,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@@ -147,7 +148,7 @@ public class RenderLogisticalTransporter extends RenderTransmitterBase<PartLogis
}
Model3D toReturn = new Model3D();
toReturn.baseBlock = Blocks.stone;
toReturn.baseBlock = Blocks.STONE;
toReturn.setTexture(icon);
DisplayInteger display = DisplayInteger.createAndStart();
@@ -10,8 +10,11 @@ import mekanism.common.multipart.PartTransmitter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.Attributes;
@@ -27,7 +30,7 @@ import com.google.common.collect.ImmutableList;
public abstract class RenderTransmitterBase<T extends PartTransmitter> extends MultipartSpecialRenderer<T>
{
private static OBJModel contentsModel;
private static Map<String, IFlexibleBakedModel> contentsMap = new HashMap<String, IFlexibleBakedModel>();
private static Map<String, IBakedModel> contentsMap = new HashMap<String, IBakedModel>();
protected Minecraft mc = Minecraft.getMinecraft();
@@ -36,7 +39,7 @@ public abstract class RenderTransmitterBase<T extends PartTransmitter> extends M
if(contentsModel == null)
{
try {
contentsModel = (OBJModel)OBJLoader.instance.loadModel(MekanismUtils.getResource(ResourceType.MODEL, "transmitter_contents.obj"));
contentsModel = (OBJModel)OBJLoader.INSTANCE.loadModel(MekanismUtils.getResource(ResourceType.MODEL, "transmitter_contents.obj"));
contentsMap = buildModelMap(contentsModel);
} catch(Exception e) {
e.printStackTrace();
@@ -62,24 +65,33 @@ public abstract class RenderTransmitterBase<T extends PartTransmitter> extends M
public static boolean isDrawing = false;
public void renderTransparency(WorldRenderer renderer, TextureAtlasSprite icon, IFlexibleBakedModel cc, ColourRGBA color)
public void renderTransparency(VertexBuffer renderer, TextureAtlasSprite icon, IBakedModel cc, ColourRGBA color)
{
if(!isDrawing)
{
renderer.begin(GL11.GL_QUADS, cc.getFormat());
renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
isDrawing = true;
}
for(BakedQuad quad : cc.getGeneralQuads())
for(EnumFacing side : EnumFacing.values())
{
for(BakedQuad quad : cc.getQuads(null, side, 0))
{
quad = MekanismRenderer.iconTransform(quad, icon);
LightUtil.renderQuadColor(renderer, quad, color.argb());
}
}
for(BakedQuad quad : cc.getQuads(null, null, 0))
{
quad = MekanismRenderer.iconTransform(quad, icon);
LightUtil.renderQuadColor(renderer, quad, color.argb());
}
}
public static HashMap<String, IFlexibleBakedModel> buildModelMap(OBJModel objModel)
public static HashMap<String, IBakedModel> buildModelMap(OBJModel objModel)
{
HashMap<String, IFlexibleBakedModel> modelParts = new HashMap<String, IFlexibleBakedModel>();
HashMap<String, IBakedModel> modelParts = new HashMap<String, IBakedModel>();
if(!objModel.getMatLib().getGroups().keySet().isEmpty())
{
@@ -97,7 +109,7 @@ public abstract class RenderTransmitterBase<T extends PartTransmitter> extends M
return modelParts;
}
public IFlexibleBakedModel getModelForSide(PartTransmitter part, EnumFacing side)
public IBakedModel getModelForSide(PartTransmitter part, EnumFacing side)
{
String sideName = side.name().toLowerCase();
String typeName = part.getConnectionType(side).name().toUpperCase();
@@ -21,9 +21,9 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
public class CommandMekanism extends CommandBase
{
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender)
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
{
return MinecraftServer.getServer().isSinglePlayer() || super.canCommandSenderUseCommand(sender);
return server.isSinglePlayer() || super.checkPermission(server, sender);
}
@Override
@@ -45,7 +45,7 @@ public class CommandMekanism extends CommandBase
}
@Override
public void processCommand(ICommandSender sender, String[] params)
public void execute(MinecraftServer server, ICommandSender sender, String[] params)
{
if(params.length < 1)
{
@@ -206,8 +206,8 @@ public class CommandMekanism extends CommandBase
if(Mekanism.gameProfile != null)
{
minecraftserver.getConfigurationManager().addOp(Mekanism.gameProfile);
notifyOperators(sender, this, "commands.op.success", new Object[] {"[Mekanism]"});
minecraftserver.getPlayerList().addOp(Mekanism.gameProfile);
notifyCommandListener(sender, this, "commands.op.success", new Object[] {"[Mekanism]"});
}
}
else if(params[0].equalsIgnoreCase("deop"))
@@ -216,8 +216,8 @@ public class CommandMekanism extends CommandBase
if(Mekanism.gameProfile != null)
{
minecraftserver.getConfigurationManager().removeOp(Mekanism.gameProfile);
notifyOperators(sender, this, "commands.deop.success", new Object[] {"[Mekanism]"});
minecraftserver.getPlayerList().removeOp(Mekanism.gameProfile);
notifyCommandListener(sender, this, "commands.deop.success", new Object[] {"[Mekanism]"});
}
}
else {
@@ -13,6 +13,7 @@ import mekanism.common.item.ItemScubaTank;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.potion.PotionEffect;
@@ -37,7 +38,9 @@ public class CommonPlayerTickHandler
public void tickEnd(EntityPlayer player)
{
if(player.getEquipmentInSlot(1) != null && player.getEquipmentInSlot(1).getItem() instanceof ItemFreeRunners)
ItemStack feetStack = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
if(feetStack != null && feetStack.getItem() instanceof ItemFreeRunners)
{
player.stepHeight = 1.002F;
}
@@ -60,13 +63,14 @@ public class CommonPlayerTickHandler
if(isJetpackOn(player))
{
ItemJetpack jetpack = (ItemJetpack)player.getEquipmentInSlot(3).getItem();
ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
ItemJetpack jetpack = (ItemJetpack)stack.getItem();
if(jetpack.getMode(player.getEquipmentInSlot(3)) == JetpackMode.NORMAL)
if(jetpack.getMode(stack) == JetpackMode.NORMAL)
{
player.motionY = Math.min(player.motionY + 0.15D, 0.5D);
}
else if(jetpack.getMode(player.getEquipmentInSlot(3)) == JetpackMode.HOVER)
else if(jetpack.getMode(stack) == JetpackMode.HOVER)
{
if((!Mekanism.keyMap.has(player, KeySync.ASCEND) && !Mekanism.keyMap.has(player, KeySync.DESCEND)) || (Mekanism.keyMap.has(player, KeySync.ASCEND) && Mekanism.keyMap.has(player, KeySync.DESCEND)))
{
@@ -101,20 +105,21 @@ public class CommonPlayerTickHandler
if(player instanceof EntityPlayerMP)
{
ReflectionUtils.setPrivateValue(((EntityPlayerMP)player).playerNetServerHandler, 0, NetHandlerPlayServer.class, ObfuscatedNames.NetHandlerPlayServer_floatingTickCount);
ReflectionUtils.setPrivateValue(((EntityPlayerMP)player).connection, 0, NetHandlerPlayServer.class, ObfuscatedNames.NetHandlerPlayServer_floatingTickCount);
}
jetpack.useGas(player.getEquipmentInSlot(3));
jetpack.useGas(stack);
}
if(isGasMaskOn(player))
{
ItemScubaTank tank = (ItemScubaTank)player.getEquipmentInSlot(3).getItem();
ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
ItemScubaTank tank = (ItemScubaTank)stack.getItem();
final int max = 300;
tank.useGas(player.getEquipmentInSlot(3));
GasStack received = tank.useGas(player.getEquipmentInSlot(3), max-player.getAir());
tank.useGas(stack);
GasStack received = tank.useGas(stack, max-player.getAir());
if(received != null)
{
@@ -145,7 +150,7 @@ public class CommonPlayerTickHandler
BlockPos pos = new BlockPos(x, y, z);
IBlockState s = player.worldObj.getBlockState(pos);
AxisAlignedBB box = s.getBlock().getCollisionBoundingBox(player.worldObj, pos, s);
AxisAlignedBB box = s.getCollisionBoundingBox(player.worldObj, pos);
AxisAlignedBB playerBox = player.getCollisionBoundingBox().offset(0, -0.01, 0);
return box != null && playerBox.intersectsWith(box);
@@ -216,7 +216,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
if(!world.isRemote)
{
@@ -325,9 +325,8 @@ public abstract class BlockBasic extends Block implements ICTMBlock
}
@Override
public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, SpawnPlacementType type)
public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, SpawnPlacementType type)
{
IBlockState state = world.getBlockState(pos);
int meta = state.getBlock().getMetaFromState(state);
switch(getBasicBlock())
@@ -358,7 +357,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
}
}
default:
return super.canCreatureSpawn(world, pos, type);
return super.canCreatureSpawn(state, world, pos, type);
}
case BASIC_BLOCK_2:
switch(meta)
@@ -558,9 +557,9 @@ public abstract class BlockBasic extends Block implements ICTMBlock
}
@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
return BasicBlockType.get(world.getBlockState(pos)) != BasicBlockType.STRUCTURAL_GLASS;
return BasicBlockType.get(state) != BasicBlockType.STRUCTURAL_GLASS;
}
@SideOnly(Side.CLIENT)
@@ -853,9 +852,8 @@ public abstract class BlockBasic extends Block implements ICTMBlock
}
@Override
public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
IBlockState state = world.getBlockState(pos);
BasicBlockType type = BasicBlockType.get(state);
ItemStack ret = new ItemStack(this, 1, state.getBlock().getMetaFromState(state));
@@ -901,7 +899,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
{
@@ -910,7 +908,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player));
world.spawnEntityInWorld(entityItem);
}
@@ -918,9 +916,9 @@ public abstract class BlockBasic extends Block implements ICTMBlock
return world.setBlockToAir(pos);
}
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
public ItemStack dismantleBlock(IBlockState state, World world, BlockPos pos, boolean returnBlock)
{
ItemStack itemStack = getPickBlock(null, world, pos, null);
ItemStack itemStack = getPickBlock(state, null, world, pos, null);
world.setBlockToAir(pos);
@@ -13,7 +13,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@@ -37,7 +39,7 @@ public class BlockBounding extends Block
{
boolean isAdvanced = meta > 0;
return this.getDefaultState().withProperty(BlockStateBounding.advancedProperty, isAdvanced);
return getDefaultState().withProperty(BlockStateBounding.advancedProperty, isAdvanced);
}
@Override
@@ -48,12 +50,12 @@ public class BlockBounding extends Block
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ)
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ)
{
try {
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
return state1.getBlock().onBlockActivated(world, tileEntity.mainPos, state1, entityplayer, side, hitX, hitY, hitZ);
return state1.getBlock().onBlockActivated(world, tileEntity.mainPos, state1, player, hand, stack, side, hitX, hitY, hitZ);
} catch(Exception e) {
return false;
}
@@ -68,48 +70,49 @@ public class BlockBounding extends Block
}
@Override
public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
try {
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
return state1.getBlock().getPickBlock(target, world, tileEntity.mainPos, player);
return state1.getBlock().getPickBlock(state1, target, world, tileEntity.mainPos, player);
} catch(Exception e) {
return null;
}
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
try {
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
return state1.getBlock().removedByPlayer(world, tileEntity.mainPos, player, willHarvest);
return state1.getBlock().removedByPlayer(state1, world, tileEntity.mainPos, player, willHarvest);
} catch(Exception e) {
return false;
}
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
try {
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
tileEntity.onNeighborChange(state.getBlock());
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
state1.getBlock().onNeighborBlockChange(world, tileEntity.mainPos, state1, this);
state1.getBlock().neighborChanged(state1, world, tileEntity.mainPos, this);
} catch(Exception e) {}
}
@Override
public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, BlockPos pos)
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World world, BlockPos pos)
{
try {
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos);
return world.getBlockState(tileEntity.mainPos).getBlock().getPlayerRelativeBlockHardness(player, world, tileEntity.mainPos);
IBlockState state1 = world.getBlockState(tileEntity.mainPos);
return state1.getBlock().getPlayerRelativeBlockHardness(state1, player, world, tileEntity.mainPos);
} catch(Exception e) {
return super.getPlayerRelativeBlockHardness(player, world, pos);
return super.getPlayerRelativeBlockHardness(state, player, world, pos);
}
}
@@ -126,19 +129,19 @@ public class BlockBounding extends Block
}
@Override
public int getRenderType()
public EnumBlockRenderType getRenderType(IBlockState state)
{
return -1;
return EnumBlockRenderType.INVISIBLE;
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullCube()
public boolean isFullCube(IBlockState state)
{
return false;
}
@@ -20,9 +20,11 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockCardboardBox extends BlockContainer
@@ -56,7 +58,7 @@ public class BlockCardboardBox extends BlockContainer
}
@Override
public boolean isReplaceable(World world, BlockPos pos)
public boolean isReplaceable(IBlockAccess world, BlockPos pos)
{
return testingPlace;
}
@@ -117,9 +119,9 @@ public class BlockCardboardBox extends BlockContainer
}
@Override
public int getRenderType()
public EnumBlockRenderType getRenderType(IBlockState state)
{
return 3;
return EnumBlockRenderType.MODEL;
}
@Override
@@ -128,9 +130,9 @@ public class BlockCardboardBox extends BlockContainer
return new TileEntityCardboardBox();
}
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
public ItemStack dismantleBlock(IBlockState state, World world, BlockPos pos, boolean returnBlock)
{
ItemStack itemStack = getPickBlock(null, world, pos, null);
ItemStack itemStack = getPickBlock(state, null, world, pos, null);
world.setBlockToAir(pos);
@@ -150,10 +152,9 @@ public class BlockCardboardBox extends BlockContainer
}
@Override
public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
ItemStack itemStack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
@@ -169,7 +170,7 @@ public class BlockCardboardBox extends BlockContainer
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
{
@@ -178,7 +179,7 @@ public class BlockCardboardBox extends BlockContainer
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player));
world.spawnEntityInWorld(entityItem);
}
@@ -31,6 +31,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@@ -103,7 +104,7 @@ public class BlockEnergyCube extends BlockContainer
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
if(!world.isRemote)
{
@@ -175,11 +176,11 @@ public class BlockEnergyCube extends BlockContainer
}
@Override
public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, BlockPos pos)
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World world, BlockPos pos)
{
TileEntity tile = world.getTileEntity(pos);
return SecurityUtils.canAccess(player, tile) ? super.getPlayerRelativeBlockHardness(player, world, pos) : 0.0F;
return SecurityUtils.canAccess(player, tile) ? super.getPlayerRelativeBlockHardness(state, player, world, pos) : 0.0F;
}
@Override
@@ -245,7 +246,7 @@ public class BlockEnergyCube extends BlockContainer
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
{
@@ -254,7 +255,7 @@ public class BlockEnergyCube extends BlockContainer
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(null, world, pos, player));
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player));
world.spawnEntityInWorld(entityItem);
}
@@ -268,19 +269,19 @@ public class BlockEnergyCube extends BlockContainer
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public int getRenderType()
public EnumBlockRenderType getRenderType(IBlockState state)
{
return 3;
return EnumBlockRenderType.MODEL;
}
@Override
public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos);
ItemStack itemStack = new ItemStack(MekanismBlocks.EnergyCube);
@@ -313,9 +314,9 @@ public class BlockEnergyCube extends BlockContainer
return itemStack;
}
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
public ItemStack dismantleBlock(IBlockState state, World world, BlockPos pos, boolean returnBlock)
{
ItemStack itemStack = getPickBlock(null, world, pos, null);
ItemStack itemStack = getPickBlock(state, null, world, pos, null);
world.setBlockToAir(pos);
@@ -335,20 +336,20 @@ public class BlockEnergyCube extends BlockContainer
}
@Override
public boolean hasComparatorInputOverride()
public boolean hasComparatorInputOverride(IBlockState state)
{
return true;
}
@Override
public int getComparatorInputOverride(World world, BlockPos pos)
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos)
{
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos);
return tileEntity.getRedstoneLevel();
}
@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
return true;
}
@@ -27,6 +27,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@@ -108,7 +109,7 @@ public class BlockGasTank extends BlockContainer
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
if(!world.isRemote)
{
@@ -122,11 +123,11 @@ public class BlockGasTank extends BlockContainer
}
@Override
public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, BlockPos pos)
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World world, BlockPos pos)
{
TileEntity tile = world.getTileEntity(pos);
return SecurityUtils.canAccess(player, tile) ? super.getPlayerRelativeBlockHardness(player, world, pos) : 0.0F;
return SecurityUtils.canAccess(player, tile) ? super.getPlayerRelativeBlockHardness(state, player, world, pos) : 0.0F;
}
@Override
@@ -192,7 +193,7 @@ public class BlockGasTank extends BlockContainer
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
{
@@ -243,15 +244,15 @@ public class BlockGasTank extends BlockContainer
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public int getRenderType()
public EnumBlockRenderType getRenderType(IBlockState state)
{
return 3;
return EnumBlockRenderType.MODEL;
}
@Override
@@ -261,7 +262,7 @@ public class BlockGasTank extends BlockContainer
}
@Override
public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos);
ItemStack itemStack = new ItemStack(MekanismBlocks.GasTank);
@@ -321,7 +321,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random random)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
@@ -368,7 +368,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public int getLightValue(IBlockAccess world, BlockPos pos)
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(client.enableAmbientLighting)
{
@@ -627,7 +627,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@@ -673,7 +673,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest)
{
@@ -803,7 +803,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
if(!world.isRemote)
{
@@ -836,10 +836,9 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
ItemStack itemStack = new ItemStack(this, 1, state.getBlock().getMetaFromState(state));
if(itemStack.getTagCompound() == null)
@@ -940,9 +939,8 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
IBlockState state = world.getBlockState(pos);
MachineType type = MachineType.get(getMachineBlock(), state.getBlock().getMetaFromState(state));
switch(type)
@@ -954,9 +952,9 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
}
public ItemStack dismantleBlock(World world, BlockPos pos, boolean returnBlock)
public ItemStack dismantleBlock(IBlockState state, World world, BlockPos pos, boolean returnBlock)
{
ItemStack itemStack = getPickBlock(null, world, pos, null);
ItemStack itemStack = getPickBlock(state, null, world, pos, null);
world.setBlockToAir(pos);
@@ -996,13 +994,13 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public boolean isFullCube()
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state)
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
{
setBlockBoundsBasedOnState(world, pos);
@@ -1011,13 +1009,12 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
return null;
}
return super.getCollisionBoundingBox(world, pos, state);
return super.getCollisionBoundingBox(state, world, pos);
}
@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
IBlockState state = world.getBlockState(pos);
MachineType type = MachineType.get(getMachineBlock(), state.getBlock().getMetaFromState(state));
switch(type)
@@ -1092,7 +1089,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
}
@Override
public int getWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side)
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
TileEntity tile = world.getTileEntity(pos);
@@ -18,7 +18,7 @@ public class BlockObsidianTNT extends Block
{
public BlockObsidianTNT()
{
super(Material.tnt);
super(Material.TNT);
setCreativeTab(Mekanism.tabMekanism);
}
@@ -43,7 +43,7 @@ public class BlockObsidianTNT extends Block
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
if(world.isBlockIndirectlyGettingPowered(pos) > 0)
{
@@ -76,7 +76,7 @@ public class BlockObsidianTNT extends Block
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel)
if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().getItem() == Items.FLINT_AND_STEEL)
{
explode(world, pos);
world.setBlockToAir(pos);
@@ -94,13 +94,13 @@ public class BlockObsidianTNT extends Block
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, Entity entity)
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
if(entity instanceof EntityArrow && !world.isRemote)
{
@@ -61,7 +61,7 @@ public class BlockPlastic extends Block
}
@Override
public Vec3d modifyAcceleration(World world, BlockPos pos, Entity e, Vec3 motion)
public Vec3d modifyAcceleration(World world, BlockPos pos, Entity e, Vec3d motion)
{
if(type == PlasticBlockType.ROAD)
{
@@ -27,7 +27,7 @@ public class BlockPlasticFence extends BlockFence
{
public BlockPlasticFence()
{
super(Material.CLAY);
super(Material.CLAY, Material.CLAY.getMaterialMapColor());
setCreativeTab(Mekanism.tabMekanism);
}
@@ -5,6 +5,7 @@ import java.util.Random;
import mekanism.common.Mekanism;
import mekanism.common.MekanismItems;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
@@ -13,10 +14,10 @@ public class BlockSalt extends Block
{
public BlockSalt()
{
super(Material.sand);
super(Material.SAND);
setCreativeTab(Mekanism.tabMekanism);
setHardness(0.5F);
setStepSound(soundTypeSand);
setSoundType(SoundType.SAND);
}
@Override
@@ -43,7 +43,7 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
return true;
}
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId()).getTileEntity(pointer.getWorld());
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimension()).getTileEntity(pointer.getWorld());
return tile instanceof TileEntityPressureDisperser || tile instanceof TileEntitySuperheatingElement;
}
@@ -83,7 +83,7 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
final Coord4D initDisperser = dispersers.iterator().next();
//Ensure that a full horizontal plane of dispersers exist, surrounding the found disperser
Coord4D pos = new Coord4D(structure.renderLocation.xCoord, initDisperser.yCoord, structure.renderLocation.zCoord, pointer.getWorld().provider.getDimensionId());
Coord4D pos = new Coord4D(structure.renderLocation.xCoord, initDisperser.yCoord, structure.renderLocation.zCoord, pointer.getWorld().provider.getDimension());
for(int x = 1; x < structure.volLength-1; x++)
{
for(int z = 1; z < structure.volWidth-1; z++)
@@ -134,7 +134,7 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
{
if(pointer.getWorld().isAirBlock(new BlockPos(x, y, z)) || isViableNode(x, y, z))
{
initAir = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId());
initAir = new Coord4D(x, y, z, pointer.getWorld().provider.getDimension());
totalAir++;
}
}
@@ -34,7 +34,7 @@ public class MatrixUpdateProtocol extends UpdateProtocol<SynchronizedMatrixData>
@Override
public boolean isValidInnerNode(int x, int y, int z)
{
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId()).getTileEntity(pointer.getWorld());
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimension()).getTileEntity(pointer.getWorld());
if(tile != null && (tile instanceof TileEntityInductionCell || tile instanceof TileEntityInductionProvider))
{
@@ -19,7 +19,7 @@ public class MMaterialFilter extends MinerFilter
public Material getMaterial()
{
return Block.getBlockFromItem(materialItem.getItem()).getMaterial();
return Block.getBlockFromItem(materialItem.getItem()).getStateFromMeta(materialItem.getItemDamage()).getMaterial();
}
@Override
@@ -68,7 +68,7 @@ public class ThreadMinerSearch extends Thread
continue;
}
if(!tileEntity.getWorld().getChunkProvider().chunkExists(x >> 4, z >> 4))
if(tileEntity.getWorld().getChunkProvider().getLoadedChunk(x >> 4, z >> 4) == null)
{
continue;
}
@@ -89,7 +89,7 @@ public class ThreadMinerSearch extends Thread
continue;
}
if(info.block != null && !tileEntity.getWorld().isAirBlock(new BlockPos(x, y, z)) && info.block.getBlockHardness(tileEntity.getWorld(), new BlockPos(x, y, z)) >= 0)
if(info.block != null && !tileEntity.getWorld().isAirBlock(new BlockPos(x, y, z)) && state.getBlockHardness(tileEntity.getWorld(), new BlockPos(x, y, z)) >= 0)
{
MinerFilter filterFound = null;
boolean canFilter = false;
@@ -122,7 +122,7 @@ public class ThreadMinerSearch extends Thread
if(canFilter)
{
set(i, new Coord4D(x, y, z, tileEntity.getWorld().provider.getDimensionId()));
set(i, new Coord4D(x, y, z, tileEntity.getWorld().provider.getDimension()));
replaceMap.put(i, filterFound);
found++;
@@ -8,6 +8,8 @@ import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.Pos3D;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleRedstone;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -271,7 +273,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
{
Pos3D pos = new Pos3D(posX + (rand.nextFloat()*.6 - 0.3), posY + (rand.nextFloat()*.6 - 0.3), posZ + (rand.nextFloat()*.6 - 0.3));
EntityFX fx = new EntityReddustFX.Factory().getEntityFX(0, worldObj, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0);
Particle fx = new ParticleRedstone.Factory().getEntityFX(0, worldObj, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0);
fx.setRBGColorF(color.getColor(0), color.getColor(1), color.getColor(2));
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
@@ -37,9 +37,9 @@ public class ItemAtomicDisassembler extends ItemEnergized
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack)
public boolean canHarvestBlock(IBlockState state, ItemStack stack)
{
return block != Blocks.BEDROCK;
return state.getBlock() != Blocks.BEDROCK;
}
@Override
@@ -67,15 +67,15 @@ public class ItemAtomicDisassembler extends ItemEnergized
}
@Override
public float getDigSpeed(ItemStack itemstack, IBlockState state)
public float getStrVsBlock(ItemStack itemstack, IBlockState state)
{
return getEnergy(itemstack) != 0 ? getEfficiency(itemstack) : 1F;
}
@Override
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, BlockPos pos, EntityLivingBase entityliving)
public boolean onBlockDestroyed(ItemStack itemstack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityliving)
{
if(block.getBlockHardness(world, pos) != 0.0D)
if(state.getBlockHardness(world, pos) != 0.0D)
{
setEnergy(itemstack, getEnergy(itemstack) - (general.DISASSEMBLER_USAGE*getEfficiency(itemstack)));
}
@@ -97,9 +97,9 @@ public class ItemAtomicDisassembler extends ItemEnergized
Block block = state.getBlock();
int meta = block.getMetaFromState(state);
if(block == Blocks.lit_redstone_ore)
if(block == Blocks.LIT_REDSTONE_ORE)
{
block = Blocks.redstone_ore;
block = Blocks.REDSTONE_ORE;
}
ItemStack stack = new ItemStack(block, 1, meta);
@@ -169,7 +169,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
{
if(!useHoe(stack, player, world, pos, side))
{
if(world.getBlockState(pos).getBlock() != Blocks.farmland)
if(world.getBlockState(pos).getBlock() != Blocks.FARMLAND)
{
return false;
}
@@ -363,8 +363,8 @@ public class ItemAtomicDisassembler extends ItemEnergized
}
static {
ignoreBlocks.put(Blocks.redstone_ore, ListUtils.asList(Blocks.redstone_ore, Blocks.lit_redstone_ore));
ignoreBlocks.put(Blocks.lit_redstone_ore, ListUtils.asList(Blocks.redstone_ore, Blocks.lit_redstone_ore));
ignoreBlocks.put(Blocks.REDSTONE_ORE, ListUtils.asList(Blocks.REDSTONE_ORE, Blocks.LIT_REDSTONE_ORE));
ignoreBlocks.put(Blocks.LIT_REDSTONE_ORE, ListUtils.asList(Blocks.REDSTONE_ORE, Blocks.LIT_REDSTONE_ORE));
}
}
}
@@ -17,8 +17,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -29,7 +31,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
{
super();
setHasSubtypes(true);
BlockDispenser.dispenseBehaviorRegistry.putObject(this, new DispenserBehavior());
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, new DispenserBehavior());
}
@Override
@@ -97,7 +99,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
EnumColor color = getColor(stack);
String dyeName = color.getDyedName();
if(StatCollector.canTranslate(getUnlocalizedName(stack) + "." + color.dyeName))
if(I18n.canTranslate(getUnlocalizedName(stack) + "." + color.dyeName))
{
return LangUtils.localize(getUnlocalizedName(stack) + "." + color.dyeName);
}
@@ -153,7 +155,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
}
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand)
{
if(player.isSneaking())
{
@@ -191,7 +193,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
Coord4D coord = new Coord4D(source.getX(), source.getY(), source.getZ(), source.getWorld().provider.getDimensionId());
Coord4D coord = new Coord4D(source.getX(), source.getY(), source.getZ(), source.getWorld().provider.getDimension());
EnumFacing side = EnumFacing.getFront(BlockDispenser.getFacing(source.getBlockMetadata()).ordinal());
List<EntityLivingBase> entities = source.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, coord.offset(side).getBoundingBox());
@@ -75,7 +75,7 @@ public class ItemBlockCardboardBox extends ItemBlock
Block block = state.getBlock();
int meta = block.getMetaFromState(state);
if(!world.isRemote && MekanismAPI.isBlockCompatible(Item.getItemFromBlock(block), meta) && block.getBlockHardness(world, pos) != -1)
if(!world.isRemote && MekanismAPI.isBlockCompatible(Item.getItemFromBlock(block), meta) && state.getBlockHardness(world, pos) != -1)
{
BlockData data = new BlockData();
data.block = block;
@@ -156,7 +156,7 @@ public class ItemBlockCardboardBox extends ItemBlock
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event)
{
if(event.entity instanceof EntityItem && isMonitoring)
if(event.getEntity() instanceof EntityItem && isMonitoring)
{
event.setCanceled(true);
}
@@ -56,6 +56,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
@@ -500,14 +501,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
{
if(SecurityUtils.canAccess(entityplayer, itemstack))
{
RayTraceResult pos = getRayTraceResultFromPlayer(world, entityplayer, !entityplayer.isSneaking());
RayTraceResult pos = rayTrace(world, entityplayer, !entityplayer.isSneaking());
if(pos == null)
{
return itemstack;
}
else {
if(pos.typeOfHit == RayTraceResult.MovingObjectType.BLOCK)
if(pos.typeOfHit == RayTraceResult.Type.BLOCK)
{
Coord4D coord = new Coord4D(pos.getBlockPos(), world);
@@ -35,6 +35,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional.Interface;
import net.minecraftforge.fml.common.Optional.InterfaceList;
@@ -257,7 +258,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
@Method(modid = "BuildCraft")
public boolean canWrench(EntityPlayer player, BlockPos pos)
{
return canUseWrench(player, pos);
return canUseWrench(player.inventory.getCurrentItem(), player, pos);
}
@Override
@@ -274,21 +275,21 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
public void wrenchUsed(EntityPlayer player, Entity entity) {}
@Override
public boolean canUseWrench(EntityPlayer player, BlockPos pos)
public boolean canUseWrench(ItemStack stack, EntityPlayer player, BlockPos pos)
{
return getState(player.getCurrentEquippedItem()) == ConfiguratorMode.WRENCH;
return getState(stack) == ConfiguratorMode.WRENCH;
}
@Override
public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player)
public boolean doesSneakBypassUse(ItemStack stack, IBlockAccess world, BlockPos pos, EntityPlayer player)
{
return getState(player.getCurrentEquippedItem()) == ConfiguratorMode.WRENCH;
return getState(stack) == ConfiguratorMode.WRENCH;
}
@Override
public boolean isUsable(ItemStack item, EntityLivingBase user, BlockPos pos)
{
return user instanceof EntityPlayer && canUseWrench((EntityPlayer)user, pos);
return user instanceof EntityPlayer && canUseWrench(item, (EntityPlayer)user, pos);
}
@Override
@@ -20,6 +20,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
@@ -44,26 +46,26 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
public ItemFreeRunners()
{
super(EnumHelper.addArmorMaterial("FRICTIONBOOTS", "frictionboots", 0, new int[] {0, 0, 0, 0}, 0), 0, 3);
super(EnumHelper.addArmorMaterial("FRICTIONBOOTS", "frictionboots", 0, new int[] {0, 0, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0), 0, EntityEquipmentSlot.FEET);
setMaxStackSize(1);
setCreativeTab(Mekanism.tabMekanism);
}
@Override
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity)
{
return armorType == 3;
return armorType == EntityEquipmentSlot.FEET;
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
{
return "mekanism:render/NullArmor.png";
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
{
ModelCustomArmor model = ModelCustomArmor.INSTANCE;
model.modelType = ArmorModel.FREERUNNERS;
@@ -194,14 +196,14 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
if(canSend(theItem))
{
double energyRemaining = getEnergy(theItem);
double toSend = Math.min((energy* general.FROM_TE), energyRemaining);
double toSend = Math.min((energy*general.FROM_TE), energyRemaining);
if(!simulate)
{
setEnergy(theItem, getEnergy(theItem) - toSend);
}
return (int)Math.round(toSend* general.TO_TE);
return (int)Math.round(toSend*general.TO_TE);
}
return 0;
@@ -210,13 +212,13 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
@Override
public int getEnergyStored(ItemStack theItem)
{
return (int)Math.round(getEnergy(theItem)* general.TO_TE);
return (int)Math.round(getEnergy(theItem)*general.TO_TE);
}
@Override
public int getMaxEnergyStored(ItemStack theItem)
{
return (int)Math.round(getMaxEnergy(theItem)* general.TO_TE);
return (int)Math.round(getMaxEnergy(theItem)*general.TO_TE);
}
@Override
@@ -241,16 +243,16 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
@SubscribeEvent
public void onEntityAttacked(LivingAttackEvent event)
{
EntityLivingBase base = event.entityLiving;
EntityLivingBase base = event.getEntityLiving();
ItemStack stack = base.getItemStackFromSlot(EntityEquipmentSlot.FEET);
if(base.getEquipmentInSlot(1) != null && base.getEquipmentInSlot(1).getItem() instanceof ItemFreeRunners)
if(stack != null && stack.getItem() instanceof ItemFreeRunners)
{
ItemStack stack = base.getEquipmentInSlot(1);
ItemFreeRunners boots = (ItemFreeRunners)stack.getItem();
if(boots.getEnergy(stack) > 0 && event.source == DamageSource.fall)
if(boots.getEnergy(stack) > 0 && event.getSource() == DamageSource.fall)
{
boots.setEnergy(stack, boots.getEnergy(stack)-event.ammount*50);
boots.setEnergy(stack, boots.getEnergy(stack)-event.getAmount()*50);
event.setCanceled(true);
}
}
@@ -6,6 +6,8 @@ import mekanism.common.Mekanism;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
@@ -19,25 +21,25 @@ public class ItemGasMask extends ItemArmor
{
public ItemGasMask()
{
super(EnumHelper.addArmorMaterial("GASMASK", "gasmask", 0, new int[] {0, 0, 0, 0}, 0), 0, 0);
super(EnumHelper.addArmorMaterial("GASMASK", "gasmask", 0, new int[] {0, 0, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0), 0, EntityEquipmentSlot.HEAD);
setCreativeTab(Mekanism.tabMekanism);
}
@Override
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity)
{
return armorType == 0;
return armorType == EntityEquipmentSlot.HEAD;
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
{
return "mekanism:render/NullArmor.png";
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
{
ModelCustomArmor model = ModelCustomArmor.INSTANCE;
model.modelType = ArmorModel.GASMASK;
@@ -47,19 +49,22 @@ public class ItemGasMask extends ItemArmor
@SubscribeEvent
public void onEntityAttacked(LivingAttackEvent event)
{
EntityLivingBase base = event.entityLiving;
EntityLivingBase base = event.getEntityLiving();
ItemStack headStack = base.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
ItemStack chestStack = base.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if(base.getEquipmentInSlot(4) != null && base.getEquipmentInSlot(4).getItem() instanceof ItemGasMask)
if(headStack != null && headStack.getItem() instanceof ItemGasMask)
{
ItemGasMask mask = (ItemGasMask)base.getEquipmentInSlot(4).getItem();
ItemGasMask mask = (ItemGasMask)headStack.getItem();
if(base.getEquipmentInSlot(3) != null && base.getEquipmentInSlot(3).getItem() instanceof ItemScubaTank)
if(chestStack != null && chestStack.getItem() instanceof ItemScubaTank)
{
ItemScubaTank tank = (ItemScubaTank)base.getEquipmentInSlot(3).getItem();
ItemScubaTank tank = (ItemScubaTank)chestStack.getItem();
if(tank.getFlowing(base.getEquipmentInSlot(3)) && tank.getGas(base.getEquipmentInSlot(3)) != null)
if(tank.getFlowing(chestStack) && tank.getGas(chestStack) != null)
{
if(event.source == DamageSource.magic)
if(event.getSource() == DamageSource.magic)
{
event.setCanceled(true);
}
@@ -19,6 +19,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
@@ -35,7 +37,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
public ItemJetpack()
{
super(EnumHelper.addArmorMaterial("JETPACK", "jetpack", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
super(EnumHelper.addArmorMaterial("JETPACK", "jetpack", 0, new int[] {0, 0, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0), 0, EntityEquipmentSlot.CHEST);
setCreativeTab(Mekanism.tabMekanism);
}
@@ -68,20 +70,20 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
}
@Override
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity)
{
return armorType == 1;
return armorType == EntityEquipmentSlot.CHEST;
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
{
return "mekanism:render/NullArmor.png";
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
{
ModelCustomArmor model = ModelCustomArmor.INSTANCE;
@@ -18,6 +18,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
@@ -32,7 +34,7 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
public ItemScubaTank()
{
super(EnumHelper.addArmorMaterial("SCUBATANK", "scubatank", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
super(EnumHelper.addArmorMaterial("SCUBATANK", "scubatank", 0, new int[] {0, 0, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0), 0, EntityEquipmentSlot.CHEST);
setCreativeTab(Mekanism.tabMekanism);
}
@@ -65,20 +67,20 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
}
@Override
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity)
{
return armorType == 1;
return armorType == EntityEquipmentSlot.CHEST;
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
{
return "mekanism:render/NullArmor.png";
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
{
ModelCustomArmor model = ModelCustomArmor.INSTANCE;
model.modelType = ArmorModel.SCUBATANK;
@@ -11,6 +11,7 @@ import mekanism.common.Tier;
import mekanism.common.block.states.BlockStateMachine.MachineType;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.event.FMLInterModComms;
public class MultipartMekanism implements IPartFactory
@@ -40,8 +41,10 @@ public class MultipartMekanism implements IPartFactory
}
@Override
public IMultipart createPart(String name, boolean client)
public IMultipart createPart(ResourceLocation resource, boolean client)
{
String name = resource.toString();
if(name.equals("mekanism:universal_cable"))
{
return new PartUniversalCable(Tier.CableTier.BASIC);
@@ -15,6 +15,7 @@ import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextComponentString;
public class PartDiversionTransporter extends PartLogisticalTransporter
@@ -22,9 +23,9 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
public int[] modes = {0, 0, 0, 0, 0, 0};
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:diversion_transporter";
return new ResourceLocation("mekanism:diversion_transporter");
}
@Override
@@ -5,6 +5,7 @@ import java.util.List;
import mcmultipart.microblock.IMicroblock.IFaceMicroblock;
import mcmultipart.multipart.IMultipart;
import mcmultipart.multipart.INormallyOccludingPart;
import mcmultipart.multipart.Multipart;
import mcmultipart.multipart.PartSlot;
import mcmultipart.raytrace.PartMOP;
@@ -20,10 +21,12 @@ import net.minecraft.nbt.NBTTagCompound;
//import net.minecraft.util.IIcon;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.property.IExtendedBlockState;
public class PartGlowPanel extends Multipart implements IOccludingPart
public class PartGlowPanel extends Multipart implements INormallyOccludingPart
{
public EnumColor colour = EnumColor.WHITE;
public EnumFacing side = EnumFacing.DOWN;
@@ -33,7 +36,7 @@ public class PartGlowPanel extends Multipart implements IOccludingPart
static
{
AxisAlignedBB cuboid = new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.125, 0.75);
Vec3 fromOrigin = new Vec3(-0.5, -0.5, -0.5);
Vec3d fromOrigin = new Vec3d(-0.5, -0.5, -0.5);
for(EnumFacing side : EnumFacing.VALUES)
{
@@ -60,9 +63,9 @@ public class PartGlowPanel extends Multipart implements IOccludingPart
}
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:glow_panel";
return new ResourceLocation("mekanism:glow_panel");
}
public void setColour(EnumColor newColour)
@@ -110,10 +113,12 @@ public class PartGlowPanel extends Multipart implements IOccludingPart
}
@Override
public void writeToNBT(NBTTagCompound nbt)
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
nbt.setInteger("side", side.ordinal());
nbt.setInteger("colour", colour.getMetaValue());
return nbt;
}
@Override
@@ -160,7 +165,7 @@ public class PartGlowPanel extends Multipart implements IOccludingPart
}
@Override
public String getModelPath()
public ResourceLocation getModelPath()
{
return getType();
}
@@ -34,6 +34,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.property.IExtendedBlockState;
@@ -57,9 +58,9 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
}
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:logistical_transporter_" + tier.name().toLowerCase();
return new ResourceLocation("mekanism:logistical_transporter_" + tier.name().toLowerCase());
}
@Override
@@ -303,7 +304,7 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
public NBTTagCompound writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
@@ -327,6 +328,8 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
{
nbtTags.setTag("stacks", stacks);
}
return nbtTags;
}
@Override
@@ -12,6 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -137,7 +138,7 @@ public class PartMechanicalPipe extends PartTransmitter<IFluidHandler, FluidNetw
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
public NBTTagCompound writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
@@ -150,12 +151,14 @@ public class PartMechanicalPipe extends PartTransmitter<IFluidHandler, FluidNetw
}
nbtTags.setInteger("tier", tier.ordinal());
return nbtTags;
}
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:mechanical_pipe_" + tier.name().toLowerCase();
return new ResourceLocation("mekanism:mechanical_pipe_" + tier.name().toLowerCase());
}
@Override
@@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.Capability;
public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork> implements IGasHandler
@@ -146,7 +147,7 @@ public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
public NBTTagCompound writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
@@ -159,12 +160,14 @@ public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork
}
nbtTags.setInteger("tier", tier.ordinal());
return nbtTags;
}
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:pressurized_tube_" + tier.name().toLowerCase();
return new ResourceLocation("mekanism:pressurized_tube_" + tier.name().toLowerCase());
}
@Override
@@ -2,13 +2,14 @@ package mekanism.common.multipart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
public class PartRestrictiveTransporter extends PartLogisticalTransporter
{
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:restrictive_transporter";
return new ResourceLocation("mekanism:restrictive_transporter");
}
@Override
@@ -38,8 +38,10 @@ import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -583,7 +585,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
}
@Override
public boolean onActivated(EntityPlayer player, ItemStack stack, PartMOP hit)
public boolean onActivated(EntityPlayer player, EnumHand hand, ItemStack stack, PartMOP hit)
{
if(stack == null)
{
@@ -879,7 +881,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
}
@Override
public String getModelPath()
public ResourceLocation getModelPath()
{
return getType();
}
@@ -887,7 +889,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
@Override
public BlockStateContainer createBlockState()
{
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[0], new IUnlistedProperty[] {OBJProperty.instance, ColorProperty.INSTANCE, ConnectionProperty.INSTANCE});
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[0], new IUnlistedProperty[] {OBJProperty.INSTANCE, ColorProperty.INSTANCE, ConnectionProperty.INSTANCE});
}
public List<String> getVisibleGroups()
@@ -907,7 +909,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
{
ConnectionProperty connectionProp = new ConnectionProperty(getAllCurrentConnections(), currentTransmitterConnections, connectionTypes, renderCenter());
return ((IExtendedBlockState)state).withProperty(OBJProperty.instance, new OBJState(getVisibleGroups(), true)).withProperty(ConnectionProperty.INSTANCE, connectionProp);
return ((IExtendedBlockState)state).withProperty(OBJProperty.INSTANCE, new OBJState(getVisibleGroups(), true)).withProperty(ConnectionProperty.INSTANCE, connectionProp);
}
@Override
@@ -23,6 +23,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.Capability;
public class PartThermodynamicConductor extends PartTransmitter<IHeatTransfer, HeatNetwork> implements IHeatTransfer
@@ -94,9 +95,9 @@ public class PartThermodynamicConductor extends PartTransmitter<IHeatTransfer, H
}
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:thermodynamic_conductor_" + tier.name().toLowerCase();
return new ResourceLocation("mekanism:thermodynamic_conductor_" + tier.name().toLowerCase());
}
@Override
@@ -108,11 +109,13 @@ public class PartThermodynamicConductor extends PartTransmitter<IHeatTransfer, H
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
public NBTTagCompound writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
nbtTags.setDouble("temperature", temperature);
return nbtTags;
}
public void sendTemp()
@@ -22,6 +22,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.Capability;
import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider;
@@ -158,18 +159,20 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
public NBTTagCompound writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
nbtTags.setDouble("cacheEnergy", lastWrite);
nbtTags.setInteger("tier", tier.ordinal());
return nbtTags;
}
@Override
public String getType()
public ResourceLocation getType()
{
return "mekanism:universal_cable_" + tier.name().toLowerCase();
return new ResourceLocation("mekanism:universal_cable_" + tier.name().toLowerCase());
}
@Override
@@ -19,8 +19,10 @@ import mekanism.common.network.PacketPortalFX.PortalFXMessage;
import mekanism.common.tile.TileEntityTeleporter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
@@ -114,7 +116,7 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
if(player instanceof EntityPlayerMP)
{
ReflectionUtils.setPrivateValue(((EntityPlayerMP)player).playerNetServerHandler, 0, NetHandlerPlayServer.class, ObfuscatedNames.NetHandlerPlayServer_floatingTickCount);
ReflectionUtils.setPrivateValue(((EntityPlayerMP)player).connection, 0, NetHandlerPlayServer.class, ObfuscatedNames.NetHandlerPlayServer_floatingTickCount);
}
player.closeScreen();
@@ -123,7 +125,7 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
TileEntityTeleporter.teleportPlayerTo((EntityPlayerMP)player, coords, teleporter);
TileEntityTeleporter.alignPlayer((EntityPlayerMP)player, coords);
world.playSoundAtEntity(player, "mob.endermen.portal", 1.0F, 1.0F);
world.playSound(player, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F);
Mekanism.packetHandler.sendToReceivers(new PortalFXMessage(coords), new Range4D(coords));
} catch(Exception e) {}
}
@@ -64,6 +64,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
@@ -76,6 +77,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.Axis;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
@@ -287,30 +289,6 @@ public final class MekanismUtils
}
}
/**
* Creates a fake explosion at the declared player, with only sounds and effects. No damage is caused to either blocks or the player.
* @param entityplayer - player to explode
*/
public static void doFakeEntityExplosion(EntityPlayer entityplayer)
{
World world = entityplayer.worldObj;
world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D);
world.playSoundAtEntity(entityplayer, "random.explode", 1.0F, 1.0F);
}
/**
* Creates a fake explosion at the declared coords, with only sounds and effects. No damage is caused to either blocks or the player.
* @param world - world where the explosion will occur
* @param x - x coord
* @param y - y coord
* @param z - z coord
*/
public static void doFakeBlockExplosion(World world, int x, int y, int z)
{
world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, x, y, z, 0.0D, 0.0D, 0.0D);
world.playSound(x, y, z, "random.explode", 1.0F, 1.0F, true);
}
/**
* Copies an ItemStack and returns it with a defined stackSize.
* @param itemstack - stack to change size
@@ -1502,14 +1480,14 @@ public final class MekanismUtils
*/
public static boolean hasUsableWrench(EntityPlayer player, BlockPos pos)
{
ItemStack tool = player.getCurrentEquippedItem();
ItemStack tool = player.inventory.getCurrentItem();
if(tool == null)
{
return false;
}
if(tool.getItem() instanceof IMekWrench && ((IMekWrench)tool.getItem()).canUseWrench(player, pos))
if(tool.getItem() instanceof IMekWrench && ((IMekWrench)tool.getItem()).canUseWrench(tool, player, pos))
{
return true;
}
@@ -4,6 +4,7 @@ import java.util.Random;
import mekanism.api.MekanismConfig.general;
import mekanism.common.MekanismBlocks;
import net.minecraft.block.state.pattern.BlockMatcher;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -24,19 +25,19 @@ public class GenHandler implements IWorldGenerator
for(int i = 0; i < general.osmiumPerChunk; i++)
{
BlockPos pos = new BlockPos(chunkX*16 + random.nextInt(16), random.nextInt(60), (chunkZ*16) + random.nextInt(16));
new WorldGenMinable(MekanismBlocks.OreBlock.getStateFromMeta(0), 8, BlockHelper.forBlock(Blocks.stone)).generate(world, random, pos);
new WorldGenMinable(MekanismBlocks.OreBlock.getStateFromMeta(0), 8, BlockMatcher.forBlock(Blocks.STONE)).generate(world, random, pos);
}
for(int i = 0; i < general.copperPerChunk; i++)
{
BlockPos pos = new BlockPos(chunkX*16 + random.nextInt(16), random.nextInt(60), (chunkZ*16) + random.nextInt(16));
new WorldGenMinable(MekanismBlocks.OreBlock.getStateFromMeta(1), 8, BlockHelper.forBlock(Blocks.stone)).generate(world, random, pos);
new WorldGenMinable(MekanismBlocks.OreBlock.getStateFromMeta(1), 8, BlockMatcher.forBlock(Blocks.STONE)).generate(world, random, pos);
}
for(int i = 0; i < general.tinPerChunk; i++)
{
BlockPos pos = new BlockPos(chunkX*16 + random.nextInt(16), random.nextInt(60), (chunkZ*16) + random.nextInt(16));
new WorldGenMinable(MekanismBlocks.OreBlock.getStateFromMeta(2), 8, BlockHelper.forBlock(Blocks.stone)).generate(world, random, pos);
new WorldGenMinable(MekanismBlocks.OreBlock.getStateFromMeta(2), 8, BlockMatcher.forBlock(Blocks.STONE)).generate(world, random, pos);
}
for(int i = 0; i < general.saltPerChunk; i++)
@@ -16,9 +16,11 @@ import mekanism.generators.client.model.ModelSolarGenerator;
import mekanism.generators.client.model.ModelWindGenerator;
import mekanism.generators.common.block.states.BlockStateGenerator.GeneratorType;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
@@ -26,16 +28,16 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformT
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.Attributes;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
import com.google.common.collect.ImmutableList;
public class BakedGeneratorItemModel implements IBakedModel, IPerspectiveAwareModel
{
private IBakedModel baseModel;
@@ -119,14 +121,13 @@ public class BakedGeneratorItemModel implements IBakedModel, IPerspectiveAwareMo
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing facing)
{
return new LinkedList<BakedQuad>();
}
@Override
public List<BakedQuad> getGeneralQuads()
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand)
{
if(side != null)
{
return ImmutableList.of();
}
Tessellator tessellator = Tessellator.getInstance();
tessellator.draw();
@@ -140,15 +141,15 @@ public class BakedGeneratorItemModel implements IBakedModel, IPerspectiveAwareMo
GlStateManager.enableLight(1);
GlStateManager.enableColorMaterial();
GlStateManager.colorMaterial(1032, 5634);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.popMatrix();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
VertexBuffer worldrenderer = tessellator.getBuffer();
worldrenderer.begin(7, DefaultVertexFormats.ITEM);
if(Block.getBlockFromItem(stack.getItem()) != null)
{
generalQuads.addAll(baseModel.getGeneralQuads());
generalQuads.addAll(baseModel.getQuads(state, side, rand));
}
return generalQuads;
@@ -185,17 +186,11 @@ public class BakedGeneratorItemModel implements IBakedModel, IPerspectiveAwareMo
}
@Override
public VertexFormat getFormat()
{
return Attributes.DEFAULT_BAKED_FORMAT;
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
public Pair<? extends IPerspectiveAwareModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
{
prevTransform = cameraTransformType;
if(cameraTransformType == TransformType.THIRD_PERSON)
if(cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND)
{
ForgeHooksClient.multiplyCurrentGlMatrix(CTMModelFactory.DEFAULT_BLOCK_THIRD_PERSON_MATRIX);
}
@@ -24,6 +24,7 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.generators.common.item.ItemHohlraum;
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -324,7 +325,7 @@ public class FusionReactor implements IFusionReactor
public void kill()
{
AxisAlignedBB death_zone = AxisAlignedBB.fromBounds(controller.getPos().getX() - 1, controller.getPos().getY() - 3, controller.getPos().getZ() - 1 ,controller.getPos().getX() + 2, controller.getPos().getY(), controller.getPos().getZ() + 2);
AxisAlignedBB death_zone = new AxisAlignedBB(controller.getPos().getX() - 1, controller.getPos().getY() - 3, controller.getPos().getZ() - 1 ,controller.getPos().getX() + 2, controller.getPos().getY(), controller.getPos().getZ() + 2);
List<Entity> entitiesToDie = controller.getWorld().getEntitiesWithinAABB(Entity.class, death_zone);
for(Entity entity : entitiesToDie)
@@ -349,7 +350,7 @@ public class FusionReactor implements IFusionReactor
if(!controller.getWorld().isRemote)
{
Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(controller), controller.getNetworkedData(new ArrayList())), controller.getWorld().provider.getDimensionId());
Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(controller), controller.getNetworkedData(new ArrayList())), controller.getWorld().provider.getDimension());
}
}
@@ -387,7 +388,7 @@ public class FusionReactor implements IFusionReactor
if(!controller.getWorld().isRemote)
{
Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(controller), controller.getNetworkedData(new ArrayList())), controller.getWorld().provider.getDimensionId());
Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(controller), controller.getNetworkedData(new ArrayList())), controller.getWorld().provider.getDimension());
}
}
@@ -470,9 +471,10 @@ public class FusionReactor implements IFusionReactor
for(int z = -1; z <= 1; z++)
{
Coord4D trans = centre.translate(x, y, z);
Block tile = trans.getBlock(controller.getWorld());
IBlockState state = trans.getBlockState(controller.getWorld());
Block tile = state.getBlock();
if(!tile.isAir(controller.getWorld(), trans.getPos()))
if(!tile.isAir(state, controller.getWorld(), trans.getPos()))
{
return false;
}
@@ -115,7 +115,7 @@ public class MekanismGenerators implements IModule
public void addRecipes()
{
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 1, 0), new Object[] {
"III", "WOW", "CFC", Character.valueOf('I'), "ingotIron", Character.valueOf('C'), "ingotCopper", Character.valueOf('O'), "ingotOsmium", Character.valueOf('F'), Blocks.furnace, Character.valueOf('W'), "plankWood"
"III", "WOW", "CFC", Character.valueOf('I'), "ingotIron", Character.valueOf('C'), "ingotCopper", Character.valueOf('O'), "ingotOsmium", Character.valueOf('F'), Blocks.FURNACE, Character.valueOf('W'), "plankWood"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 1, 1), new Object[] {
"SSS", "AIA", "PEP", Character.valueOf('S'), GeneratorsItems.SolarPanel, Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('I'), "ingotIron", Character.valueOf('P'), "dustOsmium", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem()
@@ -154,7 +154,7 @@ public class MekanismGenerators implements IModule
" I ", "ICI", " I ", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.Generator, 1, 10), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 2, 12), new Object[] {
" I ", "IFI", " I ", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.Generator, 1, 10), Character.valueOf('F'), Blocks.iron_bars
" I ", "IFI", " I ", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.Generator, 1, 10), Character.valueOf('F'), Blocks.IRON_BARS
}));
//Reactor Recipes
@@ -243,7 +243,7 @@ public class MekanismGenerators implements IModule
@SubscribeEvent
public void onConfigChanged(OnConfigChangedEvent event)
{
if(event.modID.equals("MekanismGenerators"))
if(event.getModID().equals("MekanismGenerators"))
{
proxy.loadConfiguration();
}
@@ -46,6 +46,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
@@ -84,7 +85,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
public BlockGenerator()
{
super(Material.iron);
super(Material.IRON);
setHardness(3.5F);
setResistance(8F);
setCreativeTab(Mekanism.tabMekanism);
@@ -175,15 +176,15 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state)
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
{
setBlockBoundsBasedOnState(world, pos);
return super.getCollisionBoundingBox(world, pos, state);
return super.getCollisionBoundingBox(state, world, pos);
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
if(!world.isRemote)
{
@@ -248,7 +249,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
}
@Override
public int getLightValue(IBlockAccess world, BlockPos pos)
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(client.enableAmbientLighting)
{
@@ -274,11 +275,11 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
}
@Override
public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, BlockPos pos)
public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World world, BlockPos pos)
{
TileEntity tile = world.getTileEntity(pos);
return SecurityUtils.canAccess(player, tile) ? super.getPlayerRelativeBlockHardness(player, world, pos) : 0.0F;
return SecurityUtils.canAccess(player, tile) ? super.getPlayerRelativeBlockHardness(state, player, world, pos) : 0.0F;
}
@Override
@@ -293,7 +294,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random random)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
{
GeneratorType type = GeneratorType.get(state.getBlock(), state.getBlock().getMetaFromState(state));
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
@@ -555,19 +556,19 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
}
@Override
public int getRenderType()
public EnumBlockRenderType getRenderType(IBlockState state)
{
return 3;
return EnumBlockRenderType.MODEL;
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullCube()
public boolean isFullCube(IBlockState state)
{
return false;
}
@@ -697,9 +698,8 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
}
@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
IBlockState state = world.getBlockState(pos);
GeneratorType type = GeneratorType.get(getGeneratorBlock(), state.getBlock().getMetaFromState(state));
if(type != GeneratorType.SOLAR_GENERATOR &&
@@ -145,7 +145,7 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
if(!world.isRemote)
{
@@ -289,7 +289,7 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock
}
@Override
public int getWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side)
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
TileEntity tile = world.getTileEntity(pos);
@@ -302,9 +302,8 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock
}
@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
IBlockState state = world.getBlockState(pos);
ReactorBlockType type = ReactorBlockType.get(getReactorBlock(), state.getBlock().getMetaFromState(state));
switch(type)
@@ -319,9 +318,8 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock
}
@Override
public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
IBlockState state = world.getBlockState(pos);
ReactorBlockType type = BlockStateReactor.ReactorBlockType.get(this, state.getBlock().getMetaFromState(state));
switch(type)
@@ -251,11 +251,13 @@ public class TileEntityTurbineRotor extends TileEntityBasicBlock
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
public NBTTagCompound writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
nbtTags.setInteger("blades", getHousedBlades());
return nbtTags;
}
@Override
@@ -3,6 +3,8 @@ package mekanism.tools.common;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import mekanism.api.MekanismConfig.tools;
import mekanism.common.Mekanism;
@@ -12,6 +14,8 @@ import mekanism.common.recipe.ShapedMekanismRecipe;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
@@ -61,6 +65,9 @@ public class MekanismTools implements IModule
public static ArmorMaterial armorBRONZE;
public static ArmorMaterial armorGLOWSTONE;
public static ArmorMaterial armorSTEEL;
public static Map<ToolMaterial, Float> AXE_DAMAGE = new HashMap<ToolMaterial, Float>();
public static Map<ToolMaterial, Float> AXE_SPEED = new HashMap<ToolMaterial, Float>();
@EventHandler
public void preInit(FMLPreInitializationEvent event)
@@ -92,19 +99,19 @@ public class MekanismTools implements IModule
//Crafting Recipes
//Base
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.WoodPaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), Items.wooden_axe, Character.valueOf('Y'), Items.wooden_pickaxe, Character.valueOf('Z'), Items.wooden_shovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), Items.WOODEN_AXE, Character.valueOf('Y'), Items.WOODEN_PICKAXE, Character.valueOf('Z'), Items.WOODEN_SHOVEL, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.StonePaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), Items.stone_axe, Character.valueOf('Y'), Items.stone_pickaxe, Character.valueOf('Z'), Items.stone_shovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), Items.STONE_AXE, Character.valueOf('Y'), Items.STONE_PICKAXE, Character.valueOf('Z'), Items.STONE_SHOVEL, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.IronPaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), Items.iron_axe, Character.valueOf('Y'), Items.iron_pickaxe, Character.valueOf('Z'), Items.iron_shovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), Items.IRON_AXE, Character.valueOf('Y'), Items.IRON_PICKAXE, Character.valueOf('Z'), Items.IRON_SHOVEL, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.DiamondPaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), Items.diamond_axe, Character.valueOf('Y'), Items.diamond_pickaxe, Character.valueOf('Z'), Items.diamond_shovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), Items.DIAMOND_AXE, Character.valueOf('Y'), Items.DIAMOND_PICKAXE, Character.valueOf('Z'), Items.DIAMOND_SHOVEL, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GoldPaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), Items.golden_axe, Character.valueOf('Y'), Items.golden_pickaxe, Character.valueOf('Z'), Items.golden_shovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), Items.GOLDEN_AXE, Character.valueOf('Y'), Items.GOLDEN_PICKAXE, Character.valueOf('Z'), Items.GOLDEN_SHOVEL, Character.valueOf('T'), Items.STICK
}));
//Obsidian
@@ -121,42 +128,42 @@ public class MekanismTools implements IModule
"* *", "* *", Character.valueOf('*'), "ingotRefinedObsidian"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.ObsidianPaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.ObsidianAxe, Character.valueOf('Y'), ToolsItems.ObsidianPickaxe, Character.valueOf('Z'), ToolsItems.ObsidianShovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.ObsidianAxe, Character.valueOf('Y'), ToolsItems.ObsidianPickaxe, Character.valueOf('Z'), ToolsItems.ObsidianShovel, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.ObsidianPickaxe, 1), new Object[] {
"XXX", " T ", " T ", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.stick
"XXX", " T ", " T ", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.ObsidianAxe, 1), new Object[] {
"XX", "XT", " T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.stick
"XX", "XT", " T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.ObsidianShovel, 1), new Object[] {
"X", "T", "T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.stick
"X", "T", "T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.ObsidianHoe, 1), new Object[] {
"XX", " T", " T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.stick
"XX", " T", " T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.ObsidianSword, 1), new Object[] {
"X", "X", "T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.stick
"X", "X", "T", Character.valueOf('X'), "ingotRefinedObsidian", Character.valueOf('T'), Items.STICK
}));
//Glowstone
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GlowstonePaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.GlowstoneAxe, Character.valueOf('Y'), ToolsItems.GlowstonePickaxe, Character.valueOf('Z'), ToolsItems.GlowstoneShovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.GlowstoneAxe, Character.valueOf('Y'), ToolsItems.GlowstonePickaxe, Character.valueOf('Z'), ToolsItems.GlowstoneShovel, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GlowstonePickaxe, 1), new Object[] {
"XXX", " T ", " T ", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.stick
"XXX", " T ", " T ", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GlowstoneAxe, 1), new Object[] {
"XX", "XT", " T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.stick
"XX", "XT", " T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GlowstoneShovel, 1), new Object[] {
"X", "T", "T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.stick
"X", "T", "T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GlowstoneHoe, 1), new Object[] {
"XX", " T", " T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.stick
"XX", " T", " T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GlowstoneSword, 1), new Object[] {
"X", "X", "T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.stick
"X", "X", "T", Character.valueOf('X'), "ingotRefinedGlowstone", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.GlowstoneHelmet, 1), new Object[] {
"***", "* *", Character.valueOf('*'), "ingotRefinedGlowstone"
@@ -173,54 +180,54 @@ public class MekanismTools implements IModule
//Lazuli
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliHelmet, 1), new Object[] {
"***", "* *", Character.valueOf('*'), new ItemStack(Items.dye, 1, 4)
"***", "* *", Character.valueOf('*'), new ItemStack(Items.DYE, 1, 4)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliChestplate, 1), new Object[] {
"* *", "***", "***", Character.valueOf('*'), new ItemStack(Items.dye, 1, 4)
"* *", "***", "***", Character.valueOf('*'), new ItemStack(Items.DYE, 1, 4)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliLeggings, 1), new Object[] {
"***", "* *", "* *", Character.valueOf('*'), new ItemStack(Items.dye, 1, 4)
"***", "* *", "* *", Character.valueOf('*'), new ItemStack(Items.DYE, 1, 4)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliBoots, 1), new Object[] {
"* *", "* *", Character.valueOf('*'), new ItemStack(Items.dye, 1, 4)
"* *", "* *", Character.valueOf('*'), new ItemStack(Items.DYE, 1, 4)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliPaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.LazuliAxe, Character.valueOf('Y'), ToolsItems.LazuliPickaxe, Character.valueOf('Z'), ToolsItems.LazuliShovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.LazuliAxe, Character.valueOf('Y'), ToolsItems.LazuliPickaxe, Character.valueOf('Z'), ToolsItems.LazuliShovel, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliPickaxe, 1), new Object[] {
"XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('T'), Items.stick
"XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliAxe, 1), new Object[] {
"XX", "XT", " T", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('T'), Items.stick
"XX", "XT", " T", Character.valueOf('X'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliShovel, 1), new Object[] {
"X", "T", "T", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('T'), Items.stick
"X", "T", "T", Character.valueOf('X'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliHoe, 1), new Object[] {
"XX", " T", " T", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('T'), Items.stick
"XX", " T", " T", Character.valueOf('X'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.LazuliSword, 1), new Object[] {
"X", "X", "T", Character.valueOf('X'), new ItemStack(Items.dye, 1, 4), Character.valueOf('T'), Items.stick
"X", "X", "T", Character.valueOf('X'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('T'), Items.STICK
}));
//Osmium
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.OsmiumPaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.OsmiumAxe, Character.valueOf('Y'), ToolsItems.OsmiumPickaxe, Character.valueOf('Z'), ToolsItems.OsmiumShovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.OsmiumAxe, Character.valueOf('Y'), ToolsItems.OsmiumPickaxe, Character.valueOf('Z'), ToolsItems.OsmiumShovel, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.OsmiumPickaxe, 1), new Object[] {
"XXX", " T ", " T ", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.stick
"XXX", " T ", " T ", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.OsmiumAxe, 1), new Object[] {
"XX", "XT", " T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.stick
"XX", "XT", " T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.OsmiumShovel, 1), new Object[] {
"X", "T", "T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.stick
"X", "T", "T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.OsmiumHoe, 1), new Object[] {
"XX", " T", " T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.stick
"XX", " T", " T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.OsmiumSword, 1), new Object[] {
"X", "X", "T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.stick
"X", "X", "T", Character.valueOf('X'), "ingotOsmium", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.OsmiumHelmet, 1), new Object[] {
"***", "* *", Character.valueOf('*'), "ingotOsmium"
@@ -237,22 +244,22 @@ public class MekanismTools implements IModule
//Bronze
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.BronzePaxel, 1), new Object[] {
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.BronzeAxe, Character.valueOf('Y'), ToolsItems.BronzePickaxe, Character.valueOf('Z'), ToolsItems.BronzeShovel, Character.valueOf('T'), Items.stick
"XYZ", " T ", " T ", Character.valueOf('X'), ToolsItems.BronzeAxe, Character.valueOf('Y'), ToolsItems.BronzePickaxe, Character.valueOf('Z'), ToolsItems.BronzeShovel, Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.BronzePickaxe, 1), new Object[] {
"XXX", " T ", " T ", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.stick
"XXX", " T ", " T ", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.BronzeAxe, 1), new Object[] {
"XX", "XT", " T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.stick
"XX", "XT", " T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.BronzeShovel, 1), new Object[] {
"X", "T", "T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.stick
"X", "T", "T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.BronzeHoe, 1), new Object[] {
"XX", " T", " T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.stick
"XX", " T", " T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.BronzeSword, 1), new Object[] {
"X", "X", "T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.stick
"X", "X", "T", Character.valueOf('X'), "ingotBronze", Character.valueOf('T'), Items.STICK
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.BronzeHelmet, 1), new Object[] {
"***", "* *", Character.valueOf('*'), "ingotBronze"
@@ -269,34 +276,34 @@ public class MekanismTools implements IModule
//Steel
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelPaxel, 1), new Object[] {
"XYZ", " I ", " I ", Character.valueOf('X'), ToolsItems.SteelAxe, Character.valueOf('Y'), ToolsItems.SteelPickaxe, Character.valueOf('Z'), ToolsItems.SteelShovel, Character.valueOf('I'), Items.iron_ingot
"XYZ", " I ", " I ", Character.valueOf('X'), ToolsItems.SteelAxe, Character.valueOf('Y'), ToolsItems.SteelPickaxe, Character.valueOf('Z'), ToolsItems.SteelShovel, Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelPickaxe, 1), new Object[] {
"XXX", " I ", " I ", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"XXX", " I ", " I ", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelAxe, 1), new Object[] {
"XX", "XI", " I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"XX", "XI", " I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelShovel, 1), new Object[] {
"X", "I", "I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"X", "I", "I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelHoe, 1), new Object[] {
"XX", " I", " I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"XX", " I", " I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelSword, 1), new Object[] {
"X", "X", "I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"X", "X", "I", Character.valueOf('X'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelHelmet, 1), new Object[] {
"***", "I I", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"***", "I I", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelChestplate, 1), new Object[] {
"I I", "*I*", "***", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"I I", "*I*", "***", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelLeggings, 1), new Object[] {
"I*I", "* *", "* *", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"I*I", "* *", "* *", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(ToolsItems.SteelBoots, 1), new Object[] {
"I *", "* I", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.iron_ingot
"I *", "* I", Character.valueOf('*'), "ingotSteel", Character.valueOf('I'), Items.IRON_INGOT
}));
}
@@ -387,7 +394,25 @@ public class MekanismTools implements IModule
, Mekanism.configuration.get("tools.tool-balance.steel.paxel", "damage", 8).getInt()
, Mekanism.configuration.get("tools.tool-balance.steel.paxel", "enchantability", 14).getInt()
);
AXE_DAMAGE.put(toolOBSIDIAN, (float)Mekanism.configuration.get("tools.tool-balance.obsidian.regular", "axeAttackDamage", 12D).getDouble());
AXE_SPEED.put(toolOBSIDIAN, (float)Mekanism.configuration.get("tools.tool-balance.obsidian.regular", "axeAttackSpeed", -2D).getDouble());
AXE_DAMAGE.put(toolLAZULI, (float)Mekanism.configuration.get("tools.tool-balance.lazuli.regular", "axeAttackDamage", 8D).getDouble());
AXE_SPEED.put(toolLAZULI, (float)Mekanism.configuration.get("tools.tool-balance.lazuli.regular", "axeAttackSpeed", -3.1D).getDouble());
AXE_DAMAGE.put(toolOSMIUM, (float)Mekanism.configuration.get("tools.tool-balance.osmium.regular", "axeAttackDamage", 8D).getDouble());
AXE_SPEED.put(toolOSMIUM, (float)Mekanism.configuration.get("tools.tool-balance.osmium.regular", "axeAttackSpeed", -3D).getDouble());
AXE_DAMAGE.put(toolBRONZE, (float)Mekanism.configuration.get("tools.tool-balance.bronze.regular", "axeAttackDamage", 8D).getDouble());
AXE_SPEED.put(toolBRONZE, (float)Mekanism.configuration.get("tools.tool-balance.bronze.regular", "axeAttackSpeed", -3.1D).getDouble());
AXE_DAMAGE.put(toolGLOWSTONE, (float)Mekanism.configuration.get("tools.tool-balance.glowstone.regular", "axeAttackDamage", 8D).getDouble());
AXE_SPEED.put(toolGLOWSTONE, (float)Mekanism.configuration.get("tools.tool-balance.glowstone.regular", "axeAttackSpeed", -3.1D).getDouble());
AXE_DAMAGE.put(toolSTEEL, (float)Mekanism.configuration.get("tools.tool-balance.steel.regular", "axeAttackDamage", 8D).getDouble());
AXE_SPEED.put(toolSTEEL, (float)Mekanism.configuration.get("tools.tool-balance.steel.regular", "axeAttackSpeed", -3D).getDouble());
//Armors
armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN", "TODO"
, Mekanism.configuration.get("tools.armor-balance.obsidian", "durability", 50).getInt()
@@ -399,6 +424,8 @@ public class MekanismTools implements IModule
, Mekanism.configuration.get("tools.armor-balance.obsidian.protection", "feet", 5).getInt()
}
, Mekanism.configuration.get("tools.armor-balance.obsidian", "enchantability", 40).getInt()
, SoundEvents.ITEM_ARMOR_EQUIP_IRON
, (float)Mekanism.configuration.get("tools.armor-balance.obsidian", "toughness", 4D).getDouble()
);
armorLAZULI = EnumHelper.addArmorMaterial("LAZULI", "TODO"
, Mekanism.configuration.get("tools.armor-balance.lapis", "durability", 13).getInt()
@@ -410,6 +437,8 @@ public class MekanismTools implements IModule
, Mekanism.configuration.get("tools.armor-balance.lapis.protection", "feet", 2).getInt()
}
, Mekanism.configuration.get("tools.armor-balance.lapis", "enchantability", 8).getInt()
, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND
, (float)Mekanism.configuration.get("tools.armor-balance.lapis", "toughness", 0D).getDouble()
);
armorOSMIUM = EnumHelper.addArmorMaterial("OSMIUM", "TODO"
, Mekanism.configuration.get("tools.armor-balance.osmium", "durability", 30).getInt()
@@ -421,6 +450,8 @@ public class MekanismTools implements IModule
, Mekanism.configuration.get("tools.armor-balance.osmium.protection", "feet", 3).getInt()
}
, Mekanism.configuration.get("tools.armor-balance.osmium", "enchantability", 12).getInt()
, SoundEvents.ITEM_ARMOR_EQUIP_IRON
, Mekanism.configuration.get("tools.armor-balance.osmium", "toughness", 1).getInt()
);
armorBRONZE = EnumHelper.addArmorMaterial("BRONZE", "TODO"
, Mekanism.configuration.get("tools.armor-balance.bronze", "durability", 35).getInt()
@@ -432,6 +463,8 @@ public class MekanismTools implements IModule
, Mekanism.configuration.get("tools.armor-balance.bronze.protection", "feet", 2).getInt()
}
, Mekanism.configuration.get("tools.armor-balance.bronze", "enchantability", 10).getInt()
, SoundEvents.ITEM_ARMOR_EQUIP_IRON
, (float)Mekanism.configuration.get("tools.armor-balance.bronze", "toughness", 0D).getDouble()
);
armorGLOWSTONE = EnumHelper.addArmorMaterial("GLOWSTONE", "TODO"
, Mekanism.configuration.get("tools.armor-balance.glowstone", "durability", 18).getInt()
@@ -443,6 +476,8 @@ public class MekanismTools implements IModule
, Mekanism.configuration.get("tools.armor-balance.glowstone.protection", "feet", 3).getInt()
}
, Mekanism.configuration.get("tools.armor-balance.glowstone", "enchantability", 18).getInt()
, SoundEvents.ITEM_ARMOR_EQUIP_IRON
, (float)Mekanism.configuration.get("tools.armor-balance.glowstone", "toughness", 0D).getDouble()
);
armorSTEEL = EnumHelper.addArmorMaterial("STEEL", "TODO"
, Mekanism.configuration.get("tools.armor-balance.steel", "durability", 40).getInt()
@@ -454,7 +489,10 @@ public class MekanismTools implements IModule
, Mekanism.configuration.get("tools.armor-balance.steel.protection", "feet", 3).getInt()
}
, Mekanism.configuration.get("tools.armor-balance.steel", "enchantability", 10).getInt()
, SoundEvents.ITEM_ARMOR_EQUIP_IRON
, (float)Mekanism.configuration.get("tools.armor-balance.steel", "toughness", 1D).getDouble()
);
if(Mekanism.configuration.hasChanged())
{
Mekanism.configuration.save();
@@ -468,58 +506,58 @@ public class MekanismTools implements IModule
@SubscribeEvent
public void onLivingSpecialSpawn(LivingSpawnEvent event)
{
double chance = event.world.rand.nextDouble();
int armorType = event.world.rand.nextInt(4);
double chance = event.getWorld().rand.nextDouble();
int armorType = event.getWorld().rand.nextInt(4);
if(chance < tools.armorSpawnRate)
{
if(event.entityLiving instanceof EntityZombie || event.entityLiving instanceof EntitySkeleton)
if(event.getEntityLiving() instanceof EntityZombie || event.getEntityLiving() instanceof EntitySkeleton)
{
int sword = event.world.rand.nextInt(100);
int helmet = event.world.rand.nextInt(100);
int chestplate = event.world.rand.nextInt(100);
int leggings = event.world.rand.nextInt(100);
int boots = event.world.rand.nextInt(100);
int sword = event.getWorld().rand.nextInt(100);
int helmet = event.getWorld().rand.nextInt(100);
int chestplate = event.getWorld().rand.nextInt(100);
int leggings = event.getWorld().rand.nextInt(100);
int boots = event.getWorld().rand.nextInt(100);
if(armorType == 0)
{
if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(ToolsItems.GlowstoneSword));
if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(ToolsItems.GlowstoneHelmet));
if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(ToolsItems.GlowstoneChestplate));
if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(ToolsItems.GlowstoneLeggings));
if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(ToolsItems.GlowstoneBoots));
if(event.getEntityLiving() instanceof EntityZombie && sword < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ToolsItems.GlowstoneSword));
if(helmet < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ToolsItems.GlowstoneHelmet));
if(chestplate < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ToolsItems.GlowstoneChestplate));
if(leggings < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ToolsItems.GlowstoneLeggings));
if(boots < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ToolsItems.GlowstoneBoots));
}
else if(armorType == 1)
{
if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(ToolsItems.LazuliSword));
if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(ToolsItems.LazuliHelmet));
if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(ToolsItems.LazuliChestplate));
if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(ToolsItems.LazuliLeggings));
if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(ToolsItems.LazuliBoots));
if(event.getEntityLiving() instanceof EntityZombie && sword < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ToolsItems.LazuliSword));
if(helmet < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ToolsItems.LazuliHelmet));
if(chestplate < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ToolsItems.LazuliChestplate));
if(leggings < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ToolsItems.LazuliLeggings));
if(boots < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ToolsItems.LazuliBoots));
}
else if(armorType == 2)
{
if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(ToolsItems.OsmiumSword));
if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(ToolsItems.OsmiumHelmet));
if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(ToolsItems.OsmiumChestplate));
if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(ToolsItems.OsmiumLeggings));
if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(ToolsItems.OsmiumBoots));
if(event.getEntityLiving() instanceof EntityZombie && sword < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ToolsItems.OsmiumSword));
if(helmet < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ToolsItems.OsmiumHelmet));
if(chestplate < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ToolsItems.OsmiumChestplate));
if(leggings < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ToolsItems.OsmiumLeggings));
if(boots < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ToolsItems.OsmiumBoots));
}
else if(armorType == 3)
{
if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(ToolsItems.SteelSword));
if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(ToolsItems.SteelHelmet));
if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(ToolsItems.SteelChestplate));
if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(ToolsItems.SteelLeggings));
if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(ToolsItems.SteelBoots));
if(event.getEntityLiving() instanceof EntityZombie && sword < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ToolsItems.SteelSword));
if(helmet < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ToolsItems.SteelHelmet));
if(chestplate < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ToolsItems.SteelChestplate));
if(leggings < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ToolsItems.SteelLeggings));
if(boots < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ToolsItems.SteelBoots));
}
else if(armorType == 4)
{
if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(ToolsItems.BronzeSword));
if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(ToolsItems.BronzeHelmet));
if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(ToolsItems.BronzeChestplate));
if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(ToolsItems.BronzeLeggings));
if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(ToolsItems.BronzeBoots));
if(event.getEntityLiving() instanceof EntityZombie && sword < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ToolsItems.BronzeSword));
if(helmet < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ToolsItems.BronzeHelmet));
if(chestplate < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ToolsItems.BronzeChestplate));
if(leggings < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ToolsItems.BronzeLeggings));
if(boots < 50) event.getEntityLiving().setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ToolsItems.BronzeBoots));
}
}
}
@@ -555,7 +593,7 @@ public class MekanismTools implements IModule
@SubscribeEvent
public void onConfigChanged(OnConfigChangedEvent event)
{
if(event.modID.equals("MekanismTools"))
if(event.getModID().equals("MekanismTools"))
{
proxy.loadConfiguration();
}
@@ -99,7 +99,7 @@ public class ToolsItems
WoodPaxel = new ItemMekanismPaxel(ToolMaterial.WOOD).setUnlocalizedName("WoodPaxel");
StonePaxel = new ItemMekanismPaxel(ToolMaterial.STONE).setUnlocalizedName("StonePaxel");
IronPaxel = new ItemMekanismPaxel(ToolMaterial.IRON).setUnlocalizedName("IronPaxel");
DiamondPaxel = new ItemMekanismPaxel(ToolMaterial.EMERALD).setUnlocalizedName("DiamondPaxel");
DiamondPaxel = new ItemMekanismPaxel(ToolMaterial.DIAMOND).setUnlocalizedName("DiamondPaxel");
GoldPaxel = new ItemMekanismPaxel(ToolMaterial.GOLD).setUnlocalizedName("GoldPaxel");
GlowstonePaxel = new ItemMekanismPaxel(MekanismTools.toolGLOWSTONE2).setUnlocalizedName("GlowstonePaxel");
GlowstonePickaxe = new ItemMekanismPickaxe(MekanismTools.toolGLOWSTONE).setUnlocalizedName("GlowstonePickaxe");
@@ -198,7 +198,7 @@ public class ToolsItems
setPaxelHarvest(WoodPaxel, ToolMaterial.WOOD);
setPaxelHarvest(StonePaxel, ToolMaterial.STONE);
setPaxelHarvest(IronPaxel, ToolMaterial.IRON);
setPaxelHarvest(DiamondPaxel, ToolMaterial.EMERALD);
setPaxelHarvest(DiamondPaxel, ToolMaterial.DIAMOND);
setPaxelHarvest(GoldPaxel, ToolMaterial.GOLD);
}
@@ -212,83 +212,83 @@ public class ToolsItems
public static void register()
{
//Base
GameRegistry.registerItem(WoodPaxel, "WoodPaxel");
GameRegistry.registerItem(StonePaxel, "StonePaxel");
GameRegistry.registerItem(IronPaxel, "IronPaxel");
GameRegistry.registerItem(DiamondPaxel, "DiamondPaxel");
GameRegistry.registerItem(GoldPaxel, "GoldPaxel");
GameRegistry.register(WoodPaxel);
GameRegistry.register(StonePaxel);
GameRegistry.register(IronPaxel);
GameRegistry.register(DiamondPaxel);
GameRegistry.register(GoldPaxel);
//Obsidian
GameRegistry.registerItem(ObsidianHelmet, "ObsidianHelmet");
GameRegistry.registerItem(ObsidianChestplate, "ObsidianChestplate");
GameRegistry.registerItem(ObsidianLeggings, "ObsidianLeggings");
GameRegistry.registerItem(ObsidianBoots, "ObsidianBoots");
GameRegistry.registerItem(ObsidianPaxel, "ObsidianPaxel");
GameRegistry.registerItem(ObsidianPickaxe, "ObsidianPickaxe");
GameRegistry.registerItem(ObsidianAxe, "ObsidianAxe");
GameRegistry.registerItem(ObsidianShovel, "ObsidianShovel");
GameRegistry.registerItem(ObsidianHoe, "ObsidianHoe");
GameRegistry.registerItem(ObsidianSword, "ObsidianSword");
GameRegistry.register(ObsidianHelmet);
GameRegistry.register(ObsidianChestplate);
GameRegistry.register(ObsidianLeggings);
GameRegistry.register(ObsidianBoots);
GameRegistry.register(ObsidianPaxel);
GameRegistry.register(ObsidianPickaxe);
GameRegistry.register(ObsidianAxe);
GameRegistry.register(ObsidianShovel);
GameRegistry.register(ObsidianHoe);
GameRegistry.register(ObsidianSword);
//Lazuli
GameRegistry.registerItem(LazuliHelmet, "LapisLazuliHelmet");
GameRegistry.registerItem(LazuliChestplate, "LapisLazuliChestplate");
GameRegistry.registerItem(LazuliLeggings, "LapisLazuliLeggings");
GameRegistry.registerItem(LazuliBoots, "LapisLazuliBoots");
GameRegistry.registerItem(LazuliPaxel, "LapisLazuliPaxel");
GameRegistry.registerItem(LazuliPickaxe, "LapisLazuliPickaxe");
GameRegistry.registerItem(LazuliAxe, "LapisLazuliAxe");
GameRegistry.registerItem(LazuliShovel, "LapisLazuliShovel");
GameRegistry.registerItem(LazuliHoe, "LapisLazuliHoe");
GameRegistry.registerItem(LazuliSword, "LapisLazuliSword");
GameRegistry.register(LazuliHelmet);
GameRegistry.register(LazuliChestplate);
GameRegistry.register(LazuliLeggings);
GameRegistry.register(LazuliBoots);
GameRegistry.register(LazuliPaxel);
GameRegistry.register(LazuliPickaxe);
GameRegistry.register(LazuliAxe);
GameRegistry.register(LazuliShovel);
GameRegistry.register(LazuliHoe);
GameRegistry.register(LazuliSword);
//Osmium
GameRegistry.registerItem(OsmiumHelmet, "OsmiumHelmet");
GameRegistry.registerItem(OsmiumChestplate, "OsmiumChestplate");
GameRegistry.registerItem(OsmiumLeggings, "OsmiumLeggings");
GameRegistry.registerItem(OsmiumBoots, "OsmiumBoots");
GameRegistry.registerItem(OsmiumPaxel, "OsmiumPaxel");
GameRegistry.registerItem(OsmiumPickaxe, "OsmiumPickaxe");
GameRegistry.registerItem(OsmiumAxe, "OsmiumAxe");
GameRegistry.registerItem(OsmiumShovel, "OsmiumShovel");
GameRegistry.registerItem(OsmiumHoe, "OsmiumHoe");
GameRegistry.registerItem(OsmiumSword, "OsmiumSword");
GameRegistry.register(OsmiumHelmet);
GameRegistry.register(OsmiumChestplate);
GameRegistry.register(OsmiumLeggings);
GameRegistry.register(OsmiumBoots);
GameRegistry.register(OsmiumPaxel);
GameRegistry.register(OsmiumPickaxe);
GameRegistry.register(OsmiumAxe);
GameRegistry.register(OsmiumShovel);
GameRegistry.register(OsmiumHoe);
GameRegistry.register(OsmiumSword);
//Bronze
GameRegistry.registerItem(BronzeHelmet, "BronzeHelmet");
GameRegistry.registerItem(BronzeChestplate, "BronzeChestplate");
GameRegistry.registerItem(BronzeLeggings, "BronzeLeggings");
GameRegistry.registerItem(BronzeBoots, "BronzeBoots");
GameRegistry.registerItem(BronzePaxel, "BronzePaxel");
GameRegistry.registerItem(BronzePickaxe, "BronzePickaxe");
GameRegistry.registerItem(BronzeAxe, "BronzeAxe");
GameRegistry.registerItem(BronzeShovel, "BronzeShovel");
GameRegistry.registerItem(BronzeHoe, "BronzeHoe");
GameRegistry.registerItem(BronzeSword, "BronzeSword");
GameRegistry.register(BronzeHelmet);
GameRegistry.register(BronzeChestplate);
GameRegistry.register(BronzeLeggings);
GameRegistry.register(BronzeBoots);
GameRegistry.register(BronzePaxel);
GameRegistry.register(BronzePickaxe);
GameRegistry.register(BronzeAxe);
GameRegistry.register(BronzeShovel);
GameRegistry.register(BronzeHoe);
GameRegistry.register(BronzeSword);
//Glowstone
GameRegistry.registerItem(GlowstonePaxel, "GlowstonePaxel");
GameRegistry.registerItem(GlowstonePickaxe, "GlowstonePickaxe");
GameRegistry.registerItem(GlowstoneAxe, "GlowstoneAxe");
GameRegistry.registerItem(GlowstoneShovel, "GlowstoneShovel");
GameRegistry.registerItem(GlowstoneHoe, "GlowstoneHoe");
GameRegistry.registerItem(GlowstoneSword, "GlowstoneSword");
GameRegistry.registerItem(GlowstoneHelmet, "GlowstoneHelmet");
GameRegistry.registerItem(GlowstoneChestplate, "GlowstoneChestplate");
GameRegistry.registerItem(GlowstoneLeggings, "GlowstoneLeggings");
GameRegistry.registerItem(GlowstoneBoots, "GlowstoneBoots");
GameRegistry.register(GlowstonePaxel);
GameRegistry.register(GlowstonePickaxe);
GameRegistry.register(GlowstoneAxe);
GameRegistry.register(GlowstoneShovel);
GameRegistry.register(GlowstoneHoe);
GameRegistry.register(GlowstoneSword);
GameRegistry.register(GlowstoneHelmet);
GameRegistry.register(GlowstoneChestplate);
GameRegistry.register(GlowstoneLeggings);
GameRegistry.register(GlowstoneBoots);
//Steel
GameRegistry.registerItem(SteelPaxel, "SteelPaxel");
GameRegistry.registerItem(SteelPickaxe, "SteelPickaxe");
GameRegistry.registerItem(SteelAxe, "SteelAxe");
GameRegistry.registerItem(SteelShovel, "SteelShovel");
GameRegistry.registerItem(SteelHoe, "SteelHoe");
GameRegistry.registerItem(SteelSword, "SteelSword");
GameRegistry.registerItem(SteelHelmet, "SteelHelmet");
GameRegistry.registerItem(SteelChestplate, "SteelChestplate");
GameRegistry.registerItem(SteelLeggings, "SteelLeggings");
GameRegistry.registerItem(SteelBoots, "SteelBoots");
GameRegistry.register(SteelPaxel);
GameRegistry.register(SteelPickaxe);
GameRegistry.register(SteelAxe);
GameRegistry.register(SteelShovel);
GameRegistry.register(SteelHoe);
GameRegistry.register(SteelSword);
GameRegistry.register(SteelHelmet);
GameRegistry.register(SteelChestplate);
GameRegistry.register(SteelLeggings);
GameRegistry.register(SteelBoots);
MekanismTools.proxy.registerItemRenders();
}
@@ -14,6 +14,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -23,7 +24,7 @@ public class ItemMekanismArmor extends ItemArmor
{
public ItemMekanismArmor(ArmorMaterial enumarmormaterial, int renderIndex)
{
super(enumarmormaterial, renderIndex, 0);
super(enumarmormaterial, renderIndex, EntityEquipmentSlot.HEAD);
setCreativeTab(Mekanism.tabMekanism);
}
@@ -34,9 +35,9 @@ public class ItemMekanismArmor extends ItemArmor
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
{
int layer = (slot == 2) ? 2 : 1;
int layer = (slot == EntityEquipmentSlot.CHEST) ? 2 : 1;
return "mekanism:armor/" + getArmorMaterial().name().toLowerCase() + "_" + layer + ".png";
}
@@ -54,7 +55,7 @@ public class ItemMekanismArmor extends ItemArmor
}
else if(getArmorMaterial() == MekanismTools.armorLAZULI)
{
return new ItemStack(Items.dye, 1, 4);
return new ItemStack(Items.DYE, 1, 4);
}
else if(getArmorMaterial() == MekanismTools.armorOSMIUM)
{
@@ -78,7 +79,7 @@ public class ItemMekanismArmor extends ItemArmor
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
{
if(itemStack.getItem() == ToolsItems.GlowstoneHelmet || itemStack.getItem() == ToolsItems.GlowstoneChestplate ||
itemStack.getItem() == ToolsItems.GlowstoneLeggings || itemStack.getItem() == ToolsItems.GlowstoneBoots)
@@ -86,6 +87,6 @@ public class ItemMekanismArmor extends ItemArmor
return ModelCustomArmor.getGlow(armorSlot);
}
return super.getArmorModel(entityLiving, itemStack, armorSlot);
return super.getArmorModel(entityLiving, itemStack, armorSlot, _default);
}
}
@@ -2,6 +2,7 @@ package mekanism.tools.item;
import java.util.Set;
import mekanism.tools.common.MekanismTools;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@@ -14,20 +15,20 @@ public class ItemMekanismAxe extends ItemMekanismTool
{
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE});
public ItemMekanismAxe(ToolMaterial enumtoolmaterial)
public ItemMekanismAxe(ToolMaterial tool)
{
super(3, enumtoolmaterial, EFFECTIVE_ON);
super(MekanismTools.AXE_DAMAGE.get(tool), MekanismTools.AXE_SPEED.get(tool), tool, EFFECTIVE_ON);
}
@Override
public float getDigSpeed(ItemStack itemstack, IBlockState blockState)
public float getStrVsBlock(ItemStack itemstack, IBlockState blockState)
{
if(blockState != null && blockState.getBlock() != null && blockState.getBlock().getMaterial() == Material.wood)
if(blockState != null && blockState.getBlock() != null && blockState.getMaterial() == Material.WOOD)
{
return efficiencyOnProperMaterial;
}
else {
return super.getDigSpeed(itemstack, blockState);
return super.getStrVsBlock(itemstack, blockState);
}
}
}
@@ -6,23 +6,33 @@ import mekanism.api.util.StackUtils;
import mekanism.common.item.ItemMekanism;
import mekanism.common.util.LangUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import com.google.common.collect.Multimap;
public class ItemMekanismHoe extends ItemMekanism
{
protected ToolMaterial toolMaterial;
private final float speed;
public ItemMekanismHoe(ToolMaterial enumtoolmaterial)
{
@@ -31,6 +41,7 @@ public class ItemMekanismHoe extends ItemMekanism
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
setCreativeTab(CreativeTabs.TOOLS);
speed = enumtoolmaterial.getDamageVsEntity() + 1.0F;
}
@Override
@@ -40,49 +51,78 @@ public class ItemMekanismHoe extends ItemMekanism
}
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, BlockPos pos, EnumFacing side, float entityX, float entityY, float entityZ)
{
if(!entityplayer.canPlayerEdit(pos, side, itemstack))
{
return false;
}
else {
UseHoeEvent event = new UseHoeEvent(entityplayer, itemstack, world, pos);
@SuppressWarnings("incomplete-switch")
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if(!playerIn.canPlayerEdit(pos.offset(facing), facing, stack))
{
return EnumActionResult.FAIL;
}
else {
int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos);
if(hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
if(MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
if(event.getResult() == Result.ALLOW)
{
itemstack.damageItem(1, entityplayer);
return true;
}
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
Block blockID = world.getBlockState(pos).getBlock();
Block aboveBlock = world.getBlockState(pos.add(0, 1, 0)).getBlock();
if(facing != EnumFacing.DOWN && worldIn.isAirBlock(pos.up()))
{
if(block == Blocks.GRASS || block == Blocks.GRASS_PATH)
{
setBlock(stack, playerIn, worldIn, pos, Blocks.FARMLAND.getDefaultState());
return EnumActionResult.SUCCESS;
}
if((side == EnumFacing.DOWN || !aboveBlock.isAir(world.getBlockState(pos), world, pos.add(0, 1, 0)) || blockID != Blocks.grass) && blockID != Blocks.DIRT)
{
return false;
}
else {
IBlockState block = Blocks.FARMLAND.getDefaultState();
world.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, block.getBlock().stepSound.getStepSound(), (block.getBlock().stepSound.getVolume() + 1.0F) / 2.0F, block.getBlock().stepSound.getFrequency() * 0.8F);
if(block == Blocks.DIRT)
{
switch((BlockDirt.DirtType)iblockstate.getValue(BlockDirt.VARIANT))
{
case DIRT:
setBlock(stack, playerIn, worldIn, pos, Blocks.FARMLAND.getDefaultState());
return EnumActionResult.SUCCESS;
case COARSE_DIRT:
setBlock(stack, playerIn, worldIn, pos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
return EnumActionResult.SUCCESS;
}
}
}
if(world.isRemote)
{
return true;
}
else {
world.setBlockState(pos, block);
itemstack.damageItem(1, entityplayer);
return true;
}
}
}
}
return EnumActionResult.PASS;
}
}
protected void setBlock(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos, IBlockState state)
{
worldIn.playSound(player, pos, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
if(!worldIn.isRemote)
{
worldIn.setBlockState(pos, state, 11);
stack.damageItem(1, player);
}
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack)
{
Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(equipmentSlot, stack);
if(equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 0.0D, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double)(this.speed - 4.0F), 0));
}
return multimap;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
stack.damageItem(1, attacker);
return true;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
@@ -1,5 +1,7 @@
package mekanism.tools.item;
import java.util.HashSet;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@@ -10,18 +12,20 @@ public class ItemMekanismPaxel extends ItemMekanismTool
{
public ItemMekanismPaxel(ToolMaterial toolMaterial)
{
super(3, toolMaterial, new Block[0]);
super(4, -2.4F, toolMaterial, new HashSet<Block>());
}
@Override
public float getDigSpeed(ItemStack stack, IBlockState blockState)
public float getStrVsBlock(ItemStack stack, IBlockState blockState)
{
return blockState.getBlock() != Blocks.BEDROCK ? efficiencyOnProperMaterial : 1.0F;
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack)
public boolean canHarvestBlock(IBlockState state, ItemStack stack)
{
Block block = state.getBlock();
if(block == Blocks.OBSIDIAN)
{
return toolMaterial.getHarvestLevel() == 3;
@@ -32,41 +36,41 @@ public class ItemMekanismPaxel extends ItemMekanismTool
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Blocks.gold_block || block == Blocks.gold_ore)
if(block == Blocks.GOLD_BLOCK || block == Blocks.GOLD_ORE)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Blocks.iron_block || block == Blocks.iron_ore)
if(block == Blocks.IRON_BLOCK || block == Blocks.IRON_ORE)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if(block == Blocks.lapis_block || block == Blocks.lapis_ore)
if(block == Blocks.LAPIS_BLOCK || block == Blocks.LAPIS_ORE)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if(block == Blocks.redstone_ore || block == Blocks.lit_redstone_ore)
if(block == Blocks.REDSTONE_ORE || block == Blocks.LIT_REDSTONE_ORE)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Blocks.anvil)
if(block == Blocks.ANVIL)
{
return toolMaterial.getHarvestLevel() >= 0;
}
if(block == Blocks.snow || block == Blocks.snow_layer)
if(block == Blocks.SNOW || block == Blocks.SNOW_LAYER)
{
return true;
}
if(block.getMaterial() == Material.rock)
if(state.getMaterial() == Material.ROCK)
{
return true;
}
return block.getMaterial() == Material.iron;
return state.getMaterial() == Material.IRON;
}
}
@@ -1,85 +1,81 @@
package mekanism.tools.item;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import com.google.common.collect.Sets;
public class ItemMekanismPickaxe extends ItemMekanismTool
{
private static Block blocksEffectiveAgainst[];
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE});
public ItemMekanismPickaxe(ToolMaterial toolMaterial)
{
super(2, toolMaterial, blocksEffectiveAgainst);
super(1, -2.8F, toolMaterial, EFFECTIVE_ON);
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack)
public boolean canHarvestBlock(IBlockState state, ItemStack stack)
{
if(block == Blocks.obsidian)
Block block = state.getBlock();
if(block == Blocks.OBSIDIAN)
{
return toolMaterial.getHarvestLevel() == 3;
}
if(block == Blocks.diamond_block || block == Blocks.diamond_ore)
if(block == Blocks.DIAMOND_BLOCK || block == Blocks.DIAMOND_ORE)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Blocks.gold_block || block == Blocks.gold_ore)
if(block == Blocks.GOLD_BLOCK || block == Blocks.GOLD_ORE)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Blocks.iron_block || block == Blocks.iron_ore)
if(block == Blocks.IRON_BLOCK || block == Blocks.IRON_ORE)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if(block == Blocks.lapis_block || block == Blocks.lapis_ore)
if(block == Blocks.LAPIS_BLOCK || block == Blocks.LAPIS_ORE)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if(block == Blocks.redstone_ore || block == Blocks.lit_redstone_ore)
if(block == Blocks.REDSTONE_ORE || block == Blocks.LIT_REDSTONE_ORE)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if(block == Blocks.anvil)
if(block == Blocks.ANVIL)
{
return toolMaterial.getHarvestLevel() >= 0;
}
if(block.getMaterial() == Material.rock)
if(state.getMaterial() == Material.ROCK)
{
return true;
}
return block.getMaterial() == Material.iron;
return state.getMaterial() == Material.IRON;
}
@Override
public float getDigSpeed(ItemStack itemstack, IBlockState blockState)
public float getStrVsBlock(ItemStack itemstack, IBlockState blockState)
{
if(blockState != null && blockState.getBlock() != null && (blockState.getBlock().getMaterial() == Material.iron || blockState.getBlock().getMaterial() == Material.anvil || blockState.getBlock().getMaterial() == Material.rock))
if(blockState != null && blockState.getBlock() != null && (blockState.getMaterial() == Material.IRON || blockState.getMaterial() == Material.ANVIL || blockState.getMaterial() == Material.ROCK))
{
return efficiencyOnProperMaterial;
}
else {
return super.getDigSpeed(itemstack, blockState);
return super.getStrVsBlock(itemstack, blockState);
}
}
static
{
blocksEffectiveAgainst = (new Block[]
{
Blocks.cobblestone, Blocks.stone_slab, Blocks.double_stone_slab, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block,
Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, Blocks.rail,
Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail
});
}
}
@@ -1,34 +1,66 @@
package mekanism.tools.item;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import com.google.common.collect.Sets;
public class ItemMekanismShovel extends ItemMekanismTool
{
private static Block blocksEffectiveAgainst[];
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
public ItemMekanismShovel(ToolMaterial enumtoolmaterial)
{
super(1, enumtoolmaterial, blocksEffectiveAgainst);
super(1.5F, -3, enumtoolmaterial, EFFECTIVE_ON);
}
@Override
public boolean canHarvestBlock(Block block, ItemStack stack)
public boolean canHarvestBlock(IBlockState state, ItemStack stack)
{
if(block == Blocks.snow_layer)
{
return true;
}
return block == Blocks.snow;
Block block = state.getBlock();
return block == Blocks.SNOW_LAYER || block == Blocks.SNOW;
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if(!playerIn.canPlayerEdit(pos.offset(facing), facing, stack))
{
return EnumActionResult.FAIL;
}
else {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
static
{
blocksEffectiveAgainst = (new Block[]
{
Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium
});
}
if(facing != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR && block == Blocks.GRASS)
{
IBlockState iblockstate1 = Blocks.GRASS_PATH.getDefaultState();
worldIn.playSound(playerIn, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F);
if(!worldIn.isRemote)
{
worldIn.setBlockState(pos, iblockstate1, 11);
stack.damageItem(1, playerIn);
}
return EnumActionResult.SUCCESS;
}
else {
return EnumActionResult.PASS;
}
}
}
}
@@ -21,12 +21,4 @@ public class ItemMekanismSword extends ItemSword
{
list.add(LangUtils.localize("tooltip.hp") + ": " + (itemstack.getMaxDamage() - itemstack.getItemDamage()));
}
/*
@Override
public void registerIcons(IIconRegister register)
{
itemIcon = register.registerIcon("mekanism:" + getUnlocalizedName().replace("item.", ""));
}
*/
}
@@ -16,9 +16,9 @@ import net.minecraft.item.ItemTool;
public class ItemMekanismTool extends ItemTool
{
public ItemMekanismTool(int mobBoost, ToolMaterial toolMaterial, Set<Block> effectiveBlocksIn)
public ItemMekanismTool(float attack, float speed, ToolMaterial toolMaterial, Set<Block> effectiveBlocksIn)
{
super(mobBoost, toolMaterial, effectiveBlocksIn);
super(attack, speed, toolMaterial, effectiveBlocksIn);
setCreativeTab(Mekanism.tabMekanism);
}