This commit is contained in:
Bob 2023-08-04 15:01:58 +02:00
parent 09b83da578
commit 77dc34c5a8
13 changed files with 4000 additions and 21 deletions

View File

@ -1,18 +1,24 @@
package com.hbm.inventory.gui;
import java.awt.Color;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerElectrolyserMetal;
import com.hbm.inventory.material.Mats;
import com.hbm.lib.RefStrings;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntityElectrolyser;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIElectrolyserMetal extends GuiInfoContainer {
@ -34,6 +40,18 @@ public class GUIElectrolyserMetal extends GuiInfoContainer {
electrolyser.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 36, guiTop + 18, 16, 52);
if(electrolyser.leftStack != null) {
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 58, guiTop + 18, 34, 42, mouseX, mouseY, EnumChatFormatting.YELLOW + I18nUtil.resolveKey(electrolyser.leftStack.material.getUnlocalizedName()) + ": " + Mats.formatAmount(electrolyser.leftStack.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
} else {
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 58, guiTop + 18, 34, 42, mouseX, mouseY, EnumChatFormatting.RED + "Empty");
}
if(electrolyser.rightStack != null) {
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 96, guiTop + 18, 34, 42, mouseX, mouseY, EnumChatFormatting.YELLOW + I18nUtil.resolveKey(electrolyser.rightStack.material.getUnlocalizedName()) + ": " + Mats.formatAmount(electrolyser.rightStack.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
} else {
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 96, guiTop + 18, 34, 42, mouseX, mouseY, EnumChatFormatting.RED + "Empty");
}
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 186, guiTop + 18, 16, 89, electrolyser.power, electrolyser.maxPower);
}
@ -61,7 +79,32 @@ public class GUIElectrolyserMetal extends GuiInfoContainer {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(electrolyser.leftStack != null) {
int p = electrolyser.leftStack.amount * 42 / electrolyser.maxMaterial;
Color color = new Color(electrolyser.leftStack.material.moltenColor);
GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
drawTexturedModalRect(guiLeft + 58, guiTop + 60 - p, 210, 131 - p, 34, p);
}
if(electrolyser.rightStack != null) {
int p = electrolyser.rightStack.amount * 42 / electrolyser.maxMaterial;
Color color = new Color(electrolyser.rightStack.material.moltenColor);
GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
drawTexturedModalRect(guiLeft + 96, guiTop + 60 - p, 210, 131 - p, 34, p);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int p = (int) (electrolyser.power * 89 / electrolyser.maxPower);
drawTexturedModalRect(guiLeft + 186, guiTop + 107 - p, 210, 89 - p, 16, p);
if(electrolyser.power >= electrolyser.usage)
drawTexturedModalRect(guiLeft + 190, guiTop + 4, 226, 25, 9, 12);
int o = electrolyser.progressOre * 26 / electrolyser.processOreTime;
drawTexturedModalRect(guiLeft + 7, guiTop + 71 - o, 226, 25 - o, 22, o);
electrolyser.tanks[3].renderTank(guiLeft + 36, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -1968,6 +1968,10 @@ public class ModItems {
public static Item bj_plate_jetpack;
public static Item bj_legs;
public static Item bj_boots;
public static Item envsuit_helmet;
public static Item envsuit_plate;
public static Item envsuit_legs;
public static Item envsuit_boots;
public static Item hev_helmet;
public static Item hev_plate;
public static Item hev_legs;
@ -4860,6 +4864,20 @@ public class ModItems {
bj_legs = new ArmorBJ(aMatBJ, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", 10000000, 10000, 1000, 100).cloneStats((ArmorFSB) bj_helmet).setUnlocalizedName("bj_legs").setTextureName(RefStrings.MODID + ":bj_legs");
bj_boots = new ArmorBJ(aMatBJ, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", 10000000, 10000, 1000, 100).cloneStats((ArmorFSB) bj_helmet).setUnlocalizedName("bj_boots").setTextureName(RefStrings.MODID + ":bj_boots");
ArmorMaterial aMatEnv = EnumHelper.addArmorMaterial("HBM_ENV", 150, new int[] { 3, 8, 6, 3 }, 100);
aMatEnv.customCraftingMaterial = ModItems.plate_armor_hev;
envsuit_helmet = new ArmorEnvsuit(aMatEnv, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).setMod(0.5F).setThreshold(2.0F)
.addEffect(new PotionEffect(Potion.moveSpeed.id, 20, 1))
.addEffect(new PotionEffect(Potion.jump.id, 20, 0))
.addResistance("fall", 0.75F)
.addResistance("monoxide", 0F)
.addResistance("onFire", 0F)
.hides(EnumPlayerPart.HAT)
.setUnlocalizedName("envsuit_helmet").setTextureName(RefStrings.MODID + ":hev_helmet");
envsuit_plate = new ArmorEnvsuit(aMatEnv, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).cloneStats((ArmorFSB) envsuit_helmet).setUnlocalizedName("envsuit_plate").setTextureName(RefStrings.MODID + ":hev_plate");
envsuit_legs = new ArmorEnvsuit(aMatEnv, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", 1000000, 10000, 2500, 0).cloneStats((ArmorFSB) envsuit_helmet).setUnlocalizedName("envsuit_legs").setTextureName(RefStrings.MODID + ":hev_legs");
envsuit_boots = new ArmorEnvsuit(aMatEnv, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).cloneStats((ArmorFSB) envsuit_helmet).setUnlocalizedName("envsuit_boots").setTextureName(RefStrings.MODID + ":hev_boots");
ArmorMaterial aMatHEV = EnumHelper.addArmorMaterial("HBM_HEV", 150, new int[] { 3, 8, 6, 3 }, 100);
aMatHEV.customCraftingMaterial = ModItems.plate_armor_hev;
hev_helmet = new ArmorHEV(aMatHEV, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).setMod(0.20F).setCap(4.0F).setThreshold(2.0F)
@ -7792,6 +7810,10 @@ public class ModItems {
GameRegistry.registerItem(bj_plate_jetpack, bj_plate_jetpack.getUnlocalizedName());
GameRegistry.registerItem(bj_legs, bj_legs.getUnlocalizedName());
GameRegistry.registerItem(bj_boots, bj_boots.getUnlocalizedName());
GameRegistry.registerItem(envsuit_helmet, envsuit_helmet.getUnlocalizedName());
GameRegistry.registerItem(envsuit_plate, envsuit_plate.getUnlocalizedName());
GameRegistry.registerItem(envsuit_legs, envsuit_legs.getUnlocalizedName());
GameRegistry.registerItem(envsuit_boots, envsuit_boots.getUnlocalizedName());
GameRegistry.registerItem(hev_helmet, hev_helmet.getUnlocalizedName());
GameRegistry.registerItem(hev_plate, hev_plate.getUnlocalizedName());
GameRegistry.registerItem(hev_legs, hev_legs.getUnlocalizedName());

View File

@ -0,0 +1,86 @@
package com.hbm.items.armor;
import java.util.UUID;
import com.google.common.collect.Multimap;
import com.hbm.items.ModItems;
import com.hbm.render.model.ModelArmorEnvsuit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
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.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class ArmorEnvsuit extends ArmorFSBPowered {
public ArmorEnvsuit(ArmorMaterial material, int slot, String texture, long maxPower, long chargeRate, long consumption, long drain) {
super(material, slot, texture, maxPower, chargeRate, consumption, drain);
}
@SideOnly(Side.CLIENT)
ModelArmorEnvsuit[] models;
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if(models == null) {
models = new ModelArmorEnvsuit[4];
for(int i = 0; i < 4; i++)
models[i] = new ModelArmorEnvsuit(i);
}
return models[armorSlot];
}
private static final UUID speed = UUID.fromString("6ab858ba-d712-485c-bae9-e5e765fc555a");
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
super.onArmorTick(world, player, stack);
if(this != ModItems.envsuit_plate)
return;
/// SPEED ///
Multimap multimap = super.getAttributeModifiers(stack);
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(speed, "SQUIRREL SPEED", 0.1, 0));
player.getAttributeMap().removeAttributeModifiers(multimap);
if(this.hasFSBArmor(player)) {
if(player.isSprinting()) player.getAttributeMap().applyAttributeModifiers(multimap);
if(player.isInWater()) {
player.setAir(300);
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0));
double mo = 0.1 * player.moveForward;
Vec3 vec = player.getLookVec();
vec.xCoord *= mo;
vec.yCoord *= mo;
vec.zCoord *= mo;
player.motionX += vec.xCoord;
player.motionY += vec.yCoord;
player.motionZ += vec.zCoord;
} else {
if(player.isPotionActive(Potion.nightVision.id) && player.getActivePotionEffect(Potion.nightVision).getDuration() > 15 * 20) {
player.removePotionEffect(Potion.nightVision.id);
}
}
}
}
}

View File

@ -775,6 +775,7 @@ public class ResourceManager {
public static final IModelCustom armor_wings = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/armor/murk.obj"));
public static final IModelCustom armor_solstice = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/armor/solstice.obj"));
public static final IModelCustom player_manly_af = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/armor/player_fem.obj"));
public static final IModelCustom armor_envsuit = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/armor/envsuit.obj"));
////Texture Items
@ -873,6 +874,12 @@ public class ResourceManager {
public static final ResourceLocation bj_jetpack = new ResourceLocation(RefStrings.MODID, "textures/armor/bj_jetpack.png");
public static final ResourceLocation bj_arm = new ResourceLocation(RefStrings.MODID, "textures/armor/bj_arm.png");
public static final ResourceLocation envsuit_helmet = new ResourceLocation(RefStrings.MODID, "textures/armor/envsuit_helmet.png");
public static final ResourceLocation envsuit_leg = new ResourceLocation(RefStrings.MODID, "textures/armor/envsuit_leg.png");
public static final ResourceLocation envsuit_chest = new ResourceLocation(RefStrings.MODID, "textures/armor/envsuit_chest.png");
public static final ResourceLocation envsuit_arm = new ResourceLocation(RefStrings.MODID, "textures/armor/envsuit_arm.png");
public static final ResourceLocation envsuit_tail = new ResourceLocation(RefStrings.MODID, "textures/armor/envsuit_tail.png");
public static final ResourceLocation hev_helmet = new ResourceLocation(RefStrings.MODID, "textures/armor/hev_helmet.png");
public static final ResourceLocation hev_leg = new ResourceLocation(RefStrings.MODID, "textures/armor/hev_leg.png");
public static final ResourceLocation hev_chest = new ResourceLocation(RefStrings.MODID, "textures/armor/hev_chest.png");

View File

@ -39,16 +39,16 @@ public class ModelArmorBase extends ModelBiped {
rightFoot = new ModelRendererObj(null).setRotationPoint(-1.9F, 12.0F, 0.0F);
}
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity) {
public void setRotationAngles(float walkCycle, float walkAmplitude, float idleCycle, float headYaw, float headPitch, float scale, Entity entity) {
head.rotateAngleY = p_78087_4_ / (180F / (float) Math.PI);
head.rotateAngleX = p_78087_5_ / (180F / (float) Math.PI);
rightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float) Math.PI) * 2.0F * p_78087_2_ * 0.5F;
leftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F;
head.rotateAngleY = headYaw / (180F / (float) Math.PI);
head.rotateAngleX = headPitch / (180F / (float) Math.PI);
rightArm.rotateAngleX = MathHelper.cos(walkCycle * 0.6662F + (float) Math.PI) * 2.0F * walkAmplitude * 0.5F;
leftArm.rotateAngleX = MathHelper.cos(walkCycle * 0.6662F) * 2.0F * walkAmplitude * 0.5F;
rightArm.rotateAngleZ = 0.0F;
leftArm.rotateAngleZ = 0.0F;
rightFoot.rotateAngleX = rightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_;
leftFoot.rotateAngleX = leftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float) Math.PI) * 1.4F * p_78087_2_;
rightFoot.rotateAngleX = rightLeg.rotateAngleX = MathHelper.cos(walkCycle * 0.6662F) * 1.4F * walkAmplitude;
leftFoot.rotateAngleX = leftLeg.rotateAngleX = MathHelper.cos(walkCycle * 0.6662F + (float) Math.PI) * 1.4F * walkAmplitude;
rightFoot.rotateAngleY = rightLeg.rotateAngleY = 0.0F;
leftFoot.rotateAngleY = leftLeg.rotateAngleY = 0.0F;
@ -143,10 +143,10 @@ public class ModelArmorBase extends ModelBiped {
head.offsetY = 0.0F;
}
rightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
leftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
rightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
leftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
rightArm.rotateAngleZ += MathHelper.cos(idleCycle * 0.09F) * 0.05F + 0.05F;
leftArm.rotateAngleZ -= MathHelper.cos(idleCycle * 0.09F) * 0.05F + 0.05F;
rightArm.rotateAngleX += MathHelper.sin(idleCycle * 0.067F) * 0.05F;
leftArm.rotateAngleX -= MathHelper.sin(idleCycle * 0.067F) * 0.05F;
if(this.aimedBow) {
f6 = 0.0F;
@ -159,10 +159,10 @@ public class ModelArmorBase extends ModelBiped {
leftArm.rotateAngleX = -((float) Math.PI / 2F) + head.rotateAngleX;
rightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
leftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
rightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
leftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
rightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
leftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
rightArm.rotateAngleZ += MathHelper.cos(idleCycle * 0.09F) * 0.05F + 0.05F;
leftArm.rotateAngleZ -= MathHelper.cos(idleCycle * 0.09F) * 0.05F + 0.05F;
rightArm.rotateAngleX += MathHelper.sin(idleCycle * 0.067F) * 0.05F;
leftArm.rotateAngleX -= MathHelper.sin(idleCycle * 0.067F) * 0.05F;
}
}

View File

@ -0,0 +1,80 @@
package com.hbm.render.model;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.render.loader.ModelRendererObj;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.Entity;
public class ModelArmorEnvsuit extends ModelArmorBase {
ModelRendererObj lamps;
public ModelArmorEnvsuit(int type) {
super(type);
head = new ModelRendererObj(ResourceManager.armor_envsuit, "Helmet");
lamps = new ModelRendererObj(ResourceManager.armor_envsuit, "Lamps");
body = new ModelRendererObj(ResourceManager.armor_envsuit, "Chest");
leftArm = new ModelRendererObj(ResourceManager.armor_envsuit, "LeftArm").setRotationPoint(-5.0F, 2.0F, 0.0F);
rightArm = new ModelRendererObj(ResourceManager.armor_envsuit, "RightArm").setRotationPoint(5.0F, 2.0F, 0.0F);
leftLeg = new ModelRendererObj(ResourceManager.armor_envsuit, "LeftLeg").setRotationPoint(1.9F, 12.0F, 0.0F);
rightLeg = new ModelRendererObj(ResourceManager.armor_envsuit, "RightLeg").setRotationPoint(-1.9F, 12.0F, 0.0F);
leftFoot = new ModelRendererObj(ResourceManager.armor_envsuit, "LeftFoot").setRotationPoint(1.9F, 12.0F, 0.0F);
rightFoot = new ModelRendererObj(ResourceManager.armor_envsuit, "RightFoot").setRotationPoint(-1.9F, 12.0F, 0.0F);
}
@Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
head.copyTo(lamps);
GL11.glPushMatrix();
if(type == 0) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.envsuit_helmet);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
head.render(par7);
GL11.glDisable(GL11.GL_BLEND);
/// START GLOW ///
float lastX = OpenGlHelper.lastBrightnessX;
float lastY = OpenGlHelper.lastBrightnessY;
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(1F, 1F, 0.8F);
lamps.render(par7);
GL11.glColor3f(1F, 1F, 1F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopAttrib();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastX, lastY);
/// END GLOW ///
}
if(type == 1) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.envsuit_chest);
body.render(par7);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.envsuit_arm);
leftArm.render(par7);
rightArm.render(par7);
}
if(type == 2) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.envsuit_leg);
leftLeg.render(par7);
rightLeg.render(par7);
}
if(type == 3) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.envsuit_leg);
leftFoot.render(par7);
rightFoot.render(par7);
}
GL11.glPopMatrix();
}
}

