This commit is contained in:
Bob 2026-01-06 19:35:39 +01:00
parent b20d5f46b2
commit 8619c8e67d
35 changed files with 7211 additions and 343 deletions

View File

@ -5,6 +5,10 @@
* Instead of energy storage blocks, there is now a battery socket, which allows those new items to be connected to the power grid
* Battery sockets act like cables, they will connect power grids when two cables are plugged into them in different directions
* Self-chargers and creative batteries are still around, as well as spark batteries which are needed for the balefire bomb
* The FEnSU has been replaced by a much larger version with unlimited energy storage
* `/ntmreapnetworks`
* Deletes all active nodespace instances
* Mainly useful for server owners, in case nodespace builds up too much garbage data that isn't cleared correctly
## Changed
* Updated italian localization
@ -15,6 +19,8 @@
* The block ID economy is looking better than ever
* Infinite water barrels can now be crafted with any water container and not just buckets
* OpenComputers integration for the PWR can now also read the heat capacity stats
* Removed the restriction that demands that cluster ores need to be mined by hand
* Laser beams from energy weapons are now a lot more narrow
## Fixed
* Fixed meteors using a nonexistant keepalive timer, causing potential audio flickering in certain cases
@ -22,4 +28,7 @@
* Potentially fixed a performance issue caused by transmission networks not being deleted when they have no active links
* Fixed multi output recipe objects not deserializing right, causing the precision assembler config to not load
* Fixed pedestal recipes not using the correct register option, making custom config files wipe all clay tablets
* Fixed custom fluids breaking when using the `/ntmreload` command
* Fixed custom fluids breaking when using the `/ntmreload` command
* Fixed power not saving for mining lasers
* Fixed the annihilator producing blank 528 mode blueprints when 528 mode isn't even enabled
* Fixed black fire not using the skeletonizer on death

View File

