starting some skeleton of the crate.

This commit is contained in:
Flanks255 2024-04-27 09:46:57 -05:00
parent 19afc5f05c
commit 786d9d3302
6 changed files with 101 additions and 55 deletions

View file

@ -14,53 +14,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.AACrops; import de.ellpeck.actuallyadditions.mod.blocks.base.AACrops;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals; import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusherDouble;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterfaceHopping;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.registration.AABlockReg; import de.ellpeck.actuallyadditions.registration.AABlockReg;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@ -162,6 +116,9 @@ public final class ActuallyBlocks {
public static final AABlockReg<BlockPoweredFurnace, AABlockItem, TileEntityPoweredFurnace> POWERED_FURNACE = new AABlockReg<>("powered_furnace", BlockPoweredFurnace::new, public static final AABlockReg<BlockPoweredFurnace, AABlockItem, TileEntityPoweredFurnace> POWERED_FURNACE = new AABlockReg<>("powered_furnace", BlockPoweredFurnace::new,
(b) -> new AABlockItem.BlockEntityEnergyItem(b, defaultBlockItemProperties), TileEntityPoweredFurnace::new); (b) -> new AABlockItem.BlockEntityEnergyItem(b, defaultBlockItemProperties), TileEntityPoweredFurnace::new);
public static final AABlockReg<Crate, AABlockItem, CrateBE> CRATE_SMALL = new AABlockReg<>("crate_small", () -> new Crate(Crate.Size.SMALL),
(b) -> new AABlockItem(b, defaultBlockItemProperties), (pos, state) -> new CrateBE(pos, state, Crate.Size.SMALL)); //TODO
// Crystal Blocks // Crystal Blocks
public static final AABlockReg<BlockCrystal, AABlockItem,?> ENORI_CRYSTAL = new AABlockReg<>("enori_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem); public static final AABlockReg<BlockCrystal, AABlockItem,?> ENORI_CRYSTAL = new AABlockReg<>("enori_crystal_block", () -> new BlockCrystal(false), BlockCrystal::createBlockItem);

View file

@ -0,0 +1,48 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.CrateBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import javax.annotation.Nullable;
public class Crate extends BlockContainerBase {
private final Size size;
public Crate(Size size) {
super(ActuallyBlocks.defaultPickProps().pushReaction(PushReaction.BLOCK));
this.size = size;
}
public Size getSize() {
return size;
}
public enum Size {
SMALL(9, 4),
MEDIUM(18, 8),
LARGE(27, 16); //TODO Maybe?
Size(int slotCount, int stackBoost) {
this.slots = slotCount;
this.stackBoost = stackBoost;
}
private final int slots;
private final int stackBoost;
public int getSlots() {
return slots;
}
public int getStackBoost() {
return stackBoost;
}
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) {
return new CrateBE(pPos, pState, this.size);
}
}

View file

@ -41,7 +41,7 @@ public final class ActuallyItems {
// MISC ITEMS // MISC ITEMS
public static final DeferredItem<ItemBase> CANOLA = ITEMS.register("canola", () -> new ItemBase()); public static final DeferredItem<ItemBase> CANOLA = ITEMS.register("canola", () -> new ItemBase());
public static final DeferredItem<ItemCoffee> COFFEE_CUP = ITEMS.register("coffee_cup", () -> new ItemCoffee()); public static final DeferredItem<ItemCoffee> COFFEE_CUP = ITEMS.register("coffee_cup", ItemCoffee::new);
public static final DeferredItem<ItemBase> RING = ITEMS.register("ring", () -> new ItemBase()); public static final DeferredItem<ItemBase> RING = ITEMS.register("ring", () -> new ItemBase());
public static final DeferredItem<ItemBase> BASIC_COIL = ITEMS.register("basic_coil", () -> new ItemBase()); public static final DeferredItem<ItemBase> BASIC_COIL = ITEMS.register("basic_coil", () -> new ItemBase());
public static final DeferredItem<ItemBase> ADVANCED_COIL = ITEMS.register("advanced_coil", () -> new ItemBase()); public static final DeferredItem<ItemBase> ADVANCED_COIL = ITEMS.register("advanced_coil", () -> new ItemBase());
@ -49,13 +49,13 @@ public final class ActuallyItems {
public static final DeferredItem<ItemBase> RICE_DOUGH = ITEMS.register("rice_dough", () -> new ItemBase()); public static final DeferredItem<ItemBase> RICE_DOUGH = ITEMS.register("rice_dough", () -> new ItemBase());
public static final DeferredItem<ItemBase> TINY_COAL = ITEMS.register("tiny_coal", () -> new ItemBase() { public static final DeferredItem<ItemBase> TINY_COAL = ITEMS.register("tiny_coal", () -> new ItemBase() {
@Override @Override
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) { public int getBurnTime(@Nonnull ItemStack itemStack, @Nullable RecipeType<?> recipeType) {
return 200; return 200;
} }
}); });
public static final DeferredItem<ItemBase> TINY_CHARCOAL = ITEMS.register("tiny_charcoal", () -> new ItemBase() { public static final DeferredItem<ItemBase> TINY_CHARCOAL = ITEMS.register("tiny_charcoal", () -> new ItemBase() {
@Override @Override
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) { public int getBurnTime(@Nonnull ItemStack itemStack, @Nullable RecipeType<?> recipeType) {
return 200; return 200;
} }
}); });

View file

@ -0,0 +1,18 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.Crate;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
public class CrateBE extends TileEntityBase{
private final Crate.Size size;
public CrateBE(BlockPos pos, BlockState state, Crate.Size size) {
super(ActuallyBlocks.CRATE_SMALL.getTileEntityType(), pos, state);
this.size = size;
}
public Crate.Size getSize() {
return size;
}
}

View file

@ -0,0 +1,23 @@
package de.ellpeck.actuallyadditions.mod.util;
import de.ellpeck.actuallyadditions.mod.blocks.Crate;
import net.minecraft.world.item.ItemStack;
public class CrateItemHandler extends ItemStackHandlerAA {
private Crate.Size size;
public CrateItemHandler(Crate.Size size) {
super(size.getSlots());
this.size = size;
}
@Override
protected int getStackLimit(int slot, ItemStack stack) {
return Math.min(this.getSlotLimit(slot), stack.getMaxStackSize() * this.size.getStackBoost());
}
@Override
public int getSlotLimit(int slot) {
return 64 * this.size.getStackBoost();
}
}

View file

@ -530,11 +530,11 @@
"container.actuallyadditions.crusher_double": "Double Crusher", "container.actuallyadditions.crusher_double": "Double Crusher",
"container.actuallyadditions.powered_furnace": "Powered Furnace", "container.actuallyadditions.powered_furnace": "Powered Furnace",
"container.actuallyadditions.feeder": "Feeder", "container.actuallyadditions.feeder": "Feeder",
"container.actuallyadditions.giantChest": "Small Storage Crate", "container.actuallyadditions.crate_small": "Small Storage Crate (wip)",
"container.actuallyadditions.giantChest.desc": "'Small'", "container.actuallyadditions.crate_small.desc": "'Small'",
"container.actuallyadditions.giantChestMedium": "Medium Storage Crate", "container.actuallyadditions.crate_medium": "Medium Storage Crate (wip)",
"container.actuallyadditions.giantChestLarge": "Large Storage Crate", "container.actuallyadditions.crate_large": "Large Storage Crate (wip)",
"container.actuallyadditions.giantChestLarge.desc": "Supersolid", "container.actuallyadditions.crate_large.desc": "Supersolid",
"container.actuallyadditions.repairer": "Repairer", "container.actuallyadditions.repairer": "Repairer",
"container.actuallyadditions.placer": "Placer", "container.actuallyadditions.placer": "Placer",
"container.actuallyadditions.breaker": "Breaker", "container.actuallyadditions.breaker": "Breaker",