This commit is contained in:
HbmMods 2026-06-08 21:26:27 +02:00
parent 3588457cd0
commit 7e44f0f847
9 changed files with 93 additions and 42 deletions

View File

@ -1,28 +1,3 @@
## Changed
* Removed advanced alloy
* All recipes that used to have AA in it now use something else
* AA tools and armor remain for now, although they are uncraftable
* Steel and titanium armor now have some DT and DR, making them roughly on-par with the old AA
* Buffed durability for steel and titanium tool materials
* Steel tools now deal more damage (still not as much as titanium) and has diamond harvest level
* AA custom machine blocks have been replaced with bronze ones which make more sense in progression, since AA was too close to steel anyway
* Renamed "worker's alloy" to "desh" to avoid confusion
* Seriously why did this have two names?
* Industrial grade and minecraft grade copper ingots now have the "ingot" suffix
* Changed the microchip assembler recipe duration so that it matches with the demand of one soldering station
* Blast furnace speed with hot air blast can now be increased to 500% (uses the same amount of hot air blast as before)
## Fixed
* AUTOCAL
* Fixed `listen` command failing if the buffer is empty
* Fixed variable substitution failing when there is a trailing $ sign
* Fixed concat prefixing all output with "t " for some reason
* Eval(r) now uses a special mode for variable substitution that forces empty variables to be interpreted as "0"
* Fixed things not intended to be used in the blast furnace (scrap, lava) being usable fuels
* Fixed blast furnace swallowing container items left behind by fuels, instead fuels with containers will not be accepted at all
* Fixed the blast furnace NEI screen listing "0 HE" for every recipe even though it's not an electric machine
* Fixed flue gas not having an inventory texture
* Potentially fixed issue with Angelica where tile entity culling would cause cargo elevators to not render on certain angles
* Fixed the blast furnace not performing stack size checks correctly, outputting items when it shouldn't
* Fixed cargo elevators not rendering past a distance of 100 blocks
* Fixed cargo elevator syncing range being only 100 blocks, meaning that elevators taller than that don't work properly
* Updated chinese localization
* Watz powerplant now has OC and RoR integration

View File

