mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
oh boy it's 2 in the morning
This commit is contained in:
parent
ef921967c0
commit
739a6b4b47
@ -232,4 +232,21 @@ public class MachineBattery extends BlockContainer implements ILookOverlay {
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof TileEntityMachineBattery))
|
||||
return 0;
|
||||
|
||||
TileEntityMachineBattery battery = (TileEntityMachineBattery) te;
|
||||
return battery.getComparatorPower();
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ReactorResearch extends BlockDummyable implements IMultiblock {
|
||||
public class ReactorResearch extends BlockDummyable {
|
||||
|
||||
public ReactorResearch(Material mat) {
|
||||
super(mat);
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IMultiblock;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
@ -24,7 +23,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ZirnoxDestroyed extends BlockDummyable implements IMultiblock {
|
||||
public class ZirnoxDestroyed extends BlockDummyable {
|
||||
|
||||
public ZirnoxDestroyed(Material mat) {
|
||||
super(mat);
|
||||
|
||||
@ -17,27 +17,27 @@ import com.hbm.tileentity.machine.storage.TileEntityMachineBattery;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
public class GUIMachineBattery extends GuiInfoContainer {
|
||||
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_battery.png");
|
||||
private TileEntityMachineBattery battery;
|
||||
|
||||
public GUIMachineBattery(InventoryPlayer invPlayer, TileEntityMachineBattery tedf) {
|
||||
super(new ContainerMachineBattery(invPlayer, tedf));
|
||||
battery = tedf;
|
||||
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 52, 52, battery.power, battery.getMaxPower());
|
||||
|
||||
|
||||
long delta = battery.log[19] - battery.log[0];
|
||||
String deltaText = BobMathUtil.getShortNumber(Math.abs(delta)) + "HE/s";
|
||||
|
||||
|
||||
if(delta > 0)
|
||||
deltaText = EnumChatFormatting.GREEN + "+" + deltaText;
|
||||
else if(delta < 0)
|
||||
@ -45,40 +45,66 @@ public class GUIMachineBattery extends GuiInfoContainer {
|
||||
else
|
||||
deltaText = EnumChatFormatting.YELLOW + "+" + deltaText;
|
||||
|
||||
String[] info = {
|
||||
BobMathUtil.getShortNumber(battery.power) + "/" + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE",
|
||||
deltaText
|
||||
};
|
||||
|
||||
String[] info = { BobMathUtil.getShortNumber(battery.power) + "/" + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE", deltaText };
|
||||
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 52, 52, mouseX, mouseY, info);
|
||||
|
||||
String[] text = new String[] { "Click the buttons on the right",
|
||||
"to change battery behavior for",
|
||||
"when redstone is or isn't applied." };
|
||||
String[] text = new String[] { "Click the buttons on the right", "to change battery behavior for", "when redstone is or isn't applied." };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
|
||||
|
||||
if(battery.childLock) {
|
||||
String[] childLock = new String[] {
|
||||
EnumChatFormatting.RED + "Child Safety Lock for Buffer Mode",
|
||||
EnumChatFormatting.ITALIC + "What is Buffer Mode?",
|
||||
"Buffer Mode simply combines the input and output modes",
|
||||
"of the battery. " + EnumChatFormatting.RED + "NO, DON'T STOP READING YET.",
|
||||
"It absolutely does no more than that. It's not an omniscient",
|
||||
"load-balancer that somehow knows where you want to direct most of",
|
||||
"your energy to. Batteries - obviously - still receive energy when in",
|
||||
"Buffer Mode, which means that combining multiple batteries in Buffer",
|
||||
"Mode will cause them to constantly send energy back and forth,",
|
||||
"with only a small share going out to whatever it is you want powered.",
|
||||
"This can be solved easily by either only using Buffer Mode when",
|
||||
"actually necessary or by switching to another mode if required.",
|
||||
"Diodes may also help curb the \"ping-ponging\" of energy.",
|
||||
"",
|
||||
EnumChatFormatting.ITALIC + "What is Buffer Mode not?",
|
||||
"Something to use for every single battery because \"I want to have",
|
||||
"batteries send and receive anyway\". Rule of thumb: Use your brain,",
|
||||
"use diodes, actually think about how load distribution should work in",
|
||||
"your power grid."
|
||||
};
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 152, guiTop + 35, 16, 16, guiLeft - 80, guiTop, childLock);
|
||||
}
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 133 <= x && guiLeft + 133 + 18 > x && guiTop + 16 < y && guiTop + 16 + 18 >= y) {
|
||||
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 133 <= x && guiLeft + 133 + 18 > x && guiTop + 16 < y && guiTop + 16 + 18 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(battery.xCoord, battery.yCoord, battery.zCoord, 0, 0));
|
||||
}
|
||||
|
||||
if(guiLeft + 133 <= x && guiLeft + 133 + 18 > x && guiTop + 52 < y && guiTop + 52 + 18 >= y) {
|
||||
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(battery.xCoord, battery.yCoord, battery.zCoord, 0, 0));
|
||||
}
|
||||
|
||||
if(guiLeft + 133 <= x && guiLeft + 133 + 18 > x && guiTop + 52 < y && guiTop + 52 + 18 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(battery.xCoord, battery.yCoord, battery.zCoord, 0, 1));
|
||||
}
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(battery.xCoord, battery.yCoord, battery.zCoord, 0, 1));
|
||||
}
|
||||
|
||||
if(guiLeft + 152 <= x && guiLeft + 152 + 16 > x && guiTop + 35 < y && guiTop + 35 + 16 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(battery.xCoord, battery.yCoord, battery.zCoord, 0, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.battery.hasCustomInventoryName() ? this.battery.getInventoryName() : I18n.format(this.battery.getInventoryName());
|
||||
name += (" (" + this.battery.power + " HE)");
|
||||
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
@ -88,17 +114,20 @@ public class GUIMachineBattery 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(battery.power > 0) {
|
||||
int i = (int)battery.getPowerRemainingScaled(52);
|
||||
int i = (int) battery.getPowerRemainingScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 69 - i, 176, 52 - i, 52, i);
|
||||
}
|
||||
|
||||
|
||||
int i = battery.redLow;
|
||||
drawTexturedModalRect(guiLeft + 133, guiTop + 16, 176, 52 + i * 18, 18, 18);
|
||||
|
||||
|
||||
int j = battery.redHigh;
|
||||
drawTexturedModalRect(guiLeft + 133, guiTop + 52, 176, 52 + j * 18, 18, 18);
|
||||
|
||||
if(!battery.childLock)
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 35, 176, 124, 16, 16);
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
|
||||
}
|
||||
|
||||
@ -525,7 +525,6 @@ public class ChemplantRecipes extends SerializableRecipe {
|
||||
for(FluidStack output : chem.outputFluids) { if(output != null) this.writeFluidStack(output, writer); }
|
||||
writer.endArray();
|
||||
//Item OUT
|
||||
MainRegistry.logger.info("Trying to write output items");
|
||||
writer.name("itemOutput").beginArray();
|
||||
for(ItemStack output : chem.outputs) { if(output != null) this.writeItemStack(output, writer); }
|
||||
writer.endArray();
|
||||
@ -534,6 +533,13 @@ public class ChemplantRecipes extends SerializableRecipe {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return "Rules: All in- and output arrays need to be present, even if empty. IDs need to be unique, but not sequential. It's safe if you add your own"
|
||||
+ " recipes starting with ID 1000. Template order depends on the order of the recipes in this JSON file. The 'name' field is responsible for"
|
||||
+ " the texture being loaded for the template. Custom dynamic texture generation is not yet implemented, you will have to throw the texture into"
|
||||
+ " the JAR manually.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecipes() {
|
||||
|
||||
@ -1,16 +1,21 @@
|
||||
package com.hbm.inventory.recipes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.machine.TileEntityHadron.EnumHadronState;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HadronRecipes {
|
||||
public class HadronRecipes extends SerializableRecipe {
|
||||
|
||||
/*
|
||||
* Since we're dealing with like 10 or so recipes, using a HashMap (or to combine two keys, a HashMap *in* a HashMap)
|
||||
@ -28,7 +33,8 @@ public class HadronRecipes {
|
||||
* Having multiple recipes with different momentum requirements (at most I would expect 2) isn't exactly necessary
|
||||
* since the thing differentiates between ring and line accelerator mode, and line accelerators are by design always shorter anyway.
|
||||
*/
|
||||
public static void register() {
|
||||
@Override
|
||||
public void registerDefaults() {
|
||||
|
||||
recipes.add(new HadronRecipe(
|
||||
new ItemStack(ModItems.particle_hydrogen),
|
||||
@ -155,12 +161,69 @@ public class HadronRecipes {
|
||||
public boolean analysisOnly;
|
||||
|
||||
public HadronRecipe(ItemStack in1, ItemStack in2, int momentum, ItemStack out1, ItemStack out2, boolean analysisOnly) {
|
||||
this.in1 = new ComparableStack(in1);
|
||||
this.in2 = new ComparableStack(in2);
|
||||
this.in1 = new ComparableStack(in1).makeSingular();
|
||||
this.in2 = new ComparableStack(in2).makeSingular();
|
||||
this.momentum = momentum;
|
||||
this.out1 = out1;
|
||||
this.out2 = out2;
|
||||
this.out1.stackSize = 1;
|
||||
this.out2.stackSize = 1;
|
||||
this.analysisOnly = analysisOnly;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "hbmHadronCollider.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRecipeObject() {
|
||||
return this.recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readRecipe(JsonElement recipe) {
|
||||
JsonObject obj = (JsonObject) recipe;
|
||||
int momentum = obj.get("momentum").getAsInt();
|
||||
boolean lineMode = obj.get("lineMode").getAsBoolean();
|
||||
ItemStack[] in = this.readItemStackArray(obj.get("inputs").getAsJsonArray());
|
||||
ItemStack[] out = this.readItemStackArray(obj.get("outputs").getAsJsonArray());
|
||||
|
||||
this.recipes.add(new HadronRecipe(
|
||||
in[0],
|
||||
in[1],
|
||||
momentum,
|
||||
out[0],
|
||||
out[1],
|
||||
lineMode
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
|
||||
HadronRecipe rec = (HadronRecipe) recipe;
|
||||
|
||||
writer.name("momentum").value(rec.momentum);
|
||||
writer.name("lineMode").value(rec.analysisOnly);
|
||||
|
||||
writer.name("inputs").beginArray();
|
||||
this.writeItemStack(rec.in1.toStack(), writer);
|
||||
this.writeItemStack(rec.in2.toStack(), writer);
|
||||
writer.endArray();
|
||||
|
||||
writer.name("outputs").beginArray();
|
||||
this.writeItemStack(rec.out1, writer);
|
||||
this.writeItemStack(rec.out2, writer);
|
||||
writer.endArray();
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return "Rules: Both in- and output stacks cannot be null. Stacksizes are set to 1 for all stacks.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecipes() {
|
||||
this.recipes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,8 +20,7 @@ import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.ChemplantRecipes;
|
||||
import com.hbm.inventory.recipes.FuelPoolRecipes;
|
||||
import com.hbm.inventory.recipes.*;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
@ -39,6 +38,7 @@ public abstract class SerializableRecipe {
|
||||
|
||||
public static void registerAllHandlers() {
|
||||
recipeHandlers.add(new ChemplantRecipes());
|
||||
recipeHandlers.add(new HadronRecipes());
|
||||
recipeHandlers.add(new FuelPoolRecipes());
|
||||
}
|
||||
|
||||
@ -90,6 +90,10 @@ public abstract class SerializableRecipe {
|
||||
/** Deletes all existing recipes, currenly unused */
|
||||
public abstract void deleteRecipes();
|
||||
|
||||
public String getComment() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* JSON R/W WRAPPERS
|
||||
*/
|
||||
@ -115,6 +119,11 @@ public abstract class SerializableRecipe {
|
||||
JsonWriter writer = new JsonWriter(new FileWriter(template));
|
||||
writer.setIndent(" "); //pretty formatting
|
||||
writer.beginObject(); //initial '{'
|
||||
|
||||
if(this.getComment() != null) {
|
||||
writer.name("comment").value(this.getComment());
|
||||
}
|
||||
|
||||
writer.name("recipes").beginArray(); //all recipes are stored in an array called "recipes"
|
||||
|
||||
for(Object recipe : recipeList) {
|
||||
@ -153,7 +162,7 @@ public abstract class SerializableRecipe {
|
||||
int meta = array.size() > 3 ? array.get(3).getAsInt() : 2;
|
||||
return new ComparableStack(item, stacksize, meta);
|
||||
}
|
||||
if("dict".equals("type")) {
|
||||
if("dict".equals(type)) {
|
||||
String dict = array.get(1).getAsString();
|
||||
return new OreDictStack(dict, stacksize);
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
@ -565,35 +565,30 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
|
||||
return;
|
||||
|
||||
if(world.getTotalWorldTime() % 5 == 0) {
|
||||
|
||||
int x = check(world, (int) entity.posX, (int) entity.posY, (int) entity.posZ);
|
||||
|
||||
if(x > 0) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
|
||||
if(x < 1)
|
||||
list.add(0);
|
||||
if(x < 5)
|
||||
list.add(0);
|
||||
if(x < 10)
|
||||
list.add(1);
|
||||
if(x > 5 && x < 15)
|
||||
list.add(2);
|
||||
if(x > 10 && x < 20)
|
||||
list.add(3);
|
||||
if(x > 15 && x < 25)
|
||||
list.add(4);
|
||||
if(x > 20 && x < 30)
|
||||
list.add(5);
|
||||
if(x > 25)
|
||||
list.add(6);
|
||||
|
||||
int r = list.get(world.rand.nextInt(list.size()));
|
||||
|
||||
if(r > 0)
|
||||
world.playSoundAtEntity(entity, "hbm:item.geiger" + r, 1.0F, 1.0F);
|
||||
} else if(world.rand.nextInt(50) == 0) {
|
||||
world.playSoundAtEntity(entity, "hbm:item.geiger" + (1 + world.rand.nextInt(1)), 1.0F, 1.0F);
|
||||
|
||||
float x = HbmLivingProps.getRadBuf((EntityLivingBase)entity);
|
||||
|
||||
if(x > 1E-5) {
|
||||
|
||||
if(x > 0) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
|
||||
if(x < 1) list.add(0);
|
||||
if(x < 5) list.add(0);
|
||||
if(x < 10) list.add(1);
|
||||
if(x > 5 && x < 15) list.add(2);
|
||||
if(x > 10 && x < 20) list.add(3);
|
||||
if(x > 15 && x < 25) list.add(4);
|
||||
if(x > 20 && x < 30) list.add(5);
|
||||
if(x > 25) list.add(6);
|
||||
|
||||
int r = list.get(world.rand.nextInt(list.size()));
|
||||
|
||||
if(r > 0)
|
||||
world.playSoundAtEntity(entity, "hbm:item.geiger" + r, 1.0F, 1.0F);
|
||||
} else if(world.rand.nextInt(50) == 0) {
|
||||
world.playSoundAtEntity(entity, "hbm:item.geiger" + (1 + world.rand.nextInt(1)), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,22 +42,14 @@ public class ItemGeigerCounter extends Item {
|
||||
if(x > 1E-5) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
|
||||
if(x < 1)
|
||||
list.add(0);
|
||||
if(x < 5)
|
||||
list.add(0);
|
||||
if(x < 10)
|
||||
list.add(1);
|
||||
if(x > 5 && x < 15)
|
||||
list.add(2);
|
||||
if(x > 10 && x < 20)
|
||||
list.add(3);
|
||||
if(x > 15 && x < 25)
|
||||
list.add(4);
|
||||
if(x > 20 && x < 30)
|
||||
list.add(5);
|
||||
if(x > 25)
|
||||
list.add(6);
|
||||
if(x < 1) list.add(0);
|
||||
if(x < 5) list.add(0);
|
||||
if(x < 10) list.add(1);
|
||||
if(x > 5 && x < 15) list.add(2);
|
||||
if(x > 10 && x < 20) list.add(3);
|
||||
if(x > 15 && x < 25) list.add(4);
|
||||
if(x > 20 && x < 30) list.add(5);
|
||||
if(x > 25) list.add(6);
|
||||
|
||||
int r = list.get(rand.nextInt(list.size()));
|
||||
|
||||
|
||||
@ -960,9 +960,9 @@ public class MainRegistry {
|
||||
TileEntityNukeFurnace.registerFuels();
|
||||
BreederRecipes.registerRecipes();
|
||||
AssemblerRecipes.loadRecipes();
|
||||
//ChemplantRecipes.register(); //moved to SerializableRecipe
|
||||
//ChemplantRecipes.register(); moved to SerializableRecipe
|
||||
CyclotronRecipes.register();
|
||||
HadronRecipes.register();
|
||||
//HadronRecipes.register(); moved to SerializableRecipe
|
||||
MagicRecipes.register();
|
||||
SILEXRecipes.register();
|
||||
AnvilRecipes.register();
|
||||
|
||||
@ -242,7 +242,7 @@ public class ModEventHandlerRenderer {
|
||||
public static int currentBrightness = 0;
|
||||
public static int lastBrightness = 0;
|
||||
|
||||
@SubscribeEvent
|
||||
/*@SubscribeEvent
|
||||
public void onOverlayRender(RenderGameOverlayEvent.Pre event) {
|
||||
|
||||
if(event.type == ElementType.PORTAL) {
|
||||
@ -306,5 +306,5 @@ public class ModEventHandlerRenderer {
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -165,11 +165,20 @@ public class AuxButtonPacket implements IMessage {
|
||||
|
||||
if(m.id == 0) {
|
||||
bat.redLow = (short) ((bat.redLow + 1) % 4);
|
||||
if(bat.redLow == 1 && bat.childLock)
|
||||
bat.redLow++;
|
||||
bat.markDirty();
|
||||
}
|
||||
|
||||
if(m.id == 1) {
|
||||
bat.redHigh = (short) ((bat.redHigh + 1) % 4);
|
||||
if(bat.redHigh == 1 && bat.childLock)
|
||||
bat.redHigh++;
|
||||
bat.markDirty();
|
||||
}
|
||||
|
||||
if(m.id == 2) {
|
||||
bat.childLock = !bat.childLock;
|
||||
bat.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,12 +2,16 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderFrackingTower extends TileEntitySpecialRenderer {
|
||||
|
||||
public static final ResourceLocation pipe_tex = new ResourceLocation(RefStrings.MODID, "textures/blocks/pipe_silver.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
@ -22,6 +26,14 @@ public class RenderFrackingTower extends TileEntitySpecialRenderer {
|
||||
bindTexture(ResourceManager.fracking_tower_tex);
|
||||
ResourceManager.fracking_tower.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glTranslated(0, 0.5, 0);
|
||||
|
||||
bindTexture(pipe_tex);
|
||||
ResourceManager.pipe_neo.renderPart("pX");
|
||||
ResourceManager.pipe_neo.renderPart("nX");
|
||||
ResourceManager.pipe_neo.renderPart("pZ");
|
||||
ResourceManager.pipe_neo.renderPart("nZ");
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@ -10,8 +10,8 @@ import api.hbm.energy.IEnergyConnector;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineBattery extends TileEntityMachineBase implements IEnergyUser {
|
||||
@ -29,8 +29,10 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
public static final int mode_none = 3;
|
||||
public short redLow = 0;
|
||||
public short redHigh = 2;
|
||||
public boolean childLock = true;
|
||||
|
||||
public boolean conducts = false;
|
||||
//public boolean conducts = false;
|
||||
public byte lastRedstone = 0;
|
||||
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_bottom = new int[] {0, 1};
|
||||
@ -79,21 +81,12 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.redLow = nbt.getShort("redLow");
|
||||
this.redHigh = nbt.getShort("redHigh");
|
||||
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length) {
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
this.childLock = nbt.getBoolean("childLock");
|
||||
this.lastRedstone = nbt.getByte("lastRedstone");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,18 +96,8 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
nbt.setLong("power", power);
|
||||
nbt.setShort("redLow", redLow);
|
||||
nbt.setShort("redHigh", redHigh);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
if(slots[i] != null) {
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte) i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
nbt.setBoolean("childLock", childLock);
|
||||
nbt.setByte("lastRedstone", lastRedstone);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -146,6 +129,12 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
return (power * i) / this.getMaxPower();
|
||||
}
|
||||
|
||||
public byte getComparatorPower() {
|
||||
if(power == 0) return 0;
|
||||
double frac = (double) this.power / (double) this.getMaxPower() * 15D;
|
||||
return (byte) (MathHelper.clamp_int((int) frac + 1, 0, 15)); //to combat eventual rounding errors with the FEnSU's stupid maxPower
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -157,6 +146,11 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
this.transmitPower();
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
byte comp = this.getComparatorPower();
|
||||
if(comp != this.lastRedstone)
|
||||
this.markDirty();
|
||||
this.lastRedstone = comp;
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, getMaxPower());
|
||||
power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower());
|
||||
|
||||
@ -164,6 +158,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
nbt.setLong("power", (power + prevPower) / 2);
|
||||
nbt.setShort("redLow", redLow);
|
||||
nbt.setShort("redHigh", redHigh);
|
||||
nbt.setBoolean("childLock", childLock);
|
||||
this.networkPack(nbt, 20);
|
||||
}
|
||||
|
||||
@ -226,6 +221,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
this.power = nbt.getLong("power");
|
||||
this.redLow = nbt.getShort("redLow");
|
||||
this.redHigh = nbt.getShort("redHigh");
|
||||
this.childLock = nbt.getBoolean("childLock");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.9 KiB |
Loading…
x
Reference in New Issue
Block a user