@ -3,6 +3,7 @@ package api.hbm.block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@Deprecated
public interface IDrillInteraction {
/**

View File

@ -1,5 +1,6 @@
package api.hbm.block;
@Deprecated
public interface IMiningDrill {
/**

View File

@ -743,13 +743,14 @@ public class ModBlocks {
public static Block machine_microwave;
public static Block machine_battery_socket;
public static Block machine_battery_redd;
@Deprecated public static Block machine_battery_potato;
@Deprecated public static Block machine_battery;
@Deprecated public static Block machine_lithium_battery;
@Deprecated public static Block machine_schrabidium_battery;
@Deprecated public static Block machine_dineutronium_battery;
public static Block machine_fensu;
@Deprecated public static Block machine_fensu;
@Deprecated public static Block capacitor_bus;
public static Block capacitor_copper; // neat for structures
@ -1863,6 +1864,8 @@ public class ModBlocks {
machine_microwave = new MachineMicrowave(Material.iron).setBlockName("machine_microwave").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_microwave");
machine_battery_socket = new MachineBatterySocket().setBlockName("machine_battery_socket").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_battery_redd = new MachineBatteryREDD().setBlockName("machine_battery_redd").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_battery_potato = new MachineBattery(Material.iron, 10_000).setBlockName("machine_battery_potato").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_battery = new MachineBattery(Material.iron, 1_000_000).setBlockName("machine_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_lithium_battery = new MachineBattery(Material.iron, 50_000_000).setBlockName("machine_lithium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
@ -3261,6 +3264,7 @@ public class ModBlocks {
register(barrel_tcalloy);
register(barrel_antimatter);
register(machine_battery_socket);
register(machine_battery_redd);
register(machine_battery_potato);
register(machine_battery);
register(machine_lithium_battery);

View File

@ -1,26 +1,15 @@
package com.hbm.blocks.generic;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.util.i18n.I18nUtil;
import api.hbm.block.IDrillInteraction;
import api.hbm.block.IMiningDrill;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
public class BlockCluster extends Block implements IDrillInteraction, ITooltipProvider {
public class BlockCluster extends Block {
public BlockCluster(Material mat) {
super(mat);
@ -28,32 +17,7 @@ public class BlockCluster extends Block implements IDrillInteraction, ITooltipPr
@Override
public Item getItemDropped(int i, Random rand, int j) {
return null;
}
@Override
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
if(player instanceof FakePlayer || player == null) {
return;
}
if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) {
Item drop = getDrop();
if(drop == null)
return;
float f = 0.7F;
double mX = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double mY = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double mZ = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) x + mX, (double) y + mY, (double) z + mZ, new ItemStack(drop));
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
return getDrop();
}
private Item getDrop() {
@ -65,24 +29,4 @@ public class BlockCluster extends Block implements IDrillInteraction, ITooltipPr
return null;
}
@Override
public boolean canBreak(World world, int x, int y, int z, int meta, IMiningDrill drill) {
return drill.getDrillRating() > 70 || world.rand.nextFloat() < 0.05;
}
@Override
public ItemStack extractResource(World world, int x, int y, int z, int meta, IMiningDrill drill) {
return drill.getDrillRating() <= 70 ? new ItemStack(getDrop()) : null;
}
@Override
public float getRelativeHardness(World world, int x, int y, int z, int meta, IMiningDrill drill) {
return this.getBlockHardness(world, x, y, z);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.tile.cluster"));
}
}

View File

@ -0,0 +1,50 @@
package com.hbm.blocks.network;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.storage.TileEntityBatteryREDD;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineBatteryREDD extends BlockDummyable {
public MachineBatteryREDD() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) return new TileEntityBatteryREDD();
if(meta >= 6) return new TileEntityProxyCombo().power().conductor();
return null;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return standardOpenBehavior(world, x, y, z, player, side);
}
@Override public int[] getDimensions() { return new int[] {9, 0, 2, 2, 4, 4}; }
@Override public int getOffset() { return 2; }
@Override
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
x += dir.offsetX * o;
z += dir.offsetZ * o;
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
this.makeExtra(world, x + dir.offsetX * 2 + rot.offsetX * 2, y, z + dir.offsetZ * 2 + rot.offsetZ * 2);
this.makeExtra(world, x + dir.offsetX * 2 - rot.offsetX * 2, y, z + dir.offsetZ * 2 - rot.offsetZ * 2);
this.makeExtra(world, x - dir.offsetX * 2 + rot.offsetX * 2, y, z - dir.offsetZ * 2 + rot.offsetZ * 2);
this.makeExtra(world, x - dir.offsetX * 2 - rot.offsetX * 2, y, z - dir.offsetZ * 2 - rot.offsetZ * 2);
this.makeExtra(world, x + rot.offsetX * 4, y, z + rot.offsetZ * 4);
this.makeExtra(world, x - rot.offsetX * 4, y, z - rot.offsetZ * 4);
}
}

View File

@ -35,6 +35,7 @@ public class MachineBatterySocket extends BlockDummyable implements ITooltipProv
@Override public int[] getDimensions() { return new int[] {1, 0, 1, 0, 1, 0}; }
@Override public int getOffset() { return 0; }
@Override
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);

View File

@ -6,6 +6,7 @@ import com.hbm.util.ChatBuilder;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
public class CommandReapNetworks extends CommandBase {
@ -33,6 +34,8 @@ public class CommandReapNetworks extends CommandBase {
});
UniNodespace.activeNodeNets.clear();
UniNodespace.worlds.clear();
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Nodespace cleared :)"));
} catch(Exception ex) {
sender.addChatMessage(ChatBuilder.start("----------------------------------").color(EnumChatFormatting.GRAY).flush());

View File

@ -311,6 +311,9 @@ public class WeaponRecipes {
//Nuke parts
CraftingManager.addRecipeAuto(new ItemStack(ModItems.n2_charge, 1), new Object[] { " D ", "ERE", " D ", 'D', ModItems.ducttape, 'E', ModBlocks.det_charge, 'R', REDSTONE.block() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.battery_spark, 1), new Object[] { " W ", "DSD", "DSD", 'W', MAGTUNG.wireDense(), 'D', ModItems.plate_dineutronium, 'S', ModItems.powder_spark_mix });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.battery_trixite, 1), new Object[] { " W ", "DSD", "DTD", 'W', MAGTUNG.wireDense(), 'D', BIGMT.plateCast(), 'S', ModItems.powder_power, 'T', ModItems.crystal_trixite });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.battery_trixite, 1), new Object[] { " W ", "DTD", "DSD", 'W', MAGTUNG.wireDense(), 'D', BIGMT.plateCast(), 'S', ModItems.powder_power, 'T', ModItems.crystal_trixite });
//Custom nuke rods
CraftingManager.addRecipeAuto(new ItemStack(ModItems.custom_tnt, 1), new Object[] { " C ", "TIT", "TIT", 'C', CU.plate(), 'I', IRON.plate(), 'T', ANY_HIGHEXPLOSIVE.ingot() });

View File

@ -676,7 +676,7 @@ public class EntityEffectHandler {
FlameCreator.composeEffect(entity.worldObj, x - living.width / 2 + living.width * rand.nextDouble(), y + rand.nextDouble() * living.height, z - living.width / 2 + living.width * rand.nextDouble(), FlameCreator.META_BLACK);
}
if(props.fire > 0 || props.phosphorus > 0 || props.balefire > 0) if(!entity.isEntityAlive()) ConfettiUtil.decideConfetti(living, DamageSource.onFire);
if(props.fire > 0 || props.phosphorus > 0 || props.balefire > 0 || props.blackFire > 0) if(!entity.isEntityAlive()) ConfettiUtil.decideConfetti(living, DamageSource.onFire);
}
private static void handleDashing(Entity entity) {

View File

@ -0,0 +1,62 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotNonRetarded;
import com.hbm.tileentity.machine.storage.TileEntityBatteryREDD;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerBatteryREDD extends Container {
protected TileEntityBatteryREDD socket;
public ContainerBatteryREDD(InventoryPlayer invPlayer, TileEntityBatteryREDD tedf) {
this.socket = tedf;
this.addSlotToContainer(new SlotNonRetarded(socket, 0, 26, 53));
this.addSlotToContainer(new SlotNonRetarded(socket, 1, 80, 53));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 99 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 157));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return socket.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack copy = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
copy = stack.copy();
if(index <= 1) {
if(!this.mergeItemStack(stack, 2, this.inventorySlots.size(), true)) return null;
} else {
if(!this.mergeItemStack(stack, 0, 2, false)) return null;
}
if(stack.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
}
return copy;
}
}

View File

@ -0,0 +1,87 @@
package com.hbm.inventory.gui;
import java.math.BigInteger;
import java.util.Locale;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.inventory.container.ContainerBatteryREDD;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.NBTControlPacket;
import com.hbm.tileentity.machine.storage.TileEntityBatteryREDD;
import net.minecraft.client.Minecraft;
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 GUIBatteryREDD extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_battery_redd.png");
private TileEntityBatteryREDD battery;
public GUIBatteryREDD(InventoryPlayer invPlayer, TileEntityBatteryREDD tedf) {
super(new ContainerBatteryREDD(invPlayer, tedf));
battery = tedf;
this.xSize = 176;
this.ySize = 181;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
}
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
NBTTagCompound data = new NBTTagCompound();
if(this.checkClick(x, y, 133, 16, 18, 18)) { this.click(); data.setBoolean("low", true); }
if(this.checkClick(x, y, 133, 52, 18, 18)) { this.click(); data.setBoolean("high", true); }
if(this.checkClick(x, y, 152, 35, 16, 16)) { this.click(); data.setBoolean("priority", true); }
if(!data.hasNoTags()) PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, battery.xCoord, battery.yCoord, battery.zCoord));
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.battery.hasCustomInventoryName() ? this.battery.getInventoryName() : I18n.format(this.battery.getInventoryName());
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);
GL11.glPushMatrix();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glScaled(0.5, 0.5, 1);
String label = String.format(Locale.US, "%,d", battery.power) + " HE";
this.fontRendererObj.drawString(label, 242 - this.fontRendererObj.getStringWidth(label), 45, 0x00ff00);
String deltaText = String.format(Locale.US, "%,d", battery.delta) + " HE/s";
int comp = battery.delta.compareTo(BigInteger.ZERO);
if(comp > 0) deltaText = EnumChatFormatting.GREEN + "+" + deltaText;
else if(comp < 0) deltaText = EnumChatFormatting.RED + deltaText;
else deltaText = EnumChatFormatting.YELLOW + "+" + deltaText;
this.fontRendererObj.drawString(deltaText, 242 - this.fontRendererObj.getStringWidth(deltaText), 65, 0x00ff00);
GL11.glPopMatrix();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
drawTexturedModalRect(guiLeft + 133, guiTop + 16, 176, 52 + battery.redLow * 18, 18, 18);
drawTexturedModalRect(guiLeft + 133, guiTop + 52, 176, 52 + battery.redHigh * 18, 18, 18);
drawTexturedModalRect(guiLeft + 152, guiTop + 35, 194, 52 + battery.priority.ordinal() * 16 - 16, 16, 16);
}
}

View File

@ -99,6 +99,12 @@ public class GUIBatterySocket extends GuiInfoContainer {
IBatteryItem item = (IBatteryItem) battery.slots[0].getItem();
long power = item.getCharge(battery.slots[0]);
long maxPower = item.getMaxCharge(battery.slots[0]);
if(power > Long.MAX_VALUE / 100) {
power /= 100;
maxPower /= 100;
}
if(maxPower <= 1) maxPower = 1;
int p = (int) (power * 52 / maxPower); // won't work then flying too close to the sun (the limits of the LONG data type)
drawTexturedModalRect(guiLeft + 62, guiTop + 69 - p, 176, 52 - p, 34, p);
}

View File

@ -14,6 +14,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.config.GeneralConfig;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.FluidType;
@ -59,23 +60,25 @@ public class AnnihilatorRecipes extends SerializableRecipe {
@Override
public void registerDefaults() {
recipes.put(STEEL.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "steel"))));
recipes.put(SI.billet(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chip"))));
recipes.put(BI.nugget(), new AnnihilatorRecipe(new Pair(new BigInteger("128"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chip_bismoid"))));
recipes.put(ModItems.pellet_charged, new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chip_quantum"))));
recipes.put(U.billet(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "gascent"))));
recipes.put(ANY_PLASTIC.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("512"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "plastic"))));
recipes.put(RUBBER.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("512"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "rubber"))));
recipes.put(FERRO.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "ferrouranium"))));
recipes.put(SR.dust(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "strontium"))));
recipes.put(ANY_HARDPLASTIC.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "hardplastic"))));
recipes.put(ANY_RESISTANTALLOY.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "tcalloy"))));
recipes.put(ModItems.powder_chlorophyte, new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chlorophyte"))));
recipes.put(new ComparableStack(ModItems.ammo_standard, 1, EnumAmmo.BMG50_FMJ), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "bmg"))));
recipes.put(new ComparableStack(ModItems.ammo_arty, 1, 0), new AnnihilatorRecipe(new Pair(new BigInteger("128"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "arty"))));
recipes.put(new ComparableStack(ModItems.circuit, 1, EnumCircuitType.CONTROLLER), new AnnihilatorRecipe(new Pair(new BigInteger("128"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "controller"))));
if(GeneralConfig.enable528) {
recipes.put(STEEL.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "steel"))));
recipes.put(SI.billet(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chip"))));
recipes.put(BI.nugget(), new AnnihilatorRecipe(new Pair(new BigInteger("128"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chip_bismoid"))));
recipes.put(ModItems.pellet_charged, new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chip_quantum"))));
recipes.put(U.billet(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "gascent"))));
recipes.put(ANY_PLASTIC.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("512"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "plastic"))));
recipes.put(RUBBER.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("512"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "rubber"))));
recipes.put(FERRO.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "ferrouranium"))));
recipes.put(SR.dust(), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "strontium"))));
recipes.put(ANY_HARDPLASTIC.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "hardplastic"))));
recipes.put(ANY_RESISTANTALLOY.ingot(), new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "tcalloy"))));
recipes.put(ModItems.powder_chlorophyte, new AnnihilatorRecipe(new Pair(new BigInteger("1024"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "chlorophyte"))));
recipes.put(new ComparableStack(ModItems.ammo_standard, 1, EnumAmmo.BMG50_FMJ), new AnnihilatorRecipe(new Pair(new BigInteger("256"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "bmg"))));
recipes.put(new ComparableStack(ModItems.ammo_arty, 1, 0), new AnnihilatorRecipe(new Pair(new BigInteger("128"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "arty"))));
recipes.put(new ComparableStack(ModItems.circuit, 1, EnumCircuitType.CONTROLLER), new AnnihilatorRecipe(new Pair(new BigInteger("128"), ItemBlueprints.make(GenericRecipes.POOL_PREFIX_528 + "controller"))));
}
}
@Override public String getFileName() { return "hbmAnnihilator.json"; }

View File

@ -83,7 +83,7 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
this.register(new GenericRecipe("ass.platebismuth").setup(200, 100).outputItems(new ItemStack(ModItems.plate_bismuth, 1))
.inputItems(new ComparableStack(ModItems.nugget_bismuth, 2), new OreDictStack(U238.billet(), 2), new OreDictStack(NB.dust(), 1)));
this.register(new GenericRecipe("ass.plateeuphemium").setup(600, 100).outputItems(new ItemStack(ModItems.plate_euphemium, 1))
.inputItems(new OreDictStack(EUPH.ingot(), 4), new OreDictStack(AT.dust(), 3), new OreDictStack(BI.dust(), 1), new OreDictStack(VOLCANIC.gem(), 1), new ComparableStack(ModItems.ingot_osmiridium)));
.inputItems(new OreDictStack(EUPH.ingot(), 4), new OreDictStack(AT.dust(), 3), new OreDictStack(BI.dust(), 1), new OreDictStack(VOLCANIC.gem(), 1), new OreDictStack(OSMIRIDIUM.ingot())));
this.register(new GenericRecipe("ass.platednt").setup(600, 100).outputItems(new ItemStack(ModItems.plate_dineutronium, 4))
.inputItems(new OreDictStack(DNT.ingot(), 4), new ComparableStack(ModItems.powder_spark_mix, 2), new OreDictStack(DESH.ingot(), 1)));
@ -422,16 +422,16 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
.inputFluids(new FluidStack(Fluids.PERFLUOROMETHYL_COLD, 8_000))
.outputFluids(new FluidStack(Fluids.PERFLUOROMETHYL, 8_000)));
this.register(new GenericRecipe("ass.fensusan").setup(1_200, 100).outputItems(new ItemStack(ModBlocks.machine_fensu, 1))
.inputItems(new ComparableStack(ModItems.ingot_electronium, 32),
this.register(new GenericRecipe("ass.fensusan").setup(1_200, 100).outputItems(new ItemStack(ModBlocks.machine_battery_redd, 1))
.inputItems(new ComparableStack(ModItems.ingot_electronium, 64),
new ComparableStack(ModItems.battery_pack, 16, EnumBatteryPack.BATTERY_QUANTUM),
new OreDictStack(ANY_RESISTANTALLOY.plateWelded(), 64),
new OreDictStack(DURA.block(), 16),
new OreDictStack(STAR.block(), 64),
new ComparableStack(ModBlocks.machine_transformer_dnt, 8),
new ComparableStack(ModItems.coil_magnetized_tungsten, 24),
new OreDictStack(OSMIRIDIUM.plateWelded(), 64),
new OreDictStack(OSMIRIDIUM.plateWelded(), 64),
new OreDictStack(ANY_BISMOIDBRONZE.plateCast(), 64),
new OreDictStack(CMB.plateCast(), 32),
new OreDictStack(MAGTUNG.wireDense(), 32),
new ComparableStack(ModItems.plate_dineutronium, 64),
new ComparableStack(ModItems.powder_magic, 64),
new ComparableStack(ModItems.plate_dineutronium, 24),
new ComparableStack(ModItems.ingot_u238m2),
new ComparableStack(ModItems.ingot_cft, 64),
new ComparableStack(ModItems.ingot_cft, 64))
@ -439,11 +439,11 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
new ComparableStack(ModItems.battery_pack, 16, EnumBatteryPack.BATTERY_QUANTUM),
new ComparableStack(ModItems.item_expensive, 64, EnumExpensiveType.BRONZE_TUBES),
new ComparableStack(ModItems.item_expensive, 64, EnumExpensiveType.FERRO_PLATING),
new OreDictStack(STAR.block(), 64),
new ComparableStack(ModBlocks.machine_transformer_dnt, 8),
new ComparableStack(ModItems.coil_magnetized_tungsten, 24),
new ComparableStack(ModItems.powder_magic, 64),
new ComparableStack(ModItems.plate_dineutronium, 24),
new OreDictStack(OSMIRIDIUM.plateWelded(), 64),
new OreDictStack(OSMIRIDIUM.plateWelded(), 64),
new OreDictStack(OSMIRIDIUM.plateWelded(), 64),
new OreDictStack(ANY_BISMOIDBRONZE.plateCast(), 64),
new OreDictStack(CMB.plateCast(), 64),
new ComparableStack(ModItems.ingot_u238m2),
new ComparableStack(ModItems.ingot_cft, 64),
new ComparableStack(ModItems.ingot_cft, 64)));

View File

@ -1654,8 +1654,8 @@ public class ModItems {
public static Item battery_pack;
public static Item battery_creative;
public static Item cube_power;
@Deprecated public static Item battery_spark;
@Deprecated public static Item battery_trixite;
public static Item battery_spark;
public static Item battery_trixite;
public static Item battery_sc_uranium;
public static Item battery_sc_technetium;
@ -3896,7 +3896,7 @@ public class ModItems {
battery_spark_cell_power = new ItemBattery(100000000L * 1000000L, 200000000, 200000000).setUnlocalizedName("battery_spark_cell_power").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":battery_spark_cell_power");
battery_pack = new ItemBatteryPack().setUnlocalizedName("battery_pack").setTextureName(RefStrings.MODID + ":battery_generic_new");
battery_creative = new Item().setUnlocalizedName("battery_creative").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":battery_creative_new");
battery_creative = new ItemBatteryCreative().setUnlocalizedName("battery_creative").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":battery_creative_new");
cube_power = new ItemBattery(1000000000000000000L, 1000000000000000L, 1000000000000000L).setUnlocalizedName("cube_power").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":cube_power");
battery_sc_uranium = new ItemSelfcharger(5).setUnlocalizedName("battery_sc_uranium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":battery_sc_uranium");

View File

@ -133,6 +133,11 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider
public boolean hasCustomInventoryName() {
return target.hasDisplayName();
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return player.getHeldItem() == this.target;
}
@Override
public void markDirty() { // You have been blessed by the unfuck

View File

@ -0,0 +1,18 @@
package com.hbm.items.machine;
import api.hbm.energymk2.IBatteryItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemBatteryCreative extends Item implements IBatteryItem {
@Override public void chargeBattery(ItemStack stack, long i) { }
@Override public void setCharge(ItemStack stack, long i) { }
@Override public void dischargeBattery(ItemStack stack, long i) { }
@Override public long getCharge(ItemStack stack) { return Long.MAX_VALUE / 2L; }
@Override public long getMaxCharge(ItemStack stack) { return Long.MAX_VALUE; }
@Override public long getChargeRate(ItemStack stack) { return Long.MAX_VALUE / 100L; }
@Override public long getDischargeRate(ItemStack stack) { return Long.MAX_VALUE / 100L; }
}

View File

@ -307,6 +307,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForceField.class, new RenderMachineForceField());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineFENSU.class, new RenderFENSU());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBatterySocket.class, new RenderBatterySocket());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBatteryREDD.class, new RenderBatteryREDD());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineLargeTurbine.class, new RenderBigTurbine());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineReactorBreeding.class, new RenderBreeder());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySolarBoiler.class, new RenderSolarBoiler());

View File

@ -271,6 +271,7 @@ public class ResourceManager {
//FENSU
public static final IModelCustom battery_socket = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/battery.obj")).asVBO();
public static final IModelCustom battery_redd = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/fensu2.obj")).asVBO();
public static final IModelCustom fensu = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/fensu.obj")).asVBO();
//Radar
@ -739,6 +740,7 @@ public class ResourceManager {
//FENSU
public static final ResourceLocation battery_socket_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/battery_socket.png");
public static final ResourceLocation battery_redd_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fensu2.png");
public static final ResourceLocation fensu_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fensu.png");
//Radar

View File

@ -0,0 +1,264 @@
package com.hbm.render.tileentity;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import com.hbm.render.util.BeamPronter;
import com.hbm.render.util.BeamPronter.EnumBeamType;
import com.hbm.render.util.BeamPronter.EnumWaveType;
import com.hbm.tileentity.machine.storage.TileEntityBatteryREDD;
import com.hbm.util.BobMathUtil;
import com.hbm.util.Clock;
import com.hbm.util.Vec3NT;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.IItemRenderer;
public class RenderBatteryREDD extends TileEntitySpecialRenderer implements IItemRendererProvider {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
switch(tile.getBlockMetadata() - 10) {
case 2: GL11.glRotatef(270, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(0, 0F, 1F, 0F); break;
case 3: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(180, 0F, 1F, 0F); break;
}
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.battery_redd_tex);
ResourceManager.battery_redd.renderPart("Base");
GL11.glPushMatrix();
GL11.glTranslated(0, 5.5, 0);
TileEntityBatteryREDD redd = (TileEntityBatteryREDD) tile;
float speed = redd.getSpeed();
double rot = redd.prevRotation + (redd.rotation - redd.prevRotation) * interp;
GL11.glRotated(rot, 1, 0, 0);
GL11.glTranslated(0, -5.5, 0);
ResourceManager.battery_redd.renderPart("Wheel");
RenderArcFurnace.fullbright(true);
ResourceManager.battery_redd.renderPart("Lights");
RenderArcFurnace.fullbright(false);
GL11.glPushMatrix();
GL11.glTranslated(0, 5.5, 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDepthMask(false);
Vec3NT vec = new Vec3NT(0, 0, 4);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
double len = 4.25D;
double width = 0.125D;
double span = speed * 0.75;
if(span > 0) for(int j = -1; j <= 1; j += 2) {
for(int i = 0; i < 8; i++) {
double xOffset = 0.8125 * j;
vec.setComponents(0, 1, 0);
vec.rotateAroundXDeg(i * 45D);
tess.setColorRGBA_F(1F, 1F, 0F, 0.75F);
tess.addVertex(xOffset, vec.yCoord * len - vec.yCoord * width, vec.zCoord * len - vec.zCoord * width);
tess.addVertex(xOffset, vec.yCoord * len + vec.yCoord * width, vec.zCoord * len + vec.zCoord * width);
vec.rotateAroundXDeg(span);
tess.setColorRGBA_F(1F, 1F, 0F, 0.5F);
tess.addVertex(xOffset, vec.yCoord * len + vec.yCoord * width, vec.zCoord * len + vec.zCoord * width);
tess.addVertex(xOffset, vec.yCoord * len - vec.yCoord * width, vec.zCoord * len - vec.zCoord * width);
tess.setColorRGBA_F(1F, 1F, 0F, 0.5F);
tess.addVertex(xOffset, vec.yCoord * len - vec.yCoord * width, vec.zCoord * len - vec.zCoord * width);
tess.addVertex(xOffset, vec.yCoord * len + vec.yCoord * width, vec.zCoord * len + vec.zCoord * width);
vec.rotateAroundXDeg(span);
tess.setColorRGBA_F(1F, 1F, 0F, 0.25F);
tess.addVertex(xOffset, vec.yCoord * len + vec.yCoord * width, vec.zCoord * len + vec.zCoord * width);
tess.addVertex(xOffset, vec.yCoord * len - vec.yCoord * width, vec.zCoord * len - vec.zCoord * width);
tess.setColorRGBA_F(1F, 1F, 0F, 0.25F);
tess.addVertex(xOffset, vec.yCoord * len - vec.yCoord * width, vec.zCoord * len - vec.zCoord * width);
tess.addVertex(xOffset, vec.yCoord * len + vec.yCoord * width, vec.zCoord * len + vec.zCoord * width);
vec.rotateAroundXDeg(span);
tess.setColorRGBA_F(1F, 1F, 0F, 0F);
tess.addVertex(xOffset, vec.yCoord * len + vec.yCoord * width, vec.zCoord * len + vec.zCoord * width);
tess.addVertex(xOffset, vec.yCoord * len - vec.yCoord * width, vec.zCoord * len - vec.zCoord * width);
}
}
tess.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glPopAttrib();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
renderSparkle(tile);
GL11.glPopMatrix();
if(speed > 0) renderZaps(tile);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
protected void renderSparkle(TileEntity tile) {
TileEntityBatteryREDD redd = (TileEntityBatteryREDD) tile;
long time = Clock.get_ms();
float alpha = 0.45F + (float) (Math.sin(time / 1000D) * 0.15F);
float alphaMult = redd.getSpeed() / 15F;
float r = 1.0F;
float g = 0.25F;
float b = 0.75F;
double mainOsc = BobMathUtil.sps(time / 1000D) % 1D;
double sparkleSpin = time / 250D * -1 % 1D;
double sparkleOsc = Math.sin(time / 1000D) * 0.5D % 1D;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDepthMask(false);
GL11.glColor4f(r, g, b, alpha * alphaMult);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
bindTexture(ResourceManager.fusion_plasma_tex);
GL11.glTranslated(0, mainOsc, 0);
ResourceManager.battery_redd.renderPart("Plasma");
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
// cost-cutting measure, don't render extra layers from more than 100m away
if(MainRegistry.proxy.me().getDistanceSq(tile.xCoord + 0.5, tile.yCoord + 2.5, tile.zCoord + 0.5) < 100 * 100) {
GL11.glColor4f(r * 2, g * 2, b * 2, 0.75F * alphaMult);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
bindTexture(ResourceManager.fusion_plasma_sparkle_tex);
GL11.glTranslated(sparkleSpin, sparkleOsc, 0);
ResourceManager.battery_redd.renderPart("Plasma");
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glPopAttrib();
GL11.glEnable(GL11.GL_CULL_FACE);
}
protected void renderZaps(TileEntity tile) {
Random rand = new Random(tile.getWorldObj().getTotalWorldTime() / 5);
rand.nextBoolean();
if(rand.nextBoolean()) {
GL11.glPushMatrix();
GL11.glTranslated(3.125, 5.5, 0);
BeamPronter.prontBeam(Vec3.createVectorHelper(-1.375, -2.625, 3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 15, 0.25F, 3, 0.0625F);
BeamPronter.prontBeam(Vec3.createVectorHelper(-1.375, -2.625, 3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 1, 0, 3, 0.0625F);
GL11.glPopMatrix();
}
if(rand.nextBoolean()) {
GL11.glPushMatrix();
GL11.glTranslated(-3.125, 5.5, 0);
BeamPronter.prontBeam(Vec3.createVectorHelper(1.375, -2.625, 3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 15, 0.25F, 3, 0.0625F);
BeamPronter.prontBeam(Vec3.createVectorHelper(1.375, -2.625, 3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 1, 0, 3, 0.0625F);
GL11.glPopMatrix();
}
if(rand.nextBoolean()) {
GL11.glPushMatrix();
GL11.glTranslated(3.125, 5.5, 0);
BeamPronter.prontBeam(Vec3.createVectorHelper(-1.375, -2.625, -3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 15, 0.25F, 3, 0.0625F);
BeamPronter.prontBeam(Vec3.createVectorHelper(-1.375, -2.625, -3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 1, 0, 3, 0.0625F);
GL11.glPopMatrix();
}
if(rand.nextBoolean()) {
GL11.glPushMatrix();
GL11.glTranslated(-3.125, 5.5, 0);
BeamPronter.prontBeam(Vec3.createVectorHelper(1.375, -2.625, -3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 15, 0.25F, 3, 0.0625F);
BeamPronter.prontBeam(Vec3.createVectorHelper(1.375, -2.625, -3.75), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x404040, 0x002040, (int)(System.currentTimeMillis() % 1000) / 50, 1, 0, 3, 0.0625F);
GL11.glPopMatrix();
}
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.machine_battery_redd);
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -3, 0);
GL11.glScaled(2.5, 2.5, 2.5);
}
public void renderCommon() {
GL11.glRotated(-90, 0, 1, 0);
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.battery_redd_tex);
ResourceManager.battery_redd.renderPart("Base");
ResourceManager.battery_redd.renderPart("Wheel");
GL11.glDisable(GL11.GL_LIGHTING);
ResourceManager.battery_redd.renderPart("Lights");
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_FLAT);
}};
}
}

View File

@ -9,6 +9,8 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
public class BeamPronter {
public static Random rand = new Random();
public static enum EnumWaveType {
RANDOM, SPIRAL
@ -51,7 +53,7 @@ public class BeamPronter {
Tessellator tessellator = Tessellator.instance;
Vec3 unit = Vec3.createVectorHelper(0, 1, 0);
Random rand = new Random(start);
rand.setSeed(start);
double length = skeleton.lengthVector();
double segLength = length / segments;
double lastX = 0;

View File

@ -82,6 +82,7 @@ public class TileMappings {
put(TileEntityDecoPoleSatelliteReceiver.class, "tileentity_satellitereceicer");
put(TileEntityMachineBattery.class, "tileentity_battery");
put(TileEntityBatterySocket.class, "tileentity_battery_socket");
put(TileEntityBatteryREDD.class, "tileentity_battery_redd");
put(TileEntityCapacitor.class, "tileentity_capacitor");
put(TileEntityMachineWoodBurner.class, "tileentity_wood_burner");
put(TileEntityRedBarrel.class, "tileentity_barrel");

View File

@ -28,8 +28,6 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos;
import com.hbm.util.i18n.I18nUtil;
import api.hbm.block.IDrillInteraction;
import api.hbm.block.IMiningDrill;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluid.IFluidStandardSender;
import cpw.mods.fml.relauncher.Side;
@ -53,7 +51,7 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineMiningLaser extends TileEntityMachineBase implements IEnergyReceiverMK2, IMiningDrill, IFluidStandardSender, IGUIProvider, IUpgradeInfoProvider {
public class TileEntityMachineMiningLaser extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardSender, IGUIProvider, IUpgradeInfoProvider {
public long power;
public int age = 0;
@ -325,17 +323,6 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
}
}
if(normal && b instanceof IDrillInteraction) {
IDrillInteraction in = (IDrillInteraction) b;
ItemStack drop = in.extractResource(worldObj, targetX, targetY, targetZ, meta, this);
if(drop != null) {
worldObj.spawnEntityInWorld(new EntityItem(worldObj, targetX + 0.5, targetY + 0.5, targetZ + 0.5, drop.copy()));
}
doesBreak = in.canBreak(worldObj, targetX, targetY, targetZ, meta, this);
}
if(doesBreak) {
if(normal) b.dropBlockAsItem(worldObj, targetX, targetY, targetZ, meta, fortune);
worldObj.func_147480_a(targetX, targetY, targetZ, false);
@ -464,106 +451,68 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
}
public int getRange() {
int range = 1;
for(int i = 1; i < 9; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_effect_1)
range += 2;
else if(slots[i].getItem() == ModItems.upgrade_effect_2)
range += 4;
else if(slots[i].getItem() == ModItems.upgrade_effect_3)
range += 6;
if(slots[i].getItem() == ModItems.upgrade_effect_1) range += 2;
else if(slots[i].getItem() == ModItems.upgrade_effect_2) range += 4;
else if(slots[i].getItem() == ModItems.upgrade_effect_3) range += 6;
}
}
return Math.min(range, 25);
}
public boolean hasNullifier() {
for(int i = 1; i < 9; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_nullifier)
return true;
if(slots[i].getItem() == ModItems.upgrade_nullifier) return true;
}
}
return false;
}
public boolean hasSmelter() {
for(int i = 1; i < 9; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_smelter)
return true;
if(slots[i].getItem() == ModItems.upgrade_smelter) return true;
}
}
return false;
}
public boolean hasShredder() {
for(int i = 1; i < 9; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_shredder)
return true;
if(slots[i].getItem() == ModItems.upgrade_shredder) return true;
}
}
return false;
}
public boolean hasCentrifuge() {
for(int i = 1; i < 9; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_centrifuge)
return true;
if(slots[i].getItem() == ModItems.upgrade_centrifuge) return true;
}
}
return false;
}
public boolean hasCrystallizer() {
for(int i = 1; i < 9; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_crystallizer)
return true;
if(slots[i].getItem() == ModItems.upgrade_crystallizer) return true;
}
}
return false;
}
public boolean doesScream() {
for(int i = 1; i < 9; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_screm)
return true;
if(slots[i].getItem() == ModItems.upgrade_screm) return true;
}
}
return false;
}
@ -646,6 +595,7 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
super.readFromNBT(nbt);
tank.readFromNBT(nbt, "oil");
power = nbt.getLong("power");
isOn = nbt.getBoolean("isOn");
redstonePowered = false;
}
@ -655,19 +605,10 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
super.writeToNBT(nbt);
tank.writeToNBT(nbt, "oil");
nbt.setLong("power", power);
nbt.setBoolean("isOn", isOn);
}
@Override
public DrillType getDrillTier() {
return DrillType.HITECH;
}
@Override
public int getDrillRating() {
return 100;
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] { tank };

View File

@ -68,9 +68,13 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
feed.setFill(feed.getFill() - step.amountReq * ops);
steam.setFill(steam.getFill() + step.amountProduced * ops);
this.heat -= (step.heatReq * ops / TU_PER_DEGREE) * trait.getEfficiency(HeatingType.HEATEXCHANGER);
} else {
feed.setTankType(Fluids.NONE);
steam.setTankType(Fluids.NONE);
}
} else {
feed.setTankType(Fluids.NONE);
steam.setTankType(Fluids.NONE);
}

View File

@ -0,0 +1,184 @@
package com.hbm.tileentity.machine.storage;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.uninos.UniNodespace;
import com.hbm.util.EnumUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energymk2.IBatteryItem;
import api.hbm.energymk2.IEnergyConductorMK2;
import api.hbm.energymk2.IEnergyProviderMK2;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.energymk2.Nodespace;
import api.hbm.energymk2.Nodespace.PowerNode;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
public abstract class TileEntityBatteryBase extends TileEntityMachineBase implements IEnergyConductorMK2, IEnergyProviderMK2, IEnergyReceiverMK2, IControlReceiver, IGUIProvider {
public byte lastRedstone = 0;
public long prevPowerState = 0;
public static final int mode_input = 0;
public static final int mode_buffer = 1;
public static final int mode_output = 2;
public static final int mode_none = 3;
public short redLow = 0;
public short redHigh = 2;
public ConnectionPriority priority = ConnectionPriority.LOW;
protected PowerNode node;
public TileEntityBatteryBase(int slotCount) {
super(slotCount);
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
if(priority == null || priority.ordinal() == 0 || priority.ordinal() == 4) {
priority = ConnectionPriority.LOW;
}
if(this.node == null || this.node.expired) {
this.node = (PowerNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
if(this.node == null || this.node.expired) {
this.node = this.createNode();
UniNodespace.createNode(worldObj, this.node);
}
}
if(this.node != null && this.node.hasValidNet()) switch(this.getRelevantMode(false)) {
case mode_input: this.node.net.removeProvider(this); this.node.net.addReceiver(this); break;
case mode_output: this.node.net.addProvider(this); this.node.net.removeReceiver(this); break;
case mode_buffer: this.node.net.addProvider(this); this.node.net.addReceiver(this); break;
case mode_none: this.node.net.removeProvider(this); this.node.net.removeReceiver(this); break;
}
byte comp = this.getComparatorPower();
if(comp != this.lastRedstone) this.markDirty();
this.lastRedstone = comp;
prevPowerState = this.getPower();
this.networkPackNT(100);
}
}
public byte getComparatorPower() {
double frac = (double) this.getPower() / (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 PowerNode createNode() {
return new PowerNode(this.getPortPos()).setConnections(this.getConPos());
}
@Override
public void invalidate() {
super.invalidate();
if(!worldObj.isRemote) {
if(this.node != null) {
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
}
}
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
return stack.getItem() instanceof IBatteryItem;
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
buf.writeShort(redLow);
buf.writeShort(redHigh);
buf.writeByte(priority.ordinal());
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
redLow = buf.readShort();
redHigh = buf.readShort();
priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, buf.readByte());
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.redLow = nbt.getShort("redLow");
this.redHigh = nbt.getShort("redHigh");
this.lastRedstone = nbt.getByte("lastRedstone");
this.priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, nbt.getByte("priority"));
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setShort("redLow", redLow);
nbt.setShort("redHigh", redHigh);
nbt.setByte("lastRedstone", lastRedstone);
nbt.setByte("priority", (byte) this.priority.ordinal());
}
@Override public boolean allowDirectProvision() { return false; }
@Override public ConnectionPriority getPriority() { return this.priority; }
public abstract BlockPos[] getPortPos();
public abstract DirPos[] getConPos();
private short modeCache = 0;
public short getRelevantMode(boolean useCache) {
if(useCache) return this.modeCache;
boolean powered = false;
for(BlockPos pos : getPortPos()) if(worldObj.isBlockIndirectlyGettingPowered(pos.getX(), pos.getY(), pos.getZ())) { powered = true; break; }
this.modeCache = powered ? this.redHigh : this.redLow;
return this.modeCache;
}
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("low")) {
this.redLow++;
if(this.redLow > 3) this.redLow = 0;
}
if(data.hasKey("high")) {
this.redHigh++;
if(this.redHigh > 3) this.redHigh = 0;
}
if(data.hasKey("priority")) {
int ordinal = this.priority.ordinal();
ordinal++;
if(ordinal > ConnectionPriority.HIGH.ordinal()) ordinal = ConnectionPriority.LOW.ordinal();
this.priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, ordinal);
}
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

View File

@ -0,0 +1,219 @@
package com.hbm.tileentity.machine.storage;
import java.math.BigInteger;
import com.hbm.inventory.container.ContainerBatteryREDD;
import com.hbm.inventory.gui.GUIBatteryREDD;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.sound.AudioWrapper;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityBatteryREDD extends TileEntityBatteryBase {
public float prevRotation = 0F;
public float rotation = 0F;
public BigInteger[] log = new BigInteger[20];
public BigInteger delta = BigInteger.valueOf(0);
public BigInteger power = BigInteger.valueOf(0);
private AudioWrapper audio;
public TileEntityBatteryREDD() {
super(2);
}
@Override public String getName() { return "container.batteryREDD"; }
@Override
public void updateEntity() {
BigInteger prevPower = new BigInteger(power.toByteArray());
super.updateEntity();
if(!worldObj.isRemote) {
long toAdd = Library.chargeTEFromItems(slots, 0, 0, this.getMaxPower());
if(toAdd > 0) this.power = this.power.add(BigInteger.valueOf(toAdd));
long toRemove = this.getPower() - Library.chargeItemsFromTE(slots, 1, this.getPower(), this.getMaxPower());
if(toRemove > 0)this.power = this.power.subtract(BigInteger.valueOf(toRemove));
// same implementation as for batteries, however retooled to use bigints because fuck
BigInteger avg = this.power.add(prevPower).divide(BigInteger.valueOf(2));
this.delta = avg.subtract(this.log[0] == null ? BigInteger.ZERO : this.log[0]);
for(int i = 1; i < this.log.length; i++) {
this.log[i - 1] = this.log[i];
}
this.log[19] = avg;
} else {
this.prevRotation = this.rotation;
this.rotation += this.getSpeed();
if(rotation >= 360) {
rotation -= 360;
prevRotation -= 360;
}
float pitch = 0.5F + this.getSpeed() / 15F * 1.5F;
if(this.prevRotation != this.rotation && MainRegistry.proxy.me().getDistanceSq(xCoord + 0.5, yCoord + 5.5, zCoord + 0.5) < 50 * 50) {
if(this.audio == null || !this.audio.isPlaying()) {
this.audio = MainRegistry.proxy.getLoopedSound("hbm:block.fensuHum", xCoord, yCoord, zCoord, this.getVolume(1.5F), 25F, pitch, 5);
this.audio.startSound();
}
this.audio.updatePitch(pitch);
this.audio.keepAlive();
} else {
if(this.audio != null) {
this.audio.stopSound();
this.audio = null;
}
}
}
}
public float getSpeed() {
return (float) Math.min(Math.pow(Math.log(this.power.doubleValue() * 0.05 + 1) * 0.05F, 5), 15F);
}
@Override
public void onChunkUnload() {
super.onChunkUnload();
if(audio != null) {
audio.stopSound();
audio = null;
}
}
@Override
public void invalidate() {
super.invalidate();
if(audio != null) {
audio.stopSound();
audio = null;
}
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
byte[] array0 = this.power.toByteArray();
buf.writeInt(array0.length);
for(byte b : array0) buf.writeByte(b);
byte[] array1 = this.delta.toByteArray();
buf.writeInt(array1.length);
for(byte b : array1) buf.writeByte(b);
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
byte[] array0 = new byte[buf.readInt()];
for(int i = 0 ; i < array0.length; i++) array0[i] = buf.readByte();
this.power = new BigInteger(array0);
byte[] array1 = new byte[buf.readInt()];
for(int i = 0 ; i < array1.length; i++) array1[i] = buf.readByte();
this.delta = new BigInteger(array1);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.power = new BigInteger(nbt.getByteArray("power"));
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setByteArray("power", this.power.toByteArray());
}
@Override
public BlockPos[] getPortPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new BlockPos[] {
new BlockPos(xCoord + dir.offsetX * 2 + rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * 2),
new BlockPos(xCoord + dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2 - rot.offsetZ * 2),
new BlockPos(xCoord - dir.offsetX * 2 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 2),
new BlockPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2),
new BlockPos(xCoord + rot.offsetX * 4, yCoord, zCoord + rot.offsetZ * 4),
new BlockPos(xCoord - rot.offsetX * 4, yCoord, zCoord - rot.offsetZ * 4),
};
}
@Override
public DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + dir.offsetX * 3 + rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 3 + rot.offsetZ * 2, dir),
new DirPos(xCoord + dir.offsetX * 3 - rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 3 - rot.offsetZ * 2, dir),
new DirPos(xCoord - dir.offsetX * 3 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 3 + rot.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord - dir.offsetX * 3 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 3 - rot.offsetZ * 2, dir.getOpposite()),
new DirPos(xCoord + rot.offsetX * 5, yCoord, zCoord + rot.offsetZ * 5, rot),
new DirPos(xCoord - rot.offsetX * 5, yCoord, zCoord - rot.offsetZ * 5, rot.getOpposite()),
};
}
@Override
public void usePower(long power) {
this.power = this.power.subtract(BigInteger.valueOf(power));
}
@Override
public long transferPower(long power) {
this.power = this.power.add(BigInteger.valueOf(power));
return 0L;
}
@Override public long getPower() { return this.power.min(BigInteger.valueOf(getMaxPower() / 2)).longValue(); } // for provision
@Override public void setPower(long power) { } // not needed since we use transferPower and usePower directly
@Override public long getMaxPower() { return Long.MAX_VALUE / 100L; } // for connection speed
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerBatteryREDD(player.inventory, this); }
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIBatteryREDD(player.inventory, this); }
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 4,
yCoord,
zCoord - 4,
xCoord + 5,
yCoord + 10,
zCoord + 5
);
}
return bb;
}
}

View File

@ -1,52 +1,26 @@
package com.hbm.tileentity.machine.storage;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerBatterySocket;
import com.hbm.inventory.gui.GUIBatterySocket;
import com.hbm.items.ModItems;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.uninos.UniNodespace;
import com.hbm.util.EnumUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energymk2.IBatteryItem;
import api.hbm.energymk2.IEnergyConductorMK2;
import api.hbm.energymk2.IEnergyProviderMK2;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.energymk2.Nodespace;
import api.hbm.energymk2.Nodespace.PowerNode;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityBatterySocket extends TileEntityMachineBase implements IEnergyConductorMK2, IEnergyProviderMK2, IEnergyReceiverMK2, IControlReceiver, IGUIProvider {
public class TileEntityBatterySocket extends TileEntityBatteryBase {
public long[] log = new long[20];
public long delta = 0;
public byte lastRedstone = 0;
public long prevPowerState = 0;
public static final int mode_input = 0;
public static final int mode_buffer = 1;
public static final int mode_output = 2;
public static final int mode_none = 3;
public short redLow = 0;
public short redHigh = 2;
public ConnectionPriority priority = ConnectionPriority.LOW;
public int renderPack = -1;
protected PowerNode node;
public TileEntityBatterySocket() {
super(1);
@ -56,36 +30,12 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
@Override
public void updateEntity() {
long prevPower = this.getPower();
super.updateEntity();
if(!worldObj.isRemote) {
if(priority == null || priority.ordinal() == 0 || priority.ordinal() == 4) {
priority = ConnectionPriority.LOW;
}
long prevPower = this.getPower();
if(this.node == null || this.node.expired) {
this.node = (PowerNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
if(this.node == null || this.node.expired) {
this.node = this.createNode();
UniNodespace.createNode(worldObj, this.node);
}
}
if(this.node != null && this.node.hasValidNet()) switch(this.getRelevantMode(false)) {
case mode_input: this.node.net.removeProvider(this); this.node.net.addReceiver(this); break;
case mode_output: this.node.net.addProvider(this); this.node.net.removeReceiver(this); break;
case mode_buffer: this.node.net.addProvider(this); this.node.net.addReceiver(this); break;
case mode_none: this.node.net.removeProvider(this); this.node.net.removeReceiver(this); break;
}
byte comp = this.getComparatorPower();
if(comp != this.lastRedstone) this.markDirty();
this.lastRedstone = comp;
long avg = (this.getPower() + prevPower) / 2;
this.delta = avg - this.log[0];
@ -94,31 +44,6 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
}
this.log[19] = avg;
prevPowerState = this.getPower();
this.networkPackNT(100);
}
}
@Override
public PowerNode createNode() {
return new PowerNode(this.getPortPos()).setConnections(this.getConPos());
}
public byte getComparatorPower() {
double frac = (double) this.getPower() / (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 invalidate() {
super.invalidate();
if(!worldObj.isRemote) {
if(this.node != null) {
UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER);
}
}
}
@ -130,43 +55,15 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
if(slots[0] != null && slots[0].getItem() == ModItems.battery_pack) {
renderPack = slots[0].getItemDamage();
}
buf.writeInt(renderPack);
buf.writeLong(delta);
buf.writeShort(redLow);
buf.writeShort(redHigh);
buf.writeByte(priority.ordinal());
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
renderPack = buf.readInt();
delta = buf.readLong();
redLow = buf.readShort();
redHigh = buf.readShort();
priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, buf.readByte());
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.redLow = nbt.getShort("redLow");
this.redHigh = nbt.getShort("redHigh");
this.lastRedstone = nbt.getByte("lastRedstone");
this.priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, nbt.getByte("priority"));
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setShort("redLow", redLow);
nbt.setShort("redHigh", redHigh);
nbt.setByte("lastRedstone", lastRedstone);
nbt.setByte("priority", (byte) this.priority.ordinal());
}
@Override
@ -178,11 +75,6 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
return false;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
return stack.getItem() instanceof IBatteryItem;
}
@Override public int[] getAccessibleSlotsFromSide(int side) { return new int[] {0}; }
@Override
@ -203,9 +95,6 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
return ((IBatteryItem) slots[0].getItem()).getMaxCharge(slots[0]);
}
@Override public boolean allowDirectProvision() { return false; }
@Override public ConnectionPriority getPriority() { return this.priority; }
@Override public long getProviderSpeed() {
if(slots[0] == null || !(slots[0].getItem() instanceof IBatteryItem)) return 0;
int mode = this.getRelevantMode(true);
@ -217,7 +106,8 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
int mode = this.getRelevantMode(true);
return mode == mode_input || mode == mode_buffer ? ((IBatteryItem) slots[0].getItem()).getChargeRate(slots[0]) : 0;
}
@Override
public BlockPos[] getPortPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
@ -229,6 +119,7 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
};
}
@Override
public DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
@ -247,38 +138,8 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
};
}
private short modeCache = 0;
public short getRelevantMode(boolean useCache) {
if(useCache) return this.modeCache;
boolean powered = false;
for(BlockPos pos : getPortPos()) if(worldObj.isBlockIndirectlyGettingPowered(pos.getX(), pos.getY(), pos.getZ())) { powered = true; break; }
this.modeCache = powered ? this.redHigh : this.redLow;
return this.modeCache;
}
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerBatterySocket(player.inventory, this); }
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIBatterySocket(player.inventory, this); }
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("low")) {
this.redLow++;
if(this.redLow > 3) this.redLow = 0;
}
if(data.hasKey("high")) {
this.redHigh++;
if(this.redHigh > 3) this.redHigh = 0;
}
if(data.hasKey("priority")) {
int ordinal = this.priority.ordinal();
ordinal++;
if(ordinal > ConnectionPriority.HIGH.ordinal()) ordinal = ConnectionPriority.LOW.ordinal();
this.priority = EnumUtil.grabEnumSafely(ConnectionPriority.class, ordinal);
}
}
AxisAlignedBB bb = null;
@ -298,10 +159,4 @@ public class TileEntityBatterySocket extends TileEntityMachineBase implements IE
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

View File

@ -322,6 +322,7 @@ container.autocrafter=Automatische Werkbank
container.barrel=Fass
container.bat9000=Big-Ass Tank 9000
container.battery=Energiespeicher
container.batteryREDD=FEnSU
container.batterySocket=Batteriesockel
container.bombMulti=Mehrzweckbombe
container.casingBag=Hülsentasche
@ -4056,13 +4057,13 @@ tile.c4.name=C4
tile.cable_detector.name=Redstone-Stromschalter
tile.cable_diode.name=Rote Kupferdiode
tile.cable_switch.name=Stromschalter
tile.capacitor_bus.name=Kondensator-Bus
tile.capacitor_bus.name=Kondensator-Bus (LEGACY)
tile.capacitor_bus.desc=Output für Kondensatoren$Kann in einer geraden Linie aneinandergereit werden
tile.capacitor_copper.name=Kupferkondensator
tile.capacitor_gold.name=Goldkondensator
tile.capacitor_niobium.name=Niobkondensator
tile.capacitor_schrabidate.name=Schrabidatkondensator
tile.capacitor_tantalium.name=Tantalkondensator
tile.capacitor_copper.name=Alter Kondensator
tile.capacitor_gold.name=Goldkondensator (LEGACY)
tile.capacitor_niobium.name=Niobkondensator (LEGACY)
tile.capacitor_schrabidate.name=Schrabidatkondensator (LEGACY)
tile.capacitor_tantalium.name=Tantalkondensator (LEGACY)
tile.capacitor.desc=Input: Oben$Output: Unten, über Kondensator-Bus
tile.charge_c4.name=Abrissladung
tile.charge_dynamite.name=Zeitbombe
@ -4469,8 +4470,9 @@ tile.machine_autosaw.name=Automatische Kreissäge
tile.machine_autosaw.desc=Schneidet Pflanzen nieder, pflanzt Bäume nach$Akzeptiert:$-Holzöl$-Ethanol$-Fischöl$-Schweröl
tile.machine_autosaw.suspended=Angehalten
tile.machine_bat9000.name=Big-Ass Tank 9000
tile.machine_battery.name=Energiespeicherblock
tile.machine_battery_potato.name=Kartoffelbatterieblock
tile.machine_battery.name=Energiespeicherblock (LEGACY)
tile.machine_battery_potato.name=Kartoffelbatterieblock (LEGACY)
tile.machine_battery_redd.name=FEnSU
tile.machine_battery_socket.name=Batteriesockel
tile.machine_boiler.name=Boiler
tile.machine_boiler.desc=Großer Boiler zum Verdampfen von Wasser oder$Erhitzen von Öl. Benötigt externe Hitzequelle.$Wärmestransferrate: ΔT*0.01 TU/t
@ -4513,7 +4515,7 @@ tile.machine_difurnace_off.name=Hochofen
tile.machine_difurnace_on.name=Hochofen
tile.machine_difurnace_rtg_off.name=Atomarer Hochofen
tile.machine_difurnace_rtg_on.name=Atomarer Hochofen
tile.machine_dineutronium_battery.name=Spark Energiespeicherblock
tile.machine_dineutronium_battery.name=Spark Energiespeicherblock (LEGACY)
tile.machine_drain.name=Ausgussrohr
tile.machine_drill.name=Automatischer Minenbohrer
tile.machine_electric_furnace_off.name=Elektrischer Ofen
@ -4523,7 +4525,7 @@ tile.machine_epress.name=Hydraulische Presse
tile.machine_exposure_chamber.name=Bestrahlungskammer
tile.machine_excavator.name=Großer Minenbohrer
tile.machine_fel.name=FEL
tile.machine_fensu.name=FEnSU
tile.machine_fensu.name=FEnSU (LEGACY)
tile.machine_flare.name=Abfackelturm
tile.machine_fluidtank.name=Tank
tile.machine_forcefield.name=Kraftfeldgenerator
@ -4543,7 +4545,7 @@ tile.machine_intake.name=Lufteinlass
tile.machine_keyforge.name=Schlossertisch
tile.machine_large_turbine.name=Industrielle Dampfturbine
tile.machine_large_turbine.desc=Effizienz: 100%%
tile.machine_lithium_battery.name=Li-Ion-Energiespeicherblock
tile.machine_lithium_battery.name=Li-Ion-Energiespeicherblock (LEGACY)
tile.machine_microwave.name=Mikrowelle
tile.machine_mining_laser.name=Bergbaulaser
tile.machine_minirtg.name=Radioisotopenzelle
@ -4583,7 +4585,7 @@ tile.machine_rtg_yellow.name=Australium Supergenerator
tile.machine_satlinker.name=Satelliten-ID-Manager
tile.machine_sawmill.name=Stirling-Sägemühle
tile.machine_sawmill.desc=Benötigt externe Hitzequelle.$Wärmestransferrate: T*0.1 TU/t$Minimalaufnahme: 100 TU/t, Maximalaufnahme: 300 TU/t
tile.machine_schrabidium_battery.name=Schrabidium-Energiespeicherblock
tile.machine_schrabidium_battery.name=Schrabidium-Energiespeicherblock (LEGACY)
tile.machine_schrabidium_transmutator.name=Schrabidium-Transmutationsgerät (LEGACY)
tile.machine_selenium.name=Hochleistungs-Sternmotor
tile.machine_shredder.name=Brecher

View File

@ -727,6 +727,7 @@ container.autocrafter=Automatic Crafting Table
container.barrel=Barrel
container.bat9000=Big-Ass Tank 9000
container.battery=Energy Storage
container.batteryREDD=FEnSU
container.batterySocket=Battery Socket
container.bombMulti=Multi Purpose Bomb
container.casingBag=Bullet Casing Bag
@ -5272,13 +5273,13 @@ tile.c4.name=C-4
tile.cable_detector.name=Redstone Power Switch
tile.cable_diode.name=Red Copper Diode
tile.cable_switch.name=Power Switch
tile.capacitor_bus.name=Capacitor Bus
tile.capacitor_bus.name=Capacitor Bus (LEGACY)
tile.capacitor_bus.desc=Output block for capacitors$Can be chained up in a straight line
tile.capacitor_copper.name=Copper Capacitor
tile.capacitor_gold.name=Golden Capacitor
tile.capacitor_niobium.name=Niobium Capacitor
tile.capacitor_schrabidate.name=Schrabidate Capacitor
tile.capacitor_tantalium.name=Tantalum Capacitor
tile.capacitor_copper.name=Old Capacitor
tile.capacitor_gold.name=Golden Capacitor (LEGACY)
tile.capacitor_niobium.name=Niobium Capacitor (LEGACY)
tile.capacitor_schrabidate.name=Schrabidate Capacitor (LEGACY)
tile.capacitor_tantalium.name=Tantalum Capacitor (LEGACY)
tile.capacitor.desc=Input: Top$Output: Bottom, via Capacitor Bus
tile.charge_c4.name=Demolition Charge
tile.charge_dynamite.name=Time Bomb
@ -5730,8 +5731,9 @@ tile.machine_autosaw.name=Automatic Buzz Saw
tile.machine_autosaw.desc=Cuts down nearby plants, re-plants trees$Accepts:$-Wood oil$-Ethanol$-Fish oil$-Heavy oil
tile.machine_autosaw.suspended=Suspended
tile.machine_bat9000.name=Big-Ass Tank 9000
tile.machine_battery.name=Energy Storage Block
tile.machine_battery_potato.name=Potato Battery Block
tile.machine_battery.name=Energy Storage Block (LEGACY)
tile.machine_battery_potato.name=Potato Battery Block (LEGACY)
tile.machine_battery_redd.name=FEnSU
tile.machine_battery_socket.name=Battery Socket
tile.machine_boiler.name=Boiler
tile.machine_boiler.desc=Large boiler that can boil water or heat up oil.$Requires external heat source.$Heat transfer rate: ΔT*0.01 TU/t
@ -5775,7 +5777,7 @@ tile.machine_difurnace_off.name=Blast Furnace
tile.machine_difurnace_on.name=Blast Furnace
tile.machine_difurnace_rtg_off.name=Nuclear Blast Furnace
tile.machine_difurnace_rtg_on.name=Nuclear Blast Furnace
tile.machine_dineutronium_battery.name=Spark Energy Storage Block
tile.machine_dineutronium_battery.name=Spark Energy Storage Block (LEGACY)
tile.machine_drain.name=Drainage Pipe
tile.machine_drill.name=Automatic Mining Drill
tile.machine_electric_furnace_off.name=Electric Furnace
@ -5785,7 +5787,7 @@ tile.machine_epress.name=Electric Press
tile.machine_excavator.name=Large Mining Drill
tile.machine_exposure_chamber.name=Exposure Chamber
tile.machine_fel.name=FEL
tile.machine_fensu.name=FEnSU
tile.machine_fensu.name=FEnSU (LEGACY)
tile.machine_flare.name=Flare Stack
tile.machine_fluidtank.name=Tank
tile.machine_forcefield.name=Forcefield Emitter
@ -5808,7 +5810,7 @@ tile.machine_large_turbine.name=Industrial Steam Turbine
tile.machine_large_turbine.desc=Efficiency: 100%%
tile.machine_liquefactor.name=Industrial Liquefaction Machine
tile.machine_liquefactor.desc=Powerful universal machine to turn items into fluids.$Comes with versatile catalytic components, heating elements$and a built-in hydrator for petrochemical liquefaction.
tile.machine_lithium_battery.name=Li-Ion Energy Storage Block
tile.machine_lithium_battery.name=Li-Ion Energy Storage Block (LEGACY)
tile.machine_microwave.name=Microwave
tile.machine_mining_laser.name=Mining Laser
tile.machine_minirtg.name=Radio Isotope Cell
@ -5848,7 +5850,7 @@ tile.machine_rtg_yellow.name=Australium Superfuel Reactor
tile.machine_satlinker.name=Satellite ID Manager
tile.machine_sawmill.name=Stirling Sawmill
tile.machine_sawmill.desc=Requires external heat source.$Heat transfer rate: T*0.1 TU/t$Min intake: 100 TU/t, Max intake: 300 TU/t
tile.machine_schrabidium_battery.name=Schrabidium Energy Storage Block
tile.machine_schrabidium_battery.name=Schrabidium Energy Storage Block (LEGACY)
tile.machine_schrabidium_transmutator.name=Schrabidium Transmutation Device (LEGACY)
tile.machine_selenium.name=Radial Performance Engine
tile.machine_shredder.name=Shredder

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,7 @@
"block.largeTurbineRunning": {"category": "block", "sounds": [{"name": "block/largeTurbine", "stream": false}]},
"block.damage": {"category": "block", "sounds": ["block/dam1", "block/dam2", "block/dam3", "block/dam4"]},
"block.electricHum": {"category": "block", "sounds": [{"name": "block/electricHum", "stream": false}]},
"block.fensuHum": {"category": "block", "sounds": [{"name": "block/fensuHum", "stream": false}]},
"block.boiler": {"category": "block", "sounds": [{"name": "block/boiler", "stream": false}]},
"block.hornNearSingle": {"category": "block", "sounds": [{"name": "block/hornNearSingle", "stream": false}]},
"block.hornNearDual": {"category": "block", "sounds": [{"name": "block/hornNearDual", "stream": false}]},

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB