cleaned up pipettes, chemplant loading change delay

This commit is contained in:
Boblet 2024-01-15 10:19:39 +01:00
parent da4160e89f
commit b76af3cffa
10 changed files with 173 additions and 161 deletions

View File

@ -1,5 +1,13 @@
## Added
* Pipettes
* Precision tools for carrying small amounts of liquids
* Come in three variants, normal, boron (corrosion-resistant) and laboratory (smaller capacity, more precision)
* Unlike most fluid containers, can be partially filled
* Capacity can be changed by right-clicking if the pipette is empty
## Changed ## Changed
* there is now a config option to disable the biome change caused by fallout. The config will also determine whether the biomes are registered at all, which prevents them from conflicting with other mods' biomes when disabled. * There is now a config option to disable the biome change caused by fallout. The config will also determine whether the biomes are registered at all, which prevents them from conflicting with other mods' biomes when disabled.
* Chemical plants now have a timer that starts after loading/unloading fluids using item fluid containers from the input buffers, this creates a delay between switching from loading and unloading, making it possible to retrieve fluids using pipettes.
## Fixed ## Fixed
* Fixed trenchmaster armor not doing most of the armor calculation, making it the worst armor * Fixed trenchmaster armor not doing most of the armor calculation, making it the worst armor

View File

