Compare commits

..

No commits in common. "f32f7187ccd81c2ab5b60727c8e84aa6100bf3c9" and "d8ad92c447f5c5a35ef195db8a541bf3923e8401" have entirely different histories.

33 changed files with 134 additions and 151 deletions

View file

@ -115,6 +115,18 @@ jar {
from sourceSets.main.output from sourceSets.main.output
} }
processResources {
inputs.property('version', project.version)
inputs.property('neo_version_range', project.neo_version_range)
inputs.property('loader', project.loader)
inputs.property('minecraft_version_range', project.minecraft_version_range)
filesMatching(['META-INF/neoforge.mods.toml']) {
expand 'version': project.version, 'neo_version_range': project.neo_version_range, 'loader': project.loader, 'minecraft_version_range': project.minecraft_version_range
}
}
task apiJar(type: Jar) { task apiJar(type: Jar) {
from sourceSets.main.output from sourceSets.main.output
from sourceSets.main.java from sourceSets.main.java

View file

@ -2,12 +2,17 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false org.gradle.daemon=false
# Actually Additions # Actually Additions
mod_version=1.3.2 mod_version=1.2.14
# Forge # Forge
game_version=1.21.1 game_version=1.21.1
neo_version=21.1.71 neo_version=21.1.71
# mods.toml
loader=4
neo_version_range=[21.1.1,)
minecraft_version_range=[1.21.1,1.22)
# Parchment (Mappings) # Parchment (Mappings)
neogradle.subsystems.parchment.minecraftVersion=1.21 neogradle.subsystems.parchment.minecraftVersion=1.21
neogradle.subsystems.parchment.mappingsVersion=2024.07.28 neogradle.subsystems.parchment.mappingsVersion=2024.07.28

View file

@ -72,7 +72,7 @@ public class BlockShockSuppressor extends Block implements EntityBlock {
for (BlockPos pos : posesToRemove) { for (BlockPos pos : posesToRemove) {
if (suppressor.storage.getEnergyStored() >= use) { if (suppressor.storage.getEnergyStored() >= use) {
suppressor.storage.extractEnergyInternal(use, false); suppressor.storage.extractEnergy(use, false);
affectedBlocks.remove(pos); affectedBlocks.remove(pos);
} else { } else {
break; break;
@ -80,7 +80,7 @@ public class BlockShockSuppressor extends Block implements EntityBlock {
} }
for (Entity entity : entitiesToRemove) { for (Entity entity : entitiesToRemove) {
if (suppressor.storage.getEnergyStored() >= use) { if (suppressor.storage.getEnergyStored() >= use) {
suppressor.storage.extractEnergyInternal(use, false); suppressor.storage.extractEnergy(use, false);
affectedEntities.remove(entity); affectedEntities.remove(entity);
} else { } else {
break; break;

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.ArmorSlot; import com.mojang.datafixers.util.Pair;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
@ -22,8 +22,12 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.inventory.Slot; import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentEffectComponents;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.capabilities.Capabilities;
import org.jetbrains.annotations.Nullable;
import java.util.Objects; import java.util.Objects;
@ -59,8 +63,29 @@ public class ContainerEnergizer extends AbstractContainerMenu {
for (int k = 0; k < 4; ++k) { for (int k = 0; k < 4; ++k) {
EquipmentSlot slot = VALID_EQUIPMENT_SLOTS[k]; EquipmentSlot slot = VALID_EQUIPMENT_SLOTS[k];
ResourceLocation resourcelocation = InventoryMenu.TEXTURE_EMPTY_SLOTS.get(slot); this.addSlot(new Slot(inventory, 36 + 3 - k, 102, 19 + k * 18) {
this.addSlot(new ArmorSlot(inventory, slot, 36 + 3 - k, 102, 19 + k * 18, resourcelocation)); @Override
public int getMaxStackSize() {
return 1;
}
@Override
public boolean mayPlace(ItemStack stack) {
return !stack.isEmpty() && stack.getItem() instanceof ArmorItem;
}
@Override
public boolean mayPickup(Player player) {
ItemStack itemstack = this.getItem();
return (itemstack.isEmpty() || player.isCreative() || !EnchantmentHelper.has(itemstack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) && super.mayPickup(player);
}
@Nullable
@Override
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.TEXTURE_EMPTY_SLOTS.get(slot.getIndex()));
}
});
} }
} }

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.ArmorSlot; import com.mojang.datafixers.util.Pair;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
@ -23,8 +23,10 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.inventory.Slot; import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.capabilities.Capabilities;
import org.jetbrains.annotations.Nullable;
import java.util.Objects; import java.util.Objects;
@ -54,8 +56,24 @@ public class ContainerEnervator extends AbstractContainerMenu {
for (int k = 0; k < 4; ++k) { for (int k = 0; k < 4; ++k) {
EquipmentSlot slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k]; EquipmentSlot slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k];
ResourceLocation resourcelocation = InventoryMenu.TEXTURE_EMPTY_SLOTS.get(slot); this.addSlot(new Slot(inventory, 36 + 3 - k, 102, 19 + k * 18) {
this.addSlot(new ArmorSlot(inventory, slot, 36 + 3 - k, 102, 19 + k * 18, resourcelocation)); @Override
public int getMaxStackSize() {
return 1;
}
// TODO: [port] validate that this is correct
@Override
public boolean mayPlace(ItemStack stack) {
return StackUtil.isValid(stack) && stack.getItem() instanceof ArmorItem;
}
@Nullable
@Override
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.TEXTURE_EMPTY_SLOTS.get(slot.getIndex()));
}
});
} }
} }

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -20,6 +21,7 @@ import net.minecraft.world.entity.player.Inventory;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class GuiEnergizer extends AAScreen<ContainerEnergizer> { public class GuiEnergizer extends AAScreen<ContainerEnergizer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer");
@ -47,6 +49,8 @@ public class GuiEnergizer extends AAScreen<ContainerEnergizer> {
@Override @Override
public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) { public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86);
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93); guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93);

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -20,6 +21,8 @@ import net.minecraft.world.entity.player.Inventory;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class GuiEnervator extends AAScreen<ContainerEnervator> { public class GuiEnervator extends AAScreen<ContainerEnervator> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer");
@ -47,6 +50,8 @@ public class GuiEnervator extends AAScreen<ContainerEnervator> {
@Override @Override
public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) { public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86);
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93); guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93);

View file

@ -1,56 +0,0 @@
package de.ellpeck.actuallyadditions.mod.inventory.slot;
import com.mojang.datafixers.util.Pair;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.Container;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentEffectComponents;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import org.jetbrains.annotations.Nullable;
/**
* A copy of vanilla's ArmorSlot without the owner entity
* Vanilla's ArmorSlot class is not public, so we have to copy it
*/
public class ArmorSlot extends Slot {
private final EquipmentSlot slot;
@Nullable
private final ResourceLocation emptyIcon;
public ArmorSlot(
Container container, EquipmentSlot slot, int slotIndex, int x, int y, @Nullable ResourceLocation emptyIcon
) {
super(container, slotIndex, x, y);
this.slot = slot;
this.emptyIcon = emptyIcon;
}
@Override
public int getMaxStackSize() {
return 1;
}
@Override
public boolean mayPlace(ItemStack stack) {
return !stack.isEmpty() && stack.getItem() instanceof ArmorItem;
}
@Override
public boolean mayPickup(Player player) {
ItemStack itemstack = this.getItem();
return !itemstack.isEmpty() && !player.isCreative() && EnchantmentHelper.has(itemstack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)
? false
: super.mayPickup(player);
}
@Override
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
return this.emptyIcon != null ? Pair.of(InventoryMenu.BLOCK_ATLAS, this.emptyIcon) : super.getNoItemIcon();
}
}

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer; import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -28,7 +27,6 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.common.util.TriState;
import java.util.List; import java.util.List;
@ -37,15 +35,15 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior {
@Override @Override
public FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer) { public FarmerResult tryPlantSeed(ItemStack seed, Level world, BlockPos pos, IFarmer farmer) {
int use = 500; int use = 500;
if (farmer.getEnergy() >= use && seed.is(Items.NETHER_WART)) { if (farmer.getEnergy() >= use) {
BlockState belowState = world.getBlockState(pos.below()); if (seed.getItem() == Items.NETHER_WART) {
TriState result = belowState.canSustainPlant(world, pos, Direction.UP, Blocks.NETHER_WART.defaultBlockState()); if (world.getBlockState(pos.below()).getBlock().canSustainPlant(world.getBlockState(pos), world, pos.below(), Direction.UP, Blocks.NETHER_WART.defaultBlockState()).isTrue()) {
BlockState wartState = Blocks.NETHER_WART.defaultBlockState(); world.setBlock(pos, Blocks.NETHER_WART.defaultBlockState(), 2);
if (result.isTrue() || wartState.canSurvive(world, pos)) {
world.setBlock(pos, wartState, 2);
farmer.extractEnergy(use); farmer.extractEnergy(use);
return FarmerResult.SUCCESS; return FarmerResult.SUCCESS;
} }
return FarmerResult.FAIL;
}
} }
return FarmerResult.FAIL; return FarmerResult.FAIL;
} }
@ -55,7 +53,8 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior {
int use = 500; int use = 500;
if (farmer.getEnergy() >= use) { if (farmer.getEnergy() >= use) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof NetherWartBlock && state.getValue(BlockStateProperties.AGE_3) >= 3) { if (state.getBlock() instanceof NetherWartBlock) {
if (state.getValue(BlockStateProperties.AGE_3) >= 3) {
List<ItemStack> drops = state.getDrops(new LootParams.Builder(world) List<ItemStack> drops = state.getDrops(new LootParams.Builder(world)
.withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ())) .withParameter(LootContextParams.ORIGIN, new Vec3(pos.getX(), pos.getY(), pos.getZ()))
.withParameter(LootContextParams.TOOL, ItemStack.EMPTY)); .withParameter(LootContextParams.TOOL, ItemStack.EMPTY));
@ -76,6 +75,8 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior {
} }
} }
} }
return FarmerResult.FAIL;
}
} }
return FarmerResult.FAIL; return FarmerResult.FAIL;
} }

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.neoforged.neoforge.energy.EnergyStorage; import net.neoforged.neoforge.energy.EnergyStorage;
public class CustomEnergyStorage extends EnergyStorage { public class CustomEnergyStorage extends EnergyStorage {
@ -33,26 +32,6 @@ public class CustomEnergyStorage extends EnergyStorage {
return super.extractEnergy(maxExtract, simulate); return super.extractEnergy(maxExtract, simulate);
} }
public int extractEnergyInternal(int maxExtract, boolean simulate) {
int before = this.maxExtract;
this.maxExtract = Integer.MAX_VALUE;
int toReturn = this.extractEnergy(maxExtract, simulate);
this.maxExtract = before;
return toReturn;
}
public int receiveEnergyInternal(int maxReceive, boolean simulate) {
int before = this.maxReceive;
this.maxReceive = Integer.MAX_VALUE;
int toReturn = this.receiveEnergy(maxReceive, simulate);
this.maxReceive = before;
return toReturn;
}
public boolean isDirty() { public boolean isDirty() {
return dirty; return dirty;
} }

View file

@ -185,7 +185,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
@Override @Override
public void extractEnergy(int amount) { public void extractEnergy(int amount) {
this.storage.extractEnergyInternal(amount, false); this.storage.extractEnergy(amount, false);
} }
@Override @Override

View file

@ -116,7 +116,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements Men
} }
} else { } else {
tile.burnTime--; tile.burnTime--;
tile.storage.receiveEnergyInternal(tile.producePerTick, false); tile.storage.receiveEnergy(tile.producePerTick, false);
} }
if ((tile.lastBurnTime != tile.burnTime || tile.lastProducePerTick != tile.producePerTick) && tile.sendUpdateWithInterval()) { if ((tile.lastBurnTime != tile.burnTime || tile.lastProducePerTick != tile.producePerTick) && tile.sendUpdateWithInterval()) {

View file

@ -108,7 +108,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements Me
if ((FluidStack.isSameFluid(r.getOutput(), tile.tank.getFluid()) || tile.tank.isEmpty()) && r.getOutput().getAmount() <= tile.tank.getCapacity() - tile.tank.getFluidAmount()) { if ((FluidStack.isSameFluid(r.getOutput(), tile.tank.getFluid()) || tile.tank.isEmpty()) && r.getOutput().getAmount() <= tile.tank.getCapacity() - tile.tank.getFluidAmount()) {
if (tile.storage.getEnergyStored() >= ENERGY_USE) { if (tile.storage.getEnergyStored() >= ENERGY_USE) {
tile.currentProcessTime++; tile.currentProcessTime++;
tile.storage.extractEnergyInternal(ENERGY_USE, false); tile.storage.extractEnergy(ENERGY_USE, false);
if (tile.currentProcessTime >= TIME) { if (tile.currentProcessTime >= TIME) {
tile.currentProcessTime = 0; tile.currentProcessTime = 0;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe; import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator;
@ -109,7 +108,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
tile.currentBurnTime--; tile.currentBurnTime--;
int produce = tile.currentRecipe.value().getTotalEnergy() / tile.currentRecipe.value().getBurnTime(); int produce = tile.currentRecipe.value().getTotalEnergy() / tile.currentRecipe.value().getBurnTime();
if (produce > 0) { if (produce > 0) {
tile.storage.receiveEnergyInternal(produce, false); tile.storage.receiveEnergy(produce, false);
} }
} }

View file

@ -189,7 +189,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
} }
this.brewTime++; this.brewTime++;
this.storage.extractEnergyInternal(ENERGY_USED, false); this.storage.extractEnergy(ENERGY_USED, false);
if (this.brewTime >= TIME_USED) { if (this.brewTime >= TIME_USED) {
this.brewTime = 0; this.brewTime = 0;
ItemStack output = new ItemStack(ActuallyItems.COFFEE_CUP.get()); ItemStack output = new ItemStack(ActuallyItems.COFFEE_CUP.get());

View file

@ -131,7 +131,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
finishCrushing(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); finishCrushing(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2);
firstCrushTime = 0; firstCrushTime = 0;
} }
storage.extractEnergyInternal(ENERGY_USE, false); storage.extractEnergy(ENERGY_USE, false);
} }
crushed = storage.getEnergyStored() >= ENERGY_USE; crushed = storage.getEnergyStored() >= ENERGY_USE;
} else { } else {
@ -149,7 +149,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
finishCrushing(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); finishCrushing(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2);
secondCrushTime = 0; secondCrushTime = 0;
} }
storage.extractEnergyInternal(ENERGY_USE, false); storage.extractEnergy(ENERGY_USE, false);
} }
crushed = storage.getEnergyStored() >= ENERGY_USE; crushed = storage.getEnergyStored() >= ENERGY_USE;
} else { } else {

View file

@ -51,7 +51,7 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I
int energy = item.getUsePerTick(tile.inv.getStackInSlot(0), tile, tile.ticksElapsed); int energy = item.getUsePerTick(tile.inv.getStackInSlot(0), tile, tile.ticksElapsed);
if (tile.storage.getEnergyStored() >= energy) { if (tile.storage.getEnergyStored() >= energy) {
if (item.update(tile.inv.getStackInSlot(0), tile, tile.ticksElapsed)) { if (item.update(tile.inv.getStackInSlot(0), tile, tile.ticksElapsed)) {
tile.storage.extractEnergyInternal(energy, false); tile.storage.extractEnergy(energy, false);
} }
} }
} }

View file

@ -96,7 +96,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
boolean done = tile.processTime >= recipe.getTime(); boolean done = tile.processTime >= recipe.getTime();
for (TileEntityDisplayStand stand : stands) { for (TileEntityDisplayStand stand : stands) {
stand.storage.extractEnergyInternal(recipe.getEnergyPerStand() / recipe.getTime(), false); stand.storage.extractEnergy(recipe.getEnergyPerStand() / recipe.getTime(), false);
if (done) { if (done) {
stand.inv.getStackInSlot(0).shrink(1); stand.inv.getStackInSlot(0).shrink(1);

View file

@ -74,7 +74,7 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements Menu
boolean canTakeUp = capability.map(cap -> cap.getEnergyStored() >= cap.getMaxEnergyStored()).orElse(false); boolean canTakeUp = capability.map(cap -> cap.getEnergyStored() >= cap.getMaxEnergyStored()).orElse(false);
if (received > 0) { if (received > 0) {
tile.storage.extractEnergyInternal(received, false); tile.storage.extractEnergy(received, false);
} }
if (canTakeUp) { if (canTakeUp) {

View file

@ -72,7 +72,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha
boolean canTakeUp = capability.map(cap -> cap.getEnergyStored() <= 0).orElse(false); boolean canTakeUp = capability.map(cap -> cap.getEnergyStored() <= 0).orElse(false);
if (extracted > 0) { if (extracted > 0) {
tile.storage.receiveEnergyInternal(extracted, false); tile.storage.receiveEnergy(extracted, false);
} }
if (canTakeUp) { if (canTakeUp) {

View file

@ -213,7 +213,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
@Override @Override
public void extractEnergy(int amount) { public void extractEnergy(int amount) {
this.storage.extractEnergyInternal(amount, false); this.storage.extractEnergy(amount, false);
} }
@Override @Override

View file

@ -259,7 +259,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp
if (this.storage.getEnergyStored() >= USE_PER_SHOT) { if (this.storage.getEnergyStored() >= USE_PER_SHOT) {
this.spawnFireworks(this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ()); this.spawnFireworks(this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ());
this.storage.extractEnergyInternal(USE_PER_SHOT, false); this.storage.extractEnergy(USE_PER_SHOT, false);
} }
} }

View file

@ -81,7 +81,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE
} }
if (blocksAround.size() >= BLOCKS_NEEDED) { if (blocksAround.size() >= BLOCKS_NEEDED) {
tile.storage.receiveEnergyInternal(ENERGY_PRODUCE, false); tile.storage.receiveEnergy(ENERGY_PRODUCE, false);
tile.setChanged(); tile.setChanged();
tile.disappearTime++; tile.disappearTime++;

View file

@ -71,7 +71,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
if (tile.currentWorkTime >= 200) { if (tile.currentWorkTime >= 200) {
tile.currentWorkTime = 0; tile.currentWorkTime = 0;
level.setBlock(tile.worldPosition.above(), Blocks.LAVA.defaultBlockState(), 2); level.setBlock(tile.worldPosition.above(), Blocks.LAVA.defaultBlockState(), 2);
tile.storage.extractEnergyInternal(ENERGY_USE, false); tile.storage.extractEnergy(ENERGY_USE, false);
} }
} else { } else {
tile.currentWorkTime = 0; tile.currentWorkTime = 0;

View file

@ -87,7 +87,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
level.setBlockAndUpdate(theCoord, Blocks.AIR.defaultBlockState()); level.setBlockAndUpdate(theCoord, Blocks.AIR.defaultBlockState());
tile.storage.receiveEnergyInternal(energyProduced, false); tile.storage.receiveEnergy(energyProduced, false);
AssetUtil.spawnLaserWithTimeServer((ServerLevel) level, pos.getX(), pos.getY(), pos.getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), 0x3EA34A, 25, 0, 0.075F, 0.8F); AssetUtil.spawnLaserWithTimeServer((ServerLevel) level, pos.getX(), pos.getY(), pos.getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), 0x3EA34A, 25, 0, 0.075F, 0.8F);
} }

View file

@ -111,7 +111,7 @@ public class TileEntityLongRangeBreaker extends TileEntityInventoryBase implemen
this.level.levelEvent(2001, coordsBlock, Block.getId(this.level.getBlockState(coordsBlock))); this.level.levelEvent(2001, coordsBlock, Block.getId(this.level.getBlockState(coordsBlock)));
this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState());
StackUtil.addAll(this.inv, drops, false); StackUtil.addAll(this.inv, drops, false);
this.storage.extractEnergyInternal(ENERGY_USE, false); this.storage.extractEnergy(ENERGY_USE, false);
this.setChanged(); this.setChanged();
} }
} }

View file

@ -132,7 +132,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
if (tile.currentBurnTime > 0 && tile.currentEnergyProduce > 0) { if (tile.currentBurnTime > 0 && tile.currentEnergyProduce > 0) {
tile.currentBurnTime--; tile.currentBurnTime--;
tile.storage.receiveEnergyInternal(tile.currentEnergyProduce, false); tile.storage.receiveEnergy(tile.currentEnergyProduce, false);
} else if (!tile.isRedstonePowered) { } else if (!tile.isRedstonePowered) {
RecipeHolder<LiquidFuelRecipe> recipeHolder = tile.getRecipeForCurrentFluid(); RecipeHolder<LiquidFuelRecipe> recipeHolder = tile.getRecipeForCurrentFluid();

View file

@ -96,7 +96,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy
int received = Optional.ofNullable(slot.getCapability(Capabilities.EnergyStorage.ITEM)) int received = Optional.ofNullable(slot.getCapability(Capabilities.EnergyStorage.ITEM))
.map(cap -> cap.receiveEnergy(tile.storage.getEnergyStored(), false)).orElse(0); .map(cap -> cap.receiveEnergy(tile.storage.getEnergyStored(), false)).orElse(0);
if (received > 0) { if (received > 0) {
tile.storage.extractEnergyInternal(received, false); tile.storage.extractEnergy(received, false);
} }
} }
} else { } else {

View file

@ -141,7 +141,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
tile.finishBurning(SLOT_INPUT_1, SLOT_OUTPUT_1); tile.finishBurning(SLOT_INPUT_1, SLOT_OUTPUT_1);
tile.firstSmeltTime = 0; tile.firstSmeltTime = 0;
} }
tile.storage.extractEnergyInternal(ENERGY_USE, false); tile.storage.extractEnergy(ENERGY_USE, false);
} }
smelted = true; smelted = true;
} else { } else {
@ -155,7 +155,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
tile.finishBurning(SLOT_INPUT_2, SLOT_OUTPUT_2); tile.finishBurning(SLOT_INPUT_2, SLOT_OUTPUT_2);
tile.secondSmeltTime = 0; tile.secondSmeltTime = 0;
} }
tile.storage.extractEnergyInternal(ENERGY_USE, false); tile.storage.extractEnergy(ENERGY_USE, false);
} }
smelted = true; smelted = true;
} else { } else {

View file

@ -156,7 +156,7 @@ public class TileEntityVerticalDigger extends TileEntityInventoryBase implements
StackUtil.addAll(this.inv, drops, false); StackUtil.addAll(this.inv, drops, false);
this.setChanged(); this.setChanged();
this.storage.extractEnergyInternal(actualUse, false); this.storage.extractEnergy(actualUse, false);
this.shootParticles(pos.getX(), pos.getY(), pos.getZ()); this.shootParticles(pos.getX(), pos.getY(), pos.getZ());
} else { } else {
return false; return false;

View file

@ -11,14 +11,14 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.*;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis; import com.mojang.math.Axis;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes; import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam; import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import net.minecraft.client.Camera; import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
@ -30,6 +30,7 @@ import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
@ -355,6 +356,7 @@ public final class AssetUtil {
Matrix4f matrix = matrixStack.last().pose(); Matrix4f matrix = matrixStack.last().pose();
RenderSystem.setShader(GameRenderer::getPositionColorLightmapShader); RenderSystem.setShader(GameRenderer::getPositionColorLightmapShader);
var bufferbuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_LIGHTMAP);
TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE); TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE);
float minU = sprite.getU0(); float minU = sprite.getU0();
@ -388,6 +390,7 @@ public final class AssetUtil {
} }
matrixStack.popPose(); matrixStack.popPose();
BufferUploader.drawWithShader(bufferbuilder.buildOrThrow());
} }

View file

@ -1,10 +1,10 @@
modLoader="javafml" modLoader="javafml"
loaderVersion="[4,)" loaderVersion="[${loader},)"
license="MIT" license="MIT"
[[mods]] [[mods]]
modId="actuallyadditions" modId="actuallyadditions"
version="${file.jarVersion}" version="${version}"
displayName="Actually Additions" displayName="Actually Additions"
#logoFile="logo.png" #logoFile="logo.png"
credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp; Porters: Flanks, MrBysco, ErrorMikey; 1.20+ Textures: Ridanisaurus" credits="Author: Ellpeck; Textures and Models: BootyToast, GlenthorLP, canitzp; Porters: Flanks, MrBysco, ErrorMikey; 1.20+ Textures: Ridanisaurus"
@ -18,13 +18,13 @@ config = "actuallyadditions.mixins.json"
[[dependencies.actuallyadditions]] [[dependencies.actuallyadditions]]
modId="neoforge" modId="neoforge"
type="required" type="required"
versionRange="[21.1.1,)" versionRange="${neo_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
[[dependencies.actuallyadditions]] [[dependencies.actuallyadditions]]
modId="minecraft" modId="minecraft"
type="required" type="required"
versionRange="[1.21.1,1.22)" versionRange="${minecraft_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"

View file

@ -1,15 +1,3 @@
# 1.3.2+mc1.21.1
* Fix the gui of the Energizer/Enervator crashing
# 1.3.1+mc1.21.1
* Fix Empowerer laser crashing
* Fix energy storage of machines not working
# 1.3.0+mc1.21.1
* Update the mod to 1.21.1
* Fix crash when attempting to place Tiny Torch upside-down
* Fix Empowered Emeradic Crystal requiring Tall Grass instead of Short Grass
# 1.2.14+mc1.20.4 # 1.2.14+mc1.20.4
* Fixed Drill attributes going haywire. * Fixed Drill attributes going haywire.
* Fixed missing Crushing recipes for copper / some others. * Fixed missing Crushing recipes for copper / some others.