@ -21,6 +21,9 @@ public interface ISlotMonitorProvider {
/** Returns the amount of that slot at that index. Some storages may use int64 datatypes so we have to account for those too somehow, since ItemStacks cannot handle that. */
public long getAmountAt(int index);
/** Removes the given number of items from that slot, returns the amount left to remove if the stack was smaller than the supplied amount */
public long useUpItem(int index, long amount);
/** Whether this storage unit is reachable by the access point */
public boolean isAvailableToCache(StackCache cache);

View File

@ -103,8 +103,6 @@ public class SlotMonitor {
if(hasTypeChanged) {
System.out.println("Type changed!");
// remove from all existing monitors
Iterator<CacheSlot> iterator = viewedBy.iterator();
while(iterator.hasNext()) {
@ -130,8 +128,6 @@ public class SlotMonitor {
// find new monitors
if(pneumoNet != null) {
System.out.println("Adding to new network...");
for(StackCache cache : pneumoNet.accessors) {
System.out.println("Adding to cache...");
if(!cache.hasExpired && parent.isAvailableToCache(cache)) {

View File

@ -46,6 +46,29 @@ public class StackCache {
cache.addMonitor(monitor);
}
public CacheSlot getSlotFromStack(ItemStack stack) {
return getSlotFromStack(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
}
public CacheSlot getSlotFromStack(Item item, int meta, NBTTagCompound nbt) {
long monitorIdentity = getStackIdentity(item, meta, nbt);
return cacheSlots.get(monitorIdentity);
}
/** Uses up items and returns how many of the requested items could be removed, with no desyncs that number should always be equal to the supplied amount */
public long consumeItemsAndReturnQuantity(ItemStack stack, long amount) {
CacheSlot cache = getSlotFromStack(stack);
if(cache == null) return 0;
long originalAmount = amount;
for(SlotMonitor monitor : cache.monitors) {
amount = monitor.parent.useUpItem(monitor.index, amount);
if(amount <= 0) break;
}
return originalAmount - amount;
}
public void dissolveCache() {
for(Entry<Long, CacheSlot> cacheEntry : cacheSlots.entrySet()) {
cacheEntry.getValue().destroy();

View File

@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerPneumoStorageAccess extends Container {
@ -22,13 +23,15 @@ public class ContainerPneumoStorageAccess extends Container {
protected TileEntityPneumoStorageAccess access;
protected InventoryPneumoStorageAccess inventory;
public static final String STACK_SIZE_KEY = "PNEUMO_STACK_SIZE";
public ContainerPneumoStorageAccess(InventoryPlayer invPlayer, TileEntityPneumoStorageAccess access) {
this.access = access;
this.inventory = new InventoryPneumoStorageAccess(access);
for(int i = 0; i < 6; i++) {
for(int j = 0; j < 8; j++) {
this.addSlotToContainer(new SlotNonRetarded(inventory, j + i * 8, 8 + j * 18, 17 + i * 18));
this.addSlotToContainer(new SlotNonRetarded(inventory, j + i * 8, 8 + j * 18, 17 + i * 18)); // TODO: add a new slot type that holds a long for the amount
}
}
@ -51,6 +54,38 @@ public class ContainerPneumoStorageAccess extends Container {
return access.getDistanceFrom(player.posX, player.posY, player.posZ) <= 15 * 15;
}
@Override
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
if(index >= 0 && index < 6 * 8) {
boolean client = player.worldObj.isRemote;
Slot slot = this.getSlot(index);
ItemStack held = player.inventory.getItemStack();
if(held == null && slot.getHasStack() && slot.getStack().hasTagCompound()) {
ItemStack stack = slot.getStack().copy();
if(button == 0) {
int toGrab = (int) Math.min(stack.getMaxStackSize(), stack.stackTagCompound.getLong(STACK_SIZE_KEY));
if(client) {
stack.stackSize = toGrab;
player.inventory.setItemStack(stack);
} else {
if(this.access.cache == null || this.access.cache.hasExpired) return stack;
StackCache cache = this.access.cache;
stack.stackSize = (int) cache.consumeItemsAndReturnQuantity(stack, toGrab); // this can't work because the stack got altered with the description NBT.....
player.inventory.setItemStack(stack);
}
}
return slot.getStack().copy();
}
}
return super.slotClick(index, button, mode, player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
return null;
@ -81,6 +116,7 @@ public class ContainerPneumoStorageAccess extends Container {
if(cache.displayStack != null) {
slots[i] = cache.displayStack.copy();
ItemStackUtil.addTooltipToStack(slots[i], "x" + cache.stacksize, "in " + cache.monitors.size() + " stacks");
slots[i].stackTagCompound.setLong(STACK_SIZE_KEY, cache.stacksize); // TODO instead of altering the stacks so we can't resolve anything anymore, hijack the progress bar system
}
}
}

View File

@ -63,8 +63,11 @@ public class BlastFurnaceRecipesNT extends GenericRecipes<BlastFurnaceRecipe> {
.inputItems(new OreDictStack(CO.ingot()), new ComparableStack(ModItems.meteorite_sword_hardened, 1))
.outputItems(new ItemStack(ModItems.meteorite_sword_alloyed, 1)));
this.register((BlastFurnaceRecipe) new BlastFurnaceRecipe("blast.meteor").setDuration(600)
.inputItems(new OreDictStack(CO.ingot()), new ComparableStack(ModItems.powder_meteorite, 1))
.outputItems(new ItemStack(ModItems.ingot_meteorite, 1)));
this.register((BlastFurnaceRecipe) new BlastFurnaceRecipe("blast.starmetal").setDuration(600)
.inputItems(new OreDictStack(BIGMT.ingot()), new ComparableStack(ModItems.powder_meteorite, 1))
.inputItems(new OreDictStack(BIGMT.ingot()), new ComparableStack(ModItems.ingot_meteorite, 1))
.outputItems(new ItemStack(ModItems.ingot_starmetal, 1)));
this.register((BlastFurnaceRecipe) new BlastFurnaceRecipe("blast.paa").setDuration(600)

View File

@ -35,12 +35,10 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import api.hbm.redstoneoverradio.IRORInteractive;
import api.hbm.redstoneoverradio.IRORValueProvider;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.SimpleComponent;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@ -54,7 +52,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityWatz extends TileEntityMachineBase implements IFluidStandardTransceiver, IControlReceiver, IGUIProvider, IFluidCopiable, CompatHandler.OCComponent, IRORValueProvider, IRORInteractive {
public class TileEntityWatz extends TileEntityMachineBase implements IFluidStandardTransceiver, IControlReceiver, IGUIProvider, IFluidCopiable, CompatHandler.OCComponent, IRORValueProvider {
public FluidTank[] tanks;
public FluidTank[] sharedTanks;
@ -664,12 +662,6 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
return ROR;
}
@Override
public String runRORFunction(String name, String[] params) {
// TODO Auto-generated method stub
return null;
}
@Override
public String provideRORValue(String name) {
if((PREFIX_VALUE + "heat").equals(name)) return "" + this.heat;

View File

@ -141,4 +141,16 @@ public class TileEntityPneumoStorageClutter extends TileEntityMachineBase implem
public boolean isAvailableToCache(StackCache cache) {
return this.isLoaded && !this.isInvalid();
}
@Override
public long useUpItem(int index, long amount) {
if(slots[index] != null) {
int toRemove = (int) Math.min(slots[index].stackSize, amount);
this.decrStackSize(index, toRemove);
return amount - toRemove;
}
return amount;
}
}

View File

@ -55,6 +55,17 @@ public class PneumaticNetwork extends NodeNet {
storages.clear();
}
@Override
public void joinNetworks(NodeNet network) {
super.joinNetworks(network);
PneumaticNetwork net = (PneumaticNetwork) network;
for(StackCache cache : accessors) cache.dissolveCache();
for(Object connector : net.accessors) this.accessors.add((StackCache) connector);
for(Object connector : net.storages) this.storages.add((ISlotMonitorProvider) connector);
}
public void addReceiver(IInventory inventory, ForgeDirection pipeDir, TileEntityPneumoTube endpoint) {
receivers.put(inventory, new Triplet(pipeDir, System.currentTimeMillis(), endpoint));
}