@ -131,6 +131,7 @@ public class ToolRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette, 1), new Object[] { " L", " G ", "G ", 'L', ANY_RUBBER.ingot(), 'G', KEY_CLEARGLASS}); CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette, 1), new Object[] { " L", " G ", "G ", 'L', ANY_RUBBER.ingot(), 'G', KEY_CLEARGLASS});
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette_boron, 1), new Object[] { " P", " B ", "B ", 'P', RUBBER.ingot(), 'B', ModBlocks.glass_boron}); CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette_boron, 1), new Object[] { " P", " B ", "B ", 'P', RUBBER.ingot(), 'B', ModBlocks.glass_boron});
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette_laboratory, 1), new Object[] { " C", " R ", "P ", 'C', ModItems.circuit_aluminium, 'R', RUBBER.ingot(), 'P', ModItems.pipette_boron });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.mirror_tool), new Object[] { " A ", " IA", "I ", 'A', AL.ingot(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.mirror_tool), new Object[] { " A ", " IA", "I ", 'A', AL.ingot(), 'I', IRON.ingot() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.rbmk_tool), new Object[] { " A ", " IA", "I ", 'A', PB.ingot(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.rbmk_tool), new Object[] { " A ", " IA", "I ", 'A', PB.ingot(), 'I', IRON.ingot() });

View File

@ -423,13 +423,6 @@ public class AnvilRecipes {
new ComparableStack(Items.feather, 24) new ComparableStack(Items.feather, 24)
}, new AnvilOutput(new ItemStack(ModItems.wings_limp))).setTier(2)); }, new AnvilOutput(new ItemStack(ModItems.wings_limp))).setTier(2));
constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] {
new ComparableStack(ModBlocks.glass_boron, 2),
new OreDictStack(ANY_HARDPLASTIC.ingot(), 1),
new ComparableStack(ModItems.circuit_aluminium, 2)
}, new AnvilOutput(new ItemStack(ModItems.pipette_laboratory))).setTier(3));
constructionRecipes.add(new AnvilConstructionRecipe( constructionRecipes.add(new AnvilConstructionRecipe(
new AStack[] { new AStack[] {
new ComparableStack(ModItems.sulfur, 8), new ComparableStack(ModItems.sulfur, 8),

View File

@ -29,18 +29,15 @@ public class ItemPipette extends Item implements IFillableItem {
} }
@SideOnly(Side.CLIENT) protected IIcon overlayIcon; @SideOnly(Side.CLIENT) protected IIcon overlayIcon;
@SideOnly(Side.CLIENT) protected IIcon emptyIcon;
public short getMaxFill() { public short getMaxFill() {
if(this == ModItems.pipette_laboratory) if(this == ModItems.pipette_laboratory) return 50;
return 50; else return 1_000;
else
return 1_000;
} }
public void initNBT(ItemStack stack) { public void initNBT(ItemStack stack) {
stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound = new NBTTagCompound();
this.setFill(stack, Fluids.NONE, (short) 0); // sets "type" and "fill" NBT this.setFill(stack, Fluids.NONE, (short) 0); // sets "type" and "fill" NBT
stack.stackTagCompound.setShort("capacity", this.getMaxFill()); // set "capacity" stack.stackTagCompound.setShort("capacity", this.getMaxFill()); // set "capacity"
} }
@ -86,19 +83,16 @@ public class ItemPipette extends Item implements IFillableItem {
} }
if(!world.isRemote) { if(!world.isRemote) {
// ok i need to add some explanation if(this.getFill(stack) == 0) {
if (this.getFill(stack) == 0) { //if the pipette is empty
int a; int a;
if(this == ModItems.pipette_laboratory) //if the pipette is a laboratory pipette if(this == ModItems.pipette_laboratory)
//if the player is sneaking then the capacity should increase, else it should decrease (Math.min and Math.max for negative numbers/going over capacity)
a = !player.isSneaking() ? Math.min(this.getCapacity(stack) + 1, 50) : Math.max(this.getCapacity(stack) - 1, 1); a = !player.isSneaking() ? Math.min(this.getCapacity(stack) + 1, 50) : Math.max(this.getCapacity(stack) - 1, 1);
else //if its not a laboratory pipette else
//if the player is sneaking then the capacity should increase, else it should decrease
a = !player.isSneaking() ? Math.min(this.getCapacity(stack) + 50, 1_000) : Math.max(this.getCapacity(stack) - 50, 50); a = !player.isSneaking() ? Math.min(this.getCapacity(stack) + 50, 1_000) : Math.max(this.getCapacity(stack) - 50, 50);
stack.stackTagCompound.setShort("capacity", (short) a); // set the capacity to the new value stack.stackTagCompound.setShort("capacity", (short) a);
player.addChatMessage(new ChatComponentText(a + "/" + this.getMaxFill() + "mB")); // send new value in chat for player to see player.addChatMessage(new ChatComponentText(a + "/" + this.getMaxFill() + "mB"));
} else { } else {
player.addChatMessage(new ChatComponentText(I18nUtil.resolveKey("desc.item.pipette.noEmpty"))); // if pipette is not empty, no chance in capacity and tell player player.addChatMessage(new ChatComponentText(I18nUtil.resolveKey("desc.item.pipette.noEmpty")));
} }
} }
return stack; return stack;
@ -138,9 +132,8 @@ public class ItemPipette extends Item implements IFillableItem {
this.setFill(stack, type, (short) (this.getFill(stack) + toFill)); this.setFill(stack, type, (short) (this.getFill(stack) + toFill));
// fizzling checks // fizzling checks
if(this.getFill(stack) > 0 && (this.getType(stack).isCorrosive() && type != Fluids.ACID)) /*hydrogen peroxide corroding glass? unheard of! */ { if(this.getFill(stack) > 0 && (this.getType(stack).isCorrosive() && type != Fluids.ACID)) {
if(this == ModItems.pipette) { if(this == ModItems.pipette) {
//fizzle it!
stack.stackSize = 0; stack.stackSize = 0;
} }
} }
@ -165,8 +158,6 @@ public class ItemPipette extends Item implements IFillableItem {
return amount; return amount;
} }
//this took me way too long to figure out
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister icon) { public void registerIcons(IIconRegister icon) {
@ -175,12 +166,15 @@ public class ItemPipette extends Item implements IFillableItem {
this.overlayIcon = icon.registerIcon("hbm:pipette_laboratory_overlay"); this.overlayIcon = icon.registerIcon("hbm:pipette_laboratory_overlay");
else else
this.overlayIcon = icon.registerIcon("hbm:pipette_overlay"); this.overlayIcon = icon.registerIcon("hbm:pipette_overlay");
this.emptyIcon = icon.registerIcon("hbm:pipette_empty");
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) { public IIcon getIcon(ItemStack stack, int pass) {
return p_77618_2_ == 1 ? this.overlayIcon : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); if(getFill(stack) == 0 && pass == 1) return this.emptyIcon;
return pass == 1 ? this.overlayIcon : getIconFromDamageForRenderPass(stack.getItemDamage(), pass);
} }
@Override @Override

View File

@ -87,6 +87,12 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
return "container.chemplant"; return "container.chemplant";
} }
// last successful load
int lsl0 = 0;
int lsl1 = 0;
int lsu0 = 0;
int lsu1 = 0;
@Override @Override
public void updateEntity() { public void updateEntity() {
@ -98,12 +104,22 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
this.isProgressing = false; this.isProgressing = false;
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
if(!tanks[0].loadTank(17, 19, slots) && (slots[17] == null || slots[17].getItem() != ModItems.fluid_barrel_infinite)) tanks[0].unloadTank(17, 19, slots); int fluidDelay = 40;
if(!tanks[1].loadTank(18, 20, slots) && (slots[18] == null || slots[18].getItem() != ModItems.fluid_barrel_infinite)) tanks[1].unloadTank(18, 20, slots);
if(lsu0 >= fluidDelay && tanks[0].loadTank(17, 19, slots)) lsl0 = 0;
if(lsu1 >= fluidDelay && tanks[1].loadTank(18, 20, slots)) lsl1 = 0;
if(lsl0 >= fluidDelay && slots[17] != null && slots[17].getItem() != ModItems.fluid_barrel_infinite) if(tanks[0].unloadTank(17, 19, slots)) lsu0 = 0;
if(lsl1 >= fluidDelay && slots[18] != null && slots[18].getItem() != ModItems.fluid_barrel_infinite) if(tanks[1].unloadTank(18, 20, slots)) lsu1 = 0;
tanks[2].unloadTank(9, 11, slots); tanks[2].unloadTank(9, 11, slots);
tanks[3].unloadTank(10, 12, slots); tanks[3].unloadTank(10, 12, slots);
if(lsl0 < fluidDelay) lsl0++;
if(lsl1 < fluidDelay) lsl1++;
if(lsu0 < fluidDelay) lsu0++;
if(lsu1 < fluidDelay) lsu1++;
loadItems(); loadItems();
unloadItems(); unloadItems();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 151 B