View File

@ -1,5 +1,9 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.container.ContainerElectrolyserFluid;
@ -9,18 +13,25 @@ import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIElectrolyserFluid;
import com.hbm.inventory.gui.GUIElectrolyserMetal;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes;
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe;
import com.hbm.inventory.recipes.ElectrolyserMetalRecipes;
import com.hbm.inventory.recipes.ElectrolyserMetalRecipes.ElectrolysisMetalRecipe;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.CrucibleUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -28,9 +39,9 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -98,6 +109,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
if(!worldObj.isRemote) {
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
this.tanks[0].setType(3, 4, slots);
this.tanks[0].loadTank(5, 6, slots);
this.tanks[1].unloadTank(7, 8, slots);
@ -133,6 +145,63 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
}
}
if(this.canProcesMetal()) {
this.progressOre++;
this.power -= this.usage;
if(this.progressOre >= this.processOreTime) {
this.processMetal();
this.progressOre = 0;
this.markChanged();
}
}
if(this.leftStack != null) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
List<MaterialStack> toCast = new ArrayList();
toCast.add(this.leftStack);
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(1), impact);
if(didPour != null) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "foundry");
data.setInteger("color", didPour.material.moltenColor);
data.setByte("dir", (byte) dir.ordinal());
data.setFloat("off", 0.625F);
data.setFloat("base", 0.625F);
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
if(this.leftStack.amount <= 0) this.leftStack = null;
}
}
if(this.rightStack != null) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
List<MaterialStack> toCast = new ArrayList();
toCast.add(this.rightStack);
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(1), impact);
if(didPour != null) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "foundry");
data.setInteger("color", didPour.material.moltenColor);
data.setByte("dir", (byte) dir.ordinal());
data.setFloat("off", 0.625F);
data.setFloat("base", 0.625F);
data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50));
if(this.rightStack.amount <= 0) this.rightStack = null;
}
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", this.power);
data.setInteger("progressFluid", this.progressFluid);
@ -140,6 +209,14 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
data.setInteger("usage", this.usage);
data.setInteger("processFluidTime", this.processFluidTime);
data.setInteger("processOreTime", this.processOreTime);
if(this.leftStack != null) {
data.setInteger("leftType", leftStack.material.id);
data.setInteger("leftAmount", leftStack.amount);
}
if(this.rightStack != null) {
data.setInteger("rightType", rightStack.material.id);
data.setInteger("rightAmount", rightStack.amount);
}
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "t" + i);
this.networkPack(data, 50);
}
@ -167,6 +244,10 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
this.usage = nbt.getInteger("usage");
this.processFluidTime = nbt.getInteger("processFluidTime");
this.processOreTime = nbt.getInteger("processOreTime");
if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount"));
else this.leftStack = null;
if(nbt.hasKey("rightType")) this.rightStack = new MaterialStack(Mats.matById.get(nbt.getInteger("rightType")), nbt.getInteger("rightAmount"));
else this.rightStack = null;
for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i);
}
@ -220,6 +301,73 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
}
}
public boolean canProcesMetal() {
if(slots[14] == null) return false;
if(this.power < usage) return false;
if(this.tanks[3].getFill() < 100) return false;
ElectrolysisMetalRecipe recipe = ElectrolyserMetalRecipes.getRecipe(slots[14]);
if(leftStack != null) {
if(recipe.output1.material != leftStack.material) return false;
if(recipe.output1.amount + leftStack.amount > this.maxMaterial) return false;
}
if(rightStack != null) {
if(recipe.output2.material != rightStack.material) return false;
if(recipe.output2.amount + rightStack.amount > this.maxMaterial) return false;
}
if(recipe.byproduct != null) {
for(int i = 0; i < recipe.byproduct.length; i++) {
ItemStack slot = slots[15 + i];
ItemStack byproduct = recipe.byproduct[i];
if(slot == null) continue;
if(!slot.isItemEqual(byproduct)) return false;
if(slot.stackSize + byproduct.stackSize > slot.getMaxStackSize()) return false;
}
}
return true;
}
public void processMetal() {
ElectrolysisMetalRecipe recipe = ElectrolyserMetalRecipes.getRecipe(slots[14]);
if(leftStack == null) {
leftStack = new MaterialStack(recipe.output1.material, recipe.output1.amount);
} else {
leftStack.amount += recipe.output1.amount;
}
if(rightStack == null) {
rightStack = new MaterialStack(recipe.output2.material, recipe.output2.amount);
} else {
rightStack.amount += recipe.output2.amount;
}
if(recipe.byproduct != null) {
for(int i = 0; i < recipe.byproduct.length; i++) {
ItemStack slot = slots[15 + i];
ItemStack byproduct = recipe.byproduct[i];
if(slot == null) {
slots[15 + i] = byproduct.copy();
} else {
slots[15 + i].stackSize += byproduct.stackSize;
}
}
}
this.tanks[3].setFill(this.tanks[3].getFill() - 100);
this.decrStackSize(14, 1);
}
AxisAlignedBB bb = null;
@Override
@ -289,9 +437,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
}
@Override
public void receiveControl(NBTTagCompound data) {
}
public void receiveControl(NBTTagCompound data) { }
@Override
public void receiveControl(EntityPlayer player, NBTTagCompound data) {

View File

@ -439,10 +439,10 @@ book_lore.beacon.page.2=refer to the circuit diagram found on the inside of the
book_lore.beacon.page.3=for the bulb can be ordered from our stores. Third party bulbs are not recommended, as we cannot ensure safe operation. The case is made from a specialized zinc-coated stainless steel and is resistant to weathering.
book_lore.beacon.page.4=Chapter 2: Lantern $ The lantern's primary uses are providing light for ease of maintenance in harsh weather conditions as well as a status indicator. Should the power-on self test (POST) fail, the lantern will
book_lore.beacon.page.5=light up red, otherwise it will light up green. Note that colors can vary depending on the replacement bulb.
book_lore.beacon.page.6=Chapter 3: Fog Horn $ The fog horn is the primary communication device of the beacon. The beacon is designed for peer-to-peer (P2P) commincation as well as for message boradcasting.
book_lore.beacon.page.6=Chapter 3: Fog Horn $ The fog horn is the primary communication device of the beacon. The beacon is designed for peer-to-peer (P2P) communication as well as for message broadcasting.
book_lore.beacon.page.7=Chapter 4: Peer-to-Peer $ For details on communication, refer to the communications handbook. A short rundown of establishing a P2P connection follows: First, the beacon has to give the "START CONNECTION" signal,
book_lore.beacon.page.8=being a single long tone. All available peers should respond with a single long tone as well (order specified by proximity, as well as the communication guidelines outlined in the handbook, section "Responding to a Connection")
book_lore.beacon.page.9=Once the desired peer has responded, give the "ACCEPT CONNECTION" signal, being two long tones, the peer will then also respon with two long tones. All communication afterwards has to happen using pre-negotiated signals,
book_lore.beacon.page.9=Once the desired peer has responded, give the "ACCEPT CONNECTION" signal, being two long tones, the peer will then also respond with two long tones. All communication afterwards has to happen using pre-negotiated signals,
book_lore.beacon.page.10=most commonly using the FAR-5M standard. Communication will end immediately if no standard has been negotiated, serving as a "ping". Should communication continue, the connection can be ended using another long single tone "END CONNECTION".
book_lore.beacon.page.11=Chapter 5: Warranty $ [ page intentionally left blank ]

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 548 B

After

Width:  |  Height:  |  Size: 636 B