From 1ee3b79f8b66c1831e8f1c94f4c62fd29e550ede Mon Sep 17 00:00:00 2001 From: rearth Date: Mon, 11 Mar 2024 21:20:04 +0100 Subject: [PATCH] Begin adding basic generator, improve laser arm optics and block breaking logic --- .../19c08d24c255c2719fbb8ac01f9dff290b763461 | 8 +- .../blockstates/basic_generator_block.json | 7 + .../blockstates/test_generator_block.json | 7 + .../models/item/basic_generator_block.json | 3 + .../models/item/test_generator_block.json | 3 + .../block/base/entity/MachineBlockEntity.java | 39 +-- .../UpgradableGeneratorBlockEntity.java | 232 ++++++++++++++++++ .../generators/BasicGeneratorBlock.java | 18 ++ .../generators/TestGeneratorBlock.java | 17 ++ .../generators/BasicGeneratorEntity.java | 84 +++++++ .../generators/TestGeneratorEntity.java | 54 ++++ .../interaction/DestroyerBlockEntity.java | 3 + .../interaction/LaserArmBlockEntity.java | 17 +- .../processing/AssemblerBlockEntity.java | 1 - .../oritech/client/init/ModRenderers.java | 9 +- .../oritech/client/init/ModScreens.java | 4 + .../client/renderers/LaserArmRenderer.java | 2 +- .../rearth/oritech/init/BlockContent.java | 6 + .../oritech/init/BlockEntitiesContent.java | 11 +- .../oritech/init/datagen/ModelGenerator.java | 2 + .../oritech/init/recipes/RecipeContent.java | 1 + .../oritech/network/NetworkContent.java | 12 + .../test_generator_block.animation.json | 230 +++++++++++++++++ .../models/test_generator_block.geo.json | 84 +++++++ .../resources/assets/oritech/lang/en_us.json | 5 + .../block/models/test_generator_block.png | Bin 0 -> 2372 bytes .../textures/item/target_designator.png | Bin 435 -> 2732 bytes .../recipes/generator_banana_test.json | 11 + .../recipes/generator_carrot_test.json | 11 + 29 files changed, 853 insertions(+), 28 deletions(-) create mode 100644 src/main/generated/assets/oritech/blockstates/basic_generator_block.json create mode 100644 src/main/generated/assets/oritech/blockstates/test_generator_block.json create mode 100644 src/main/generated/assets/oritech/models/item/basic_generator_block.json create mode 100644 src/main/generated/assets/oritech/models/item/test_generator_block.json create mode 100644 src/main/java/rearth/oritech/block/base/entity/UpgradableGeneratorBlockEntity.java create mode 100644 src/main/java/rearth/oritech/block/blocks/machines/generators/BasicGeneratorBlock.java create mode 100644 src/main/java/rearth/oritech/block/blocks/machines/generators/TestGeneratorBlock.java create mode 100644 src/main/java/rearth/oritech/block/entity/machines/generators/BasicGeneratorEntity.java create mode 100644 src/main/java/rearth/oritech/block/entity/machines/generators/TestGeneratorEntity.java create mode 100644 src/main/resources/assets/oritech/animations/block/models/test_generator_block.animation.json create mode 100644 src/main/resources/assets/oritech/geo/block/models/test_generator_block.geo.json create mode 100644 src/main/resources/assets/oritech/textures/block/models/test_generator_block.png create mode 100644 src/main/resources/data/oritech/recipes/generator_banana_test.json create mode 100644 src/main/resources/data/oritech/recipes/generator_carrot_test.json diff --git a/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 b/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 index d4ba795e4..54a292bea 100644 --- a/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 +++ b/src/main/generated/.cache/19c08d24c255c2719fbb8ac01f9dff290b763461 @@ -1,4 +1,4 @@ -// 1.20.4 2024-03-07T19:17:34.0084518 Oritech/Model Definitions +// 1.20.4 2024-03-11T15:36:48.2448916 Oritech/Model Definitions 3d6f377b938592ac22aca17bd64561a6579ad217 assets\oritech\blockstates\grinder_block.json 8ede0997449fd1c3f65a07df184768a843b473ed assets\oritech\models\item\centrifuge_block.json 90e28b721796ff7ee21c8eefe4525f03a251d2fb assets\oritech\models\block\machine_extender.json @@ -12,14 +12,17 @@ e6f197ee5ac22cd68bc502a86d40b65bfe40884a assets\oritech\models\item\target_desig e4497bad8afbd4f4b4e830d892284a05718b06dd assets\oritech\models\block\machine_core_basic.json 505d30e3b61ee0ba1f2616e1226689e2cdb7ab58 assets\oritech\models\block\addon_indicator_block.json a5651b8d4a27308b40c404f7cd3abcf9769b64b6 assets\oritech\models\item\machine_core_basic.json +e109fcba8a22fe480b127c3f8972d80bf3821f51 assets\oritech\blockstates\basic_generator_block.json 2f7dfa17792770a034a13f117e6b8b1942b459e4 assets\oritech\models\block\placer_block.json ee822d455f99c8c53c789fdb744979f678ca2729 assets\oritech\blockstates\fertilizer_block.json 46af77abe62b29d232feadccde429fd59d5603fc assets\oritech\blockstates\placer_block.json 3d37038977380bd685f913e722cc3b1c3a25c35d assets\oritech\models\item\atomic_forge_block.json +3be551406a325c82d9ec237b4b2e9e12fa5736d5 assets\oritech\blockstates\test_generator_block.json eafe84c787830ab2a866e0878e9ed718d58659f5 assets\oritech\blockstates\banana_block.json b5ee97616ae0d2da17dfaecf45aa42f2cf19f691 assets\oritech\blockstates\machine_extender.json 25864df3cd7786f2bf4fe6fa9855b3cf366c28ca assets\oritech\models\item\banana.json 1fdbeb99862a58436d745edb768b503539ecb295 assets\oritech\models\item\placer_block.json +58b38bcc6c404953490330d4cc797464b6874d88 assets\oritech\models\item\test_generator_block.json b8bc03092cb1eb686ede01daffc7421253af860c assets\oritech\models\item\machine_extender.json 9cd64a2fe3b9a0ee479646d36cc0302bcd7cab4f assets\oritech\models\block\destroyer_block.json 63f14855c688ce7ec236097ce232dd381cbc1538 assets\oritech\blockstates\addon_indicator_block.json @@ -30,12 +33,13 @@ b8bc03092cb1eb686ede01daffc7421253af860c assets\oritech\models\item\machine_exte 54472f85797924c842326a60299d72263cb2c301 assets\oritech\blockstates\block_destroyer_head.json 4021223f19511a9e81a833342c1d05f5af891c10 assets\oritech\blockstates\atomic_forge_block.json ff59e92a557b29eeb7f85b1c15ef206c5b99aff6 assets\oritech\models\item\foundry_block.json +907e1d1717c926ebc0455ebe3291c7e917eb74d2 assets\oritech\models\item\basic_generator_block.json c641d411ad252487b93d779cee9028b9ee920281 assets\oritech\blockstates\machine_core_basic.json a5afa0ba8780ec08bd0a9284bc08e0c681fe7158 assets\oritech\blockstates\block_placer_head.json f29468ff950a191567ab35557334666099ccd7cc assets\oritech\blockstates\assembler_block.json 5054284e6d5fe0785ac93bdda5101c47337953cf assets\oritech\models\item\machine_frame_block.json -3810f72943d88c81d3ab6b4329d437911c859621 assets\oritech\blockstates\powered_furnace_block.json 1b9cd3719105dc1e03398de41f2cab37337816fe assets\oritech\blockstates\machine_core_good.json +3810f72943d88c81d3ab6b4329d437911c859621 assets\oritech\blockstates\powered_furnace_block.json 5462a2453fcdd2f8b99129894aec60f282d29ca9 assets\oritech\models\item\pulverizer_block.json a3f9b72f6f36d42af4e5c3a87d7e180b2e36a2ed assets\oritech\models\item\machine_core_good.json 469ea8a66c529fe26bc029c21092e7f062ed0e40 assets\oritech\models\block\banana_block.json diff --git a/src/main/generated/assets/oritech/blockstates/basic_generator_block.json b/src/main/generated/assets/oritech/blockstates/basic_generator_block.json new file mode 100644 index 000000000..5140466d9 --- /dev/null +++ b/src/main/generated/assets/oritech/blockstates/basic_generator_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "oritech:block/basic_generator_block" + } + } +} \ No newline at end of file diff --git a/src/main/generated/assets/oritech/blockstates/test_generator_block.json b/src/main/generated/assets/oritech/blockstates/test_generator_block.json new file mode 100644 index 000000000..97500cebb --- /dev/null +++ b/src/main/generated/assets/oritech/blockstates/test_generator_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "oritech:block/test_generator_block" + } + } +} \ No newline at end of file diff --git a/src/main/generated/assets/oritech/models/item/basic_generator_block.json b/src/main/generated/assets/oritech/models/item/basic_generator_block.json new file mode 100644 index 000000000..1a275f5c2 --- /dev/null +++ b/src/main/generated/assets/oritech/models/item/basic_generator_block.json @@ -0,0 +1,3 @@ +{ + "parent": "oritech:block/basic_generator_block" +} \ No newline at end of file diff --git a/src/main/generated/assets/oritech/models/item/test_generator_block.json b/src/main/generated/assets/oritech/models/item/test_generator_block.json new file mode 100644 index 000000000..08d88617e --- /dev/null +++ b/src/main/generated/assets/oritech/models/item/test_generator_block.json @@ -0,0 +1,3 @@ +{ + "parent": "oritech:block/test_generator_block" +} \ No newline at end of file diff --git a/src/main/java/rearth/oritech/block/base/entity/MachineBlockEntity.java b/src/main/java/rearth/oritech/block/base/entity/MachineBlockEntity.java index aeb898aab..a0a47d439 100644 --- a/src/main/java/rearth/oritech/block/base/entity/MachineBlockEntity.java +++ b/src/main/java/rearth/oritech/block/base/entity/MachineBlockEntity.java @@ -4,9 +4,6 @@ import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage; -import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; -import net.fabricmc.fabric.api.transfer.v1.storage.Storage; -import net.fabricmc.fabric.api.transfer.v1.storage.base.CombinedStorage; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; @@ -19,7 +16,6 @@ import net.minecraft.inventory.SimpleInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; import net.minecraft.network.PacketByteBuf; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.RecipeEntry; @@ -27,7 +23,6 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.state.property.Properties; import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; @@ -46,7 +41,10 @@ import software.bernie.geckolib.util.GeckoLibUtil; import team.reborn.energy.api.EnergyStorage; -import java.util.*; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; public abstract class MachineBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory, GeoBlockEntity, EnergyProvider, ScreenProvider, InventoryProvider, BlockEntityTicker { @@ -57,19 +55,17 @@ public abstract class MachineBlockEntity extends BlockEntity public static final RawAnimation IDLE = RawAnimation.begin().thenPlayAndHold("idle"); public static final RawAnimation WORKING = RawAnimation.begin().thenLoop("working"); protected final AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); - private final AnimationController animationController = getAnimationController(); - + protected final SimpleInventory inventory = new SimpleMachineInventory(getInventorySize()); // crafting / processing protected int progress; + private final AnimationController animationController = getAnimationController(); protected int energyPerTick; protected OritechRecipe currentRecipe = OritechRecipe.DUMMY; protected InventoryInputMode inventoryInputMode = InventoryInputMode.FILL_LEFT_TO_RIGHT; - // network state protected boolean networkDirty = true; - //own storage - protected final DynamicEnergyStorage energyStorage = new DynamicEnergyStorage(getDefaultCapacity(), getDefaultInsertRate(), 0) { + protected final DynamicEnergyStorage energyStorage = new DynamicEnergyStorage(getDefaultCapacity(), getDefaultInsertRate(), getDefaultExtractionRate()) { @Override public void onFinalCommit() { super.onFinalCommit(); @@ -77,8 +73,6 @@ public void onFinalCommit() { } }; - protected final SimpleInventory inventory = new SimpleMachineInventory(getInventorySize()); - public MachineBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, int energyPerTick) { super(type, pos, state); this.energyPerTick = energyPerTick; @@ -133,7 +127,7 @@ protected void useEnergy() { energyStorage.amount -= calculateEnergyUsage(); } - private float calculateEnergyUsage() { + protected float calculateEnergyUsage() { return energyPerTick * getEfficiencyMultiplier() * (1 / getSpeedMultiplier()); } @@ -159,7 +153,7 @@ private boolean isActivelyViewed() { return closestPlayer != null && closestPlayer.currentScreenHandler instanceof BasicMachineScreenHandler handler && getPos().equals(handler.getBlockPos()); } - private void sendNetworkEntry() { + protected void sendNetworkEntry() { NetworkContent.MACHINE_CHANNEL.serverHandle(this).send(new NetworkContent.MachineSyncPacket(getPos(), energyStorage.amount, energyStorage.capacity, energyStorage.maxInsert, progress, currentRecipe, inventoryInputMode)); networkDirty = false; } @@ -241,7 +235,7 @@ protected boolean canAddToSlot(ItemStack input, ItemStack slot) { return true; } - private Optional> getRecipe() { + protected Optional> getRecipe() { return Objects.requireNonNull(world).getRecipeManager().getFirstMatch(getOwnRecipeType(), getInputInventory(), world); } @@ -545,8 +539,17 @@ public float getDisplayedEnergyUsage() { return calculateEnergyUsage(); } - public long getDefaultCapacity() {return 5000;} - public long getDefaultInsertRate() {return 100;} + public long getDefaultCapacity() { + return 5000; + } + + public long getDefaultInsertRate() { + return 100; + } + + public long getDefaultExtractionRate() { + return 0; + } @Override public Inventory getDisplayedInventory() { diff --git a/src/main/java/rearth/oritech/block/base/entity/UpgradableGeneratorBlockEntity.java b/src/main/java/rearth/oritech/block/base/entity/UpgradableGeneratorBlockEntity.java new file mode 100644 index 000000000..8b3d0e1a3 --- /dev/null +++ b/src/main/java/rearth/oritech/block/base/entity/UpgradableGeneratorBlockEntity.java @@ -0,0 +1,232 @@ +package rearth.oritech.block.base.entity; + +import net.fabricmc.fabric.api.lookup.v1.block.BlockApiCache; +import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.inventory.Inventories; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtList; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import rearth.oritech.init.recipes.OritechRecipe; +import rearth.oritech.network.NetworkContent; +import team.reborn.energy.api.EnergyStorage; +import team.reborn.energy.api.base.SimpleEnergyStorage; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public abstract class UpgradableGeneratorBlockEntity extends UpgradableMachineBlockEntity { + + private int currentMaxBurnTime; // needed only for progress display + private List pendingOutputs = new ArrayList<>(); // used if a recipe produces a byproduct at the end + private HashMap> directionCaches; + + // speed multiplier increases output rate and reduces burn time by same percentage + // efficiency multiplier only increases burn time + public UpgradableGeneratorBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, int energyPerTick) { + super(type, pos, state, energyPerTick); + } + + private static HashMap> getNeighborCaches(BlockPos pos, World world) { + + var res = new HashMap>(6); + + var topCache = BlockApiCache.create(EnergyStorage.SIDED, (ServerWorld) world, pos.up()); + res.put(Direction.DOWN, topCache); + var botCache = BlockApiCache.create(EnergyStorage.SIDED, (ServerWorld) world, pos.down()); + res.put(Direction.UP, botCache); + var northCache = BlockApiCache.create(EnergyStorage.SIDED, (ServerWorld) world, pos.north()); + res.put(Direction.SOUTH, northCache); + var eastCache = BlockApiCache.create(EnergyStorage.SIDED, (ServerWorld) world, pos.east()); + res.put(Direction.WEST, eastCache); + var southCache = BlockApiCache.create(EnergyStorage.SIDED, (ServerWorld) world, pos.south()); + res.put(Direction.NORTH, southCache); + var westCache = BlockApiCache.create(EnergyStorage.SIDED, (ServerWorld) world, pos.west()); + res.put(Direction.EAST, westCache); + + return res; + } + + @Override + public void tick(World world, BlockPos pos, BlockState state, MachineBlockEntity blockEntity) { + + // check remaining burn time + // if burn time is zero, try consume item thus adding burn time + // if burn time is remaining, use up one tick of it + + if (world.isClient || !isActive(state)) return; + + // progress var is used as remaining burn time + if (progress > 0) { + if (canFitEnergy()) { + + progress--; + produceEnergy(); + + if (progress == 0) { + burningFinished(); + } + markDirty(); + markNetDirty(); + } + } else if (canFitEnergy()) { + // try consume new item + tryConsumeInput(); + } + + if (networkDirty) { + updateNetwork(); + } + + outputEnergy(); + } + + protected void tryConsumeInput() { + var recipeCandidate = getRecipe(); + if (recipeCandidate.isEmpty()) + currentRecipe = OritechRecipe.DUMMY; // reset recipe when invalid or no input is given + + if (recipeCandidate.isPresent()) { + // this is separate so that progress is not reset when out of energy + var activeRecipe = recipeCandidate.get().value(); + currentRecipe = activeRecipe; + progress = activeRecipe.getTime(); + currentMaxBurnTime = progress; + + // remove inputs + for (int i = 0; i < activeRecipe.getInputs().size(); i++) { + var taken = Inventories.splitStack(getInputView(), i, 1); // amount is not configurable, because ingredient doesn't parse amount in recipe + } + pendingOutputs = activeRecipe.getResults(); + + markNetDirty(); + markDirty(); + + } + } + + protected void burningFinished() { + produceResultItems(); + } + + protected void produceResultItems() { + if (!pendingOutputs.isEmpty()) { + for (var stack : pendingOutputs) { + this.inventory.addStack(stack); + } + } + + pendingOutputs.clear(); + } + + // check if the energy can fit + protected boolean canFitEnergy() { + var produced = calculateEnergyUsage(); + return energyStorage.capacity >= energyStorage.amount + produced; + } + + // gives energy in this case + @SuppressWarnings("lossy-conversions") + protected void produceEnergy() { + energyStorage.amount += calculateEnergyUsage(); + } + + // returns energy production in this case + @Override + protected float calculateEnergyUsage() { + return energyPerTick * (1 / getSpeedMultiplier()); + } + + @Override + public void writeNbt(NbtCompound nbt) { + super.writeNbt(nbt); + nbt.putInt("storedBurn", currentMaxBurnTime); + + var resList = new NbtList(); + for (var stack : pendingOutputs) { + var data = stack.writeNbt(new NbtCompound()); + resList.add(data); + } + nbt.put("pendingResults", resList); + } + + @Override + public void readNbt(NbtCompound nbt) { + super.readNbt(nbt); + currentMaxBurnTime = nbt.getInt("currentMaxBurnTime"); + + var storedResults = nbt.getList("pendingResults", NbtElement.COMPOUND_TYPE); + for (var elem : storedResults) { + var compound = (NbtCompound) elem; + var stack = ItemStack.fromNbt(compound); + pendingOutputs.add(stack); + } + + if (world != null) + directionCaches = getNeighborCaches(pos, world); + } + + @Override + protected void sendNetworkEntry() { + super.sendNetworkEntry(); + NetworkContent.MACHINE_CHANNEL.serverHandle(this).send(new NetworkContent.GeneratorUISyncPacket(getPos(), currentMaxBurnTime)); + } + + private void outputEnergy() { + if (energyStorage.amount <= 0) return; + var availableOutput = Math.min(energyStorage.amount, energyStorage.maxExtract); + var totalInserted = 0L; + + if (directionCaches == null) directionCaches = getNeighborCaches(pos, world); + + try (var tx = Transaction.openOuter()) { + for (var entry : directionCaches.entrySet()) { + var insertDirection = entry.getKey().getOpposite(); + var targetCandidate = entry.getValue().find(insertDirection); + if (targetCandidate == null) continue; + var inserted = targetCandidate.insert(availableOutput, tx); + availableOutput -= inserted; + totalInserted += inserted; + if (availableOutput <= 0) break; + } + energyStorage.extract(totalInserted, tx); + tx.commit(); + } + + } + + @Override + public float getProgress() { + return 1 - ((float) progress / currentMaxBurnTime); + } + + public int getCurrentMaxBurnTime() { + return currentMaxBurnTime; + } + + public void setCurrentMaxBurnTime(int currentMaxBurnTime) { + this.currentMaxBurnTime = currentMaxBurnTime; + } + + @Override + public long getDefaultCapacity() { + return 5000; + } + + @Override + public long getDefaultInsertRate() { + return 0; + } + + @Override + public long getDefaultExtractionRate() { + return 100; + } +} diff --git a/src/main/java/rearth/oritech/block/blocks/machines/generators/BasicGeneratorBlock.java b/src/main/java/rearth/oritech/block/blocks/machines/generators/BasicGeneratorBlock.java new file mode 100644 index 000000000..6e5b011e3 --- /dev/null +++ b/src/main/java/rearth/oritech/block/blocks/machines/generators/BasicGeneratorBlock.java @@ -0,0 +1,18 @@ +package rearth.oritech.block.blocks.machines.generators; + +import net.minecraft.block.entity.BlockEntity; +import org.jetbrains.annotations.NotNull; +import rearth.oritech.block.base.block.UpgradableMachineBlock; +import rearth.oritech.block.entity.machines.generators.BasicGeneratorEntity; +import rearth.oritech.block.entity.machines.generators.TestGeneratorEntity; + +public class BasicGeneratorBlock extends UpgradableMachineBlock { + public BasicGeneratorBlock(Settings settings) { + super(settings); + } + + @Override + public @NotNull Class getBlockEntityType() { + return BasicGeneratorEntity.class; + } +} diff --git a/src/main/java/rearth/oritech/block/blocks/machines/generators/TestGeneratorBlock.java b/src/main/java/rearth/oritech/block/blocks/machines/generators/TestGeneratorBlock.java new file mode 100644 index 000000000..b8c78e26c --- /dev/null +++ b/src/main/java/rearth/oritech/block/blocks/machines/generators/TestGeneratorBlock.java @@ -0,0 +1,17 @@ +package rearth.oritech.block.blocks.machines.generators; + +import net.minecraft.block.entity.BlockEntity; +import org.jetbrains.annotations.NotNull; +import rearth.oritech.block.base.block.UpgradableMachineBlock; +import rearth.oritech.block.entity.machines.generators.TestGeneratorEntity; + +public class TestGeneratorBlock extends UpgradableMachineBlock { + public TestGeneratorBlock(Settings settings) { + super(settings); + } + + @Override + public @NotNull Class getBlockEntityType() { + return TestGeneratorEntity.class; + } +} diff --git a/src/main/java/rearth/oritech/block/entity/machines/generators/BasicGeneratorEntity.java b/src/main/java/rearth/oritech/block/entity/machines/generators/BasicGeneratorEntity.java new file mode 100644 index 000000000..0a04abe09 --- /dev/null +++ b/src/main/java/rearth/oritech/block/entity/machines/generators/BasicGeneratorEntity.java @@ -0,0 +1,84 @@ +package rearth.oritech.block.entity.machines.generators; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.AbstractFurnaceBlockEntity; +import net.minecraft.block.entity.FurnaceBlockEntity; +import net.minecraft.inventory.Inventories; +import net.minecraft.item.Item; +import net.minecraft.item.Items; +import net.minecraft.recipe.RecipeType; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; +import rearth.oritech.block.base.entity.UpgradableGeneratorBlockEntity; +import rearth.oritech.client.init.ModScreens; +import rearth.oritech.init.BlockEntitiesContent; +import rearth.oritech.init.recipes.OritechRecipeType; +import rearth.oritech.init.recipes.RecipeContent; +import rearth.oritech.util.InventorySlotAssignment; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class BasicGeneratorEntity extends UpgradableGeneratorBlockEntity { + + public static final Map FUEL_MAP = AbstractFurnaceBlockEntity.createFuelTimeMap(); + + public BasicGeneratorEntity(BlockPos pos, BlockState state) { + super(BlockEntitiesContent.BASIC_GENERATOR_ENTITY, pos, state, 30); + } + + @Override + protected OritechRecipeType getOwnRecipeType() { + return RecipeContent.TEST_GENERATOR; + } + + @Override + protected void tryConsumeInput() { + var firstItem = this.getInputView().get(0); + if (firstItem.isEmpty()) return; + + var fuelTime = FUEL_MAP.getOrDefault(firstItem.getItem(), 0); + if (fuelTime > 0) { + firstItem.decrement(1); + progress = fuelTime; + setCurrentMaxBurnTime(fuelTime); + markNetDirty(); + markDirty(); + } + } + + @Override + public InventorySlotAssignment getSlots() { + return new InventorySlotAssignment(0, 1, 1, 0); + } + + @Override + public List getGuiSlots() { + return List.of( + new GuiSlot(0, 80, 11)); + } + + @Override + public ScreenHandlerType getScreenHandlerType() { + return ModScreens.BASIC_GENERATOR_SCREEN; + } + + @Override + public int getInventorySize() { + return 1; + } + + @Override + public List getAddonSlots() { + return List.of( + new Vec3i(1, 0,0) + ); + } + + @Override + public boolean inputOptionsEnabled() { + return false; + } +} diff --git a/src/main/java/rearth/oritech/block/entity/machines/generators/TestGeneratorEntity.java b/src/main/java/rearth/oritech/block/entity/machines/generators/TestGeneratorEntity.java new file mode 100644 index 000000000..1f9b0ed8f --- /dev/null +++ b/src/main/java/rearth/oritech/block/entity/machines/generators/TestGeneratorEntity.java @@ -0,0 +1,54 @@ +package rearth.oritech.block.entity.machines.generators; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; +import rearth.oritech.block.base.entity.UpgradableGeneratorBlockEntity; +import rearth.oritech.client.init.ModScreens; +import rearth.oritech.init.BlockEntitiesContent; +import rearth.oritech.init.recipes.OritechRecipeType; +import rearth.oritech.init.recipes.RecipeContent; +import rearth.oritech.util.InventorySlotAssignment; + +import java.util.ArrayList; +import java.util.List; + +public class TestGeneratorEntity extends UpgradableGeneratorBlockEntity { + public TestGeneratorEntity(BlockPos pos, BlockState state) { + super(BlockEntitiesContent.TEST_GENERATOR_ENTITY, pos, state, 30); + } + + @Override + protected OritechRecipeType getOwnRecipeType() { + return RecipeContent.TEST_GENERATOR; + } + + @Override + public InventorySlotAssignment getSlots() { + return new InventorySlotAssignment(0, 1, 1, 1); + } + + @Override + public List getGuiSlots() { + return List.of( + new GuiSlot(0, 75, 11), + new GuiSlot(1, 75, 59)); + } + + @Override + public ScreenHandlerType getScreenHandlerType() { + return ModScreens.TEST_GENERATOR_SCREEN; + } + + @Override + public int getInventorySize() { + return 2; + } + + @Override + public List getAddonSlots() { + return new ArrayList<>(); + } +} diff --git a/src/main/java/rearth/oritech/block/entity/machines/interaction/DestroyerBlockEntity.java b/src/main/java/rearth/oritech/block/entity/machines/interaction/DestroyerBlockEntity.java index 2bd98720e..b023e9520 100644 --- a/src/main/java/rearth/oritech/block/entity/machines/interaction/DestroyerBlockEntity.java +++ b/src/main/java/rearth/oritech/block/entity/machines/interaction/DestroyerBlockEntity.java @@ -46,6 +46,9 @@ public void finishBlockWork(BlockPos processed) { var targetPosition = processed.down(); var targetState = Objects.requireNonNull(world).getBlockState(targetPosition); + var targetHardness = targetState.getBlock().getHardness(); + if (targetHardness <= 0) return; // skip undestoyable blocks, such as bedrock + // skip not grown crops if (targetState.getBlock() instanceof CropBlock cropBlock && !cropBlock.isMature(targetState)) { return; diff --git a/src/main/java/rearth/oritech/block/entity/machines/interaction/LaserArmBlockEntity.java b/src/main/java/rearth/oritech/block/entity/machines/interaction/LaserArmBlockEntity.java index ef44ffa75..b3b2407f3 100644 --- a/src/main/java/rearth/oritech/block/entity/machines/interaction/LaserArmBlockEntity.java +++ b/src/main/java/rearth/oritech/block/entity/machines/interaction/LaserArmBlockEntity.java @@ -43,7 +43,7 @@ public class LaserArmBlockEntity extends BlockEntity implements GeoBlockEntity, BlockEntityTicker, EnergyProvider, MultiblockMachineController, MachineAddonController, InventoryProvider { - private static final int BLOCK_BREAK_ENERGY = 1000; + private static final int BLOCK_BREAK_ENERGY = 3000; // storage protected final DynamicEnergyStorage energyStorage = new DynamicEnergyStorage(getDefaultCapacity(), getDefaultInsertRate(), 0) { @@ -81,6 +81,7 @@ public void markDirty() { private BlockPos currentTarget; private long lastFiredAt; private int progress; + private int targetBlockEnergyNeeded = BLOCK_BREAK_ENERGY; private boolean networkDirty; @Environment(EnvType.CLIENT) @@ -120,7 +121,7 @@ public void tick(World world, BlockPos pos, BlockState state, LaserArmBlockEntit fired = true; progress += energyRequiredToFire(); - if (progress >= BLOCK_BREAK_ENERGY) { + if (progress >= targetBlockEnergyNeeded) { finishBlockBreaking(targetBlock, targetBlockState); } } @@ -137,7 +138,7 @@ public void tick(World world, BlockPos pos, BlockState state, LaserArmBlockEntit } private void finishBlockBreaking(BlockPos targetBlock, BlockState targetBlockState) { - progress -= BLOCK_BREAK_ENERGY; + progress -= targetBlockEnergyNeeded; var targetEntity = world.getBlockEntity(targetBlock); var dropped = Block.getDroppedStacks(targetBlockState, (ServerWorld) world, targetBlock, targetEntity); @@ -237,11 +238,14 @@ private boolean trySetNewTarget(BlockPos targetPos, boolean alsoSetDirection) { } var distance = targetPos.getManhattanDistance(pos); - if (distance > 64) { + var blockHardness = targetState.getBlock().getHardness(); + if (distance > 64 || blockHardness < 0.01) { return false; } + this.targetBlockEnergyNeeded = (int) (BLOCK_BREAK_ENERGY * blockHardness); this.currentTarget = targetPos; + if (alsoSetDirection) { this.targetDirection = targetPos; updateNetwork(); @@ -458,4 +462,9 @@ public boolean isTargetingAtomicForge() { return world.getBlockState(currentTarget).getBlock().equals(BlockContent.ATOMIC_FORGE_BLOCK); } + public boolean isTargetingEnergyContainer() { + var storageCandidate = EnergyStorage.SIDED.find(world, currentTarget, null); + return storageCandidate != null; + } + } diff --git a/src/main/java/rearth/oritech/block/entity/machines/processing/AssemblerBlockEntity.java b/src/main/java/rearth/oritech/block/entity/machines/processing/AssemblerBlockEntity.java index c9a69938c..f71884384 100644 --- a/src/main/java/rearth/oritech/block/entity/machines/processing/AssemblerBlockEntity.java +++ b/src/main/java/rearth/oritech/block/entity/machines/processing/AssemblerBlockEntity.java @@ -61,7 +61,6 @@ public List getCorePositions() { @Override public List getAddonSlots() { - return List.of( new Vec3i(0, 0,-1), new Vec3i(0, 0,2), diff --git a/src/main/java/rearth/oritech/client/init/ModRenderers.java b/src/main/java/rearth/oritech/client/init/ModRenderers.java index a246f233e..a8ffabf39 100644 --- a/src/main/java/rearth/oritech/client/init/ModRenderers.java +++ b/src/main/java/rearth/oritech/client/init/ModRenderers.java @@ -14,6 +14,7 @@ public class ModRenderers { public static void registerRenderers() { + // processing BlockEntityRendererFactories.register(BlockEntitiesContent.PULVERIZER_ENTITY, ctx -> new MachineRenderer<>("models/pulverizer_block")); BlockEntityRendererFactories.register(BlockEntitiesContent.GRINDER_ENTITY, ctx -> new MachineRenderer<>("models/grinder_block")); BlockEntityRendererFactories.register(BlockEntitiesContent.ASSEMBLER_ENTITY, ctx -> new MachineRenderer<>("models/assembler_block")); @@ -21,12 +22,18 @@ public static void registerRenderers() { BlockEntityRendererFactories.register(BlockEntitiesContent.CENTRIFUGE_ENTITY, ctx -> new MachineRenderer<>("models/centrifuge_block")); BlockEntityRendererFactories.register(BlockEntitiesContent.ATOMIC_FORGE_ENTITY, ctx -> new MachineRenderer<>("models/atomic_forge_block")); BlockEntityRendererFactories.register(BlockEntitiesContent.POWERED_FURNACE_ENTITY, ctx -> new MachineRenderer<>("models/powered_furnace_block")); + + // generators + BlockEntityRendererFactories.register(BlockEntitiesContent.TEST_GENERATOR_ENTITY, ctx -> new MachineRenderer<>("models/test_generator_block")); + BlockEntityRendererFactories.register(BlockEntitiesContent.BASIC_GENERATOR_ENTITY, ctx -> new MachineRenderer<>("models/test_generator_block")); + + // interactions BlockEntityRendererFactories.register(BlockEntitiesContent.LASER_ARM_BLOCK, ctx -> new LaserArmRenderer<>("models/laser_arm_block")); BlockEntityRendererFactories.register(BlockEntitiesContent.PLACER_BLOCK_ENTITY, ctx -> new MachineGantryRenderer()); BlockEntityRendererFactories.register(BlockEntitiesContent.DESTROYER_BLOCK_ENTITY, ctx -> new MachineGantryRenderer()); BlockEntityRendererFactories.register(BlockEntitiesContent.FERTILIZER_BLOCK_ENTITY, ctx -> new MachineGantryRenderer()); - BlockEntityRendererFactories.register(BlockEntitiesContent.FERTILIZER_BLOCK_ENTITY, ctx -> new MachineGantryRenderer()); + // cutout renders BlockRenderLayerMap.INSTANCE.putBlock(BlockContent.MACHINE_FRAME_BLOCK, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(BlockContent.FRAME_GANTRY_ARM, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(BlockContent.BLOCK_PLACER_HEAD, RenderLayer.getCutout()); diff --git a/src/main/java/rearth/oritech/client/init/ModScreens.java b/src/main/java/rearth/oritech/client/init/ModScreens.java index 5dfca2bcf..ba08769bb 100644 --- a/src/main/java/rearth/oritech/client/init/ModScreens.java +++ b/src/main/java/rearth/oritech/client/init/ModScreens.java @@ -17,6 +17,8 @@ public class ModScreens implements AutoRegistryContainer> { public static final ExtendedScreenHandlerType CENTRIFUGE_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new); public static final ExtendedScreenHandlerType ATOMIC_FORGE_SCREEN = new ExtendedScreenHandlerType<>(BasicMachineScreenHandler::new); public static final ExtendedScreenHandlerType POWERED_FURNACE_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new); + public static final ExtendedScreenHandlerType TEST_GENERATOR_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new); + public static final ExtendedScreenHandlerType BASIC_GENERATOR_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new); public static final ExtendedScreenHandlerType DESTROYER_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new); public static final ExtendedScreenHandlerType PLACER_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new); public static final ExtendedScreenHandlerType FERTILIZER_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new); @@ -29,6 +31,8 @@ public static void assignScreens() { HandledScreens.register(FOUNDRY_SCREEN, UpgradableMachineScreen::new); HandledScreens.register(CENTRIFUGE_SCREEN, UpgradableMachineScreen::new); HandledScreens.register(POWERED_FURNACE_SCREEN, UpgradableMachineScreen::new); + HandledScreens.register(TEST_GENERATOR_SCREEN, UpgradableMachineScreen::new); + HandledScreens.register(BASIC_GENERATOR_SCREEN, UpgradableMachineScreen::new); HandledScreens.register(ATOMIC_FORGE_SCREEN, BasicMachineScreen::new); HandledScreens.register(INVENTORY_PROXY_SCREEN, InventoryProxyScreen::new); HandledScreens.register(DESTROYER_SCREEN, UpgradableMachineScreen::new); diff --git a/src/main/java/rearth/oritech/client/renderers/LaserArmRenderer.java b/src/main/java/rearth/oritech/client/renderers/LaserArmRenderer.java index 126e656af..daf531766 100644 --- a/src/main/java/rearth/oritech/client/renderers/LaserArmRenderer.java +++ b/src/main/java/rearth/oritech/client/renderers/LaserArmRenderer.java @@ -48,7 +48,7 @@ public void postRender(MatrixStack matrices, T laserEntity, BakedGeoModel model, var targetPosOffset = targetPos.subtract(Vec3d.of(laserEntity.getPos())); var forward = targetPos.subtract(startPos).normalize(); - if (!laserEntity.isTargetingAtomicForge()) + if (!laserEntity.isTargetingEnergyContainer()) ParticleContent.LASER_BEAM_EFFECT.spawn(laserEntity.getWorld(), startPos.add(forward), new ParticleContent.LineData(startPos.add(forward), targetPos.add(0.5, 0, 0.5).subtract(forward.multiply(0.6)))); var cross = forward.crossProduct(new Vec3d(0, 1,0)); diff --git a/src/main/java/rearth/oritech/init/BlockContent.java b/src/main/java/rearth/oritech/init/BlockContent.java index 0bf0627de..88cbe681f 100644 --- a/src/main/java/rearth/oritech/init/BlockContent.java +++ b/src/main/java/rearth/oritech/init/BlockContent.java @@ -13,6 +13,8 @@ import rearth.oritech.block.blocks.machines.addons.EnergyAddonBlock; import rearth.oritech.block.blocks.machines.addons.InventoryProxyAddonBlock; import rearth.oritech.block.blocks.machines.addons.MachineAddonBlock; +import rearth.oritech.block.blocks.machines.generators.BasicGeneratorBlock; +import rearth.oritech.block.blocks.machines.generators.TestGeneratorBlock; import rearth.oritech.block.blocks.machines.interaction.*; import rearth.oritech.block.blocks.machines.processing.*; import rearth.oritech.util.item.OritechGeoItem; @@ -56,6 +58,10 @@ public class BlockContent implements BlockRegistryContainer { @UseGeoBlockItem(scale = 0.3f) public static final Block ATOMIC_FORGE_BLOCK = new AtomicForgeBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); @UseGeoBlockItem(scale = 0.7f) + public static final Block TEST_GENERATOR_BLOCK = new TestGeneratorBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); + @UseGeoBlockItem(scale = 0.7f) + public static final Block BASIC_GENERATOR_BLOCK = new BasicGeneratorBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); + @UseGeoBlockItem(scale = 0.7f) public static final Block POWERED_FURNACE_BLOCK = new PoweredFurnaceBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); @UseGeoBlockItem(scale = 0.5f) public static final Block LASER_ARM_BLOCK = new LaserArmBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()); diff --git a/src/main/java/rearth/oritech/init/BlockEntitiesContent.java b/src/main/java/rearth/oritech/init/BlockEntitiesContent.java index 616fb2a5c..e30477ae2 100644 --- a/src/main/java/rearth/oritech/init/BlockEntitiesContent.java +++ b/src/main/java/rearth/oritech/init/BlockEntitiesContent.java @@ -10,6 +10,8 @@ import rearth.oritech.block.entity.machines.addons.AddonBlockEntity; import rearth.oritech.block.entity.machines.addons.EnergyAcceptorAddonBlockEntity; import rearth.oritech.block.entity.machines.addons.InventoryProxyAddonBlockEntity; +import rearth.oritech.block.entity.machines.generators.BasicGeneratorEntity; +import rearth.oritech.block.entity.machines.generators.TestGeneratorEntity; import rearth.oritech.block.entity.machines.interaction.DestroyerBlockEntity; import rearth.oritech.block.entity.machines.interaction.FertilizerBlockEntity; import rearth.oritech.block.entity.machines.interaction.LaserArmBlockEntity; @@ -48,9 +50,16 @@ public class BlockEntitiesContent implements AutoRegistryContainer CENTRIFUGE_ENTITY = FabricBlockEntityTypeBuilder.create(CentrifugeBlockEntity::new, BlockContent.CENTRIFUGE_BLOCK).build(); @AssignSidedInventory - @AssignSidedEnergy public static final BlockEntityType ATOMIC_FORGE_ENTITY = FabricBlockEntityTypeBuilder.create(AtomicForgeBlockEntity::new, BlockContent.ATOMIC_FORGE_BLOCK).build(); + @AssignSidedInventory + @AssignSidedEnergy + public static final BlockEntityType TEST_GENERATOR_ENTITY = FabricBlockEntityTypeBuilder.create(TestGeneratorEntity::new, BlockContent.TEST_GENERATOR_BLOCK).build(); + + @AssignSidedInventory + @AssignSidedEnergy + public static final BlockEntityType BASIC_GENERATOR_ENTITY = FabricBlockEntityTypeBuilder.create(BasicGeneratorEntity::new, BlockContent.BASIC_GENERATOR_BLOCK).build(); + @AssignSidedInventory @AssignSidedEnergy public static final BlockEntityType POWERED_FURNACE_ENTITY = FabricBlockEntityTypeBuilder.create(PoweredFurnaceBlockEntity::new, BlockContent.POWERED_FURNACE_BLOCK).build(); diff --git a/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java b/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java index 3d028235f..3068cfb5a 100644 --- a/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java +++ b/src/main/java/rearth/oritech/init/datagen/ModelGenerator.java @@ -35,6 +35,8 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen blockStateModelGenerator.registerSimpleState(BlockContent.ATOMIC_FORGE_BLOCK); blockStateModelGenerator.registerSimpleState(BlockContent.POWERED_FURNACE_BLOCK); blockStateModelGenerator.registerSimpleState(BlockContent.LASER_ARM_BLOCK); + blockStateModelGenerator.registerSimpleState(BlockContent.TEST_GENERATOR_BLOCK); + blockStateModelGenerator.registerSimpleState(BlockContent.BASIC_GENERATOR_BLOCK); blockStateModelGenerator.registerSimpleCubeAll(BlockContent.MACHINE_CORE_BASIC); blockStateModelGenerator.registerSimpleCubeAll(BlockContent.MACHINE_CORE_GOOD); diff --git a/src/main/java/rearth/oritech/init/recipes/RecipeContent.java b/src/main/java/rearth/oritech/init/recipes/RecipeContent.java index 5a50e36a3..6e386ecb6 100644 --- a/src/main/java/rearth/oritech/init/recipes/RecipeContent.java +++ b/src/main/java/rearth/oritech/init/recipes/RecipeContent.java @@ -20,6 +20,7 @@ public class RecipeContent { public static final OritechRecipeType FOUNDRY = register(new Identifier(Oritech.MOD_ID, "foundry")); public static final OritechRecipeType CENTRIFUGE = register(new Identifier(Oritech.MOD_ID, "centrifuge")); public static final OritechRecipeType ATOMIC_FORGE = register(new Identifier(Oritech.MOD_ID, "atomic_forge")); + public static final OritechRecipeType TEST_GENERATOR = register(new Identifier(Oritech.MOD_ID, "test_generator")); private static OritechRecipeType register(Identifier name) { diff --git a/src/main/java/rearth/oritech/network/NetworkContent.java b/src/main/java/rearth/oritech/network/NetworkContent.java index dce130980..6af06a9d0 100644 --- a/src/main/java/rearth/oritech/network/NetworkContent.java +++ b/src/main/java/rearth/oritech/network/NetworkContent.java @@ -9,6 +9,7 @@ import rearth.oritech.block.base.entity.ItemEnergyFrameInteractionBlockEntity; import rearth.oritech.block.base.entity.MachineBlockEntity; import rearth.oritech.block.base.entity.FrameInteractionBlockEntity; +import rearth.oritech.block.base.entity.UpgradableGeneratorBlockEntity; import rearth.oritech.block.entity.machines.addons.InventoryProxyAddonBlockEntity; import rearth.oritech.block.entity.machines.interaction.LaserArmBlockEntity; import rearth.oritech.init.recipes.OritechRecipe; @@ -29,6 +30,7 @@ public record MachineSyncPacket(BlockPos position, long energy, long maxEnergy, // Client -> Server (e.g. from UI interactions public record InventoryInputModeSelectorPacket(BlockPos position) {} public record InventoryProxySlotSelectorPacket(BlockPos position, int slot) {} + public record GeneratorUISyncPacket(BlockPos position, int burnTime) {} public record MachineSetupEventPacket(BlockPos position) {} public record MachineFrameMovementPacket(BlockPos position, BlockPos currentTarget, BlockPos lastTarget, BlockPos areaMin, BlockPos areaMax) {}; // times are in ticks public record MachineFrameGuiPacket(BlockPos position, long currentEnergy, long maxEnergy, int progress){}; @@ -74,6 +76,16 @@ public static void registerChannels() { })); + MACHINE_CHANNEL.registerClientbound(GeneratorUISyncPacket.class, ((message, access) -> { + + var entity = access.player().clientWorld.getBlockEntity(message.position); + + if (entity instanceof UpgradableGeneratorBlockEntity generatorBlock) { + generatorBlock.setCurrentMaxBurnTime(message.burnTime); + } + + })); + MACHINE_CHANNEL.registerClientbound(MachineFrameMovementPacket.class, ((message, access) -> { var entity = access.player().clientWorld.getBlockEntity(message.position); diff --git a/src/main/resources/assets/oritech/animations/block/models/test_generator_block.animation.json b/src/main/resources/assets/oritech/animations/block/models/test_generator_block.animation.json new file mode 100644 index 000000000..9922491ea --- /dev/null +++ b/src/main/resources/assets/oritech/animations/block/models/test_generator_block.animation.json @@ -0,0 +1,230 @@ +{ + "format_version": "1.8.0", + "animations": { + "idle": { + "animation_length": 0.25 + }, + "working": { + "loop": true, + "animation_length": 3, + "bones": { + "gear": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "3.0": { + "vector": [0, -960, 0], + "easing": "easeInOutSine" + } + } + }, + "gear2": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "3.0": { + "vector": [0, 960, 0], + "easing": "easeInOutSine" + } + } + }, + "front_frame": { + "position": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.125": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "0.2917": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "0.4583": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "0.625": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "0.7917": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "0.9583": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "1.1667": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "1.3333": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "1.5": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "1.625": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "1.7917": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "1.9583": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "2.125": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "2.2917": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "2.4583": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "2.625": { + "vector": [0, 0, 0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "2.7917": { + "vector": [0, 0, -0.04], + "easing": "easeInOutElastic", + "easingArgs": [2] + }, + "3.0": { + "vector": [0, 0, 0] + } + } + }, + "beam_inner": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "3.0": { + "vector": [0, 2700, 0] + } + } + }, + "top_holder": { + "rotation": { + "0.0": { + "vector": [0, 0, 0] + }, + "0.125": { + "vector": [0, -2, 0], + "easing": "easeInBounce" + }, + "0.25": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "0.375": { + "vector": [0, -4, 0], + "easing": "easeInBounce" + }, + "0.5": { + "vector": [0, 0.45313, -2] + }, + "0.5417": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "0.7083": { + "vector": [0, -1, 0], + "easing": "easeInBounce" + }, + "0.875": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "1.0417": { + "vector": [0, -2, 0], + "easing": "easeInBounce" + }, + "1.0833": { + "vector": [0, 0.52083, 1] + }, + "1.1667": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "1.2917": { + "vector": [0, -4, 0], + "easing": "easeInBounce" + }, + "1.4583": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "1.625": { + "vector": [0, -1, 0], + "easing": "easeInBounce" + }, + "1.7917": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "1.9583": { + "vector": [0, -2, -2.5], + "easing": "easeInBounce" + }, + "2.0833": { + "vector": [0, 1, -2.5], + "easing": "easeInBounce" + }, + "2.2083": { + "vector": [0, -4, 0], + "easing": "easeInBounce" + }, + "2.375": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "2.5417": { + "vector": [0, -1, 2.5], + "easing": "easeInBounce" + }, + "2.7083": { + "vector": [0, 1, 0], + "easing": "easeInBounce" + }, + "3.0": { + "vector": [0, 0, 0] + } + } + } + } + } + }, + "geckolib_format_version": 2 +} \ No newline at end of file diff --git a/src/main/resources/assets/oritech/geo/block/models/test_generator_block.geo.json b/src/main/resources/assets/oritech/geo/block/models/test_generator_block.geo.json new file mode 100644 index 000000000..5952e3b9c --- /dev/null +++ b/src/main/resources/assets/oritech/geo/block/models/test_generator_block.geo.json @@ -0,0 +1,84 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.unknown", + "texture_width": 128, + "texture_height": 128, + "visible_bounds_width": 3, + "visible_bounds_height": 3.5, + "visible_bounds_offset": [0, 1.25, 0] + }, + "bones": [ + { + "name": "bb_main", + "pivot": [0, 0, 0], + "cubes": [ + {"origin": [-6, 0, -7], "size": [13, 2, 14], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [20, 0]}, + {"origin": [-8, 0, -8], "size": [2, 16, 16], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [0, 0]}, + {"origin": [-6, 2, -5], "size": [2, 11, 2], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [32, 44]}, + {"origin": [-6, 2, 3], "size": [2, 11, 2], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [8, 0]}, + {"origin": [4.85891, 4.6861, -4], "size": [4, 2, 9], "pivot": [0, 8, 0], "rotation": [90, 52.5, 90], "uv": [40, 16]}, + {"origin": [-6, 12.99, -6], "size": [5, 2, 12], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [-1, 35]} + ] + }, + { + "name": "gear", + "pivot": [-3.49667, 3.02, 0.49667], + "rotation": [90, 0, 0], + "cubes": [ + {"origin": [-3, 4.51667, -0.43333], "size": [5, 5, 2], "pivot": [0, 3.51667, 5.47667], "rotation": [0, 0, -90], "uv": [20, 7]}, + {"origin": [-1.99, 3.50667, -0.53333], "size": [3, 7, 1], "pivot": [0, 3.51667, 5.47667], "rotation": [0, 0, -90], "uv": [48, 48]}, + {"origin": [-4, 5.51667, 0.45667], "size": [7, 3, 1], "pivot": [0, 3.51667, 5.47667], "rotation": [0, 0, -90], "uv": [40, 44]} + ] + }, + { + "name": "gear2", + "pivot": [3.50333, 3.02, 0.50333], + "rotation": [90, -90, 0], + "cubes": [ + {"origin": [4, -3.48333, -0.42667], "size": [5, 5, 2], "pivot": [3, -0.48333, 5.48333], "rotation": [0, 0, -90], "uv": [20, 0]}, + {"origin": [5.01, -4.48333, -0.52667], "size": [3, 7, 1], "pivot": [3, -0.48333, 5.48333], "rotation": [0, 0, -90], "uv": [40, 16]}, + {"origin": [3, -2.49333, 0.46333], "size": [7, 3, 1], "pivot": [3, -0.48333, 5.48333], "rotation": [0, 0, -90], "uv": [40, 27]} + ] + }, + { + "name": "top_holder", + "pivot": [-4.5, 15, 0], + "cubes": [ + {"origin": [-6, 14, -3], "size": [9, 2, 6], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [21, 36]} + ] + }, + { + "name": "beam", + "pivot": [0, 8.8, 0], + "rotation": [0, -45, 0], + "cubes": [ + {"origin": [1, 2, -2], "size": [1, 12, 1], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [0, 34]}, + {"origin": [1, 4, 1], "size": [1, 10, 1], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [44, 48]}, + {"origin": [-2, 2, 1], "size": [1, 12, 1], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [40, 48]}, + {"origin": [-2, 4, -2], "size": [1, 10, 1], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [4, 34]} + ] + }, + { + "name": "beam_inner", + "parent": "beam", + "pivot": [0, 8, 0], + "cubes": [ + {"origin": [-1, 2, -1], "size": [2, 12, 2], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [0, 0]} + ] + }, + { + "name": "front_frame", + "pivot": [5, 1, -7], + "cubes": [ + {"origin": [-6, 1, 6], "size": [3, 2, 2], "pivot": [0, 8, 0], "rotation": [0, -90, 0], "uv": [45, 36]}, + {"origin": [6, 1, -8], "size": [2, 2, 16], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [20, 18]}, + {"origin": [3, 1, 6], "size": [3, 2, 2], "pivot": [0, 8, 0], "rotation": [0, 90, 0], "uv": [45, 36]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/oritech/lang/en_us.json b/src/main/resources/assets/oritech/lang/en_us.json index 9179a5e8f..1183e9662 100644 --- a/src/main/resources/assets/oritech/lang/en_us.json +++ b/src/main/resources/assets/oritech/lang/en_us.json @@ -10,7 +10,12 @@ "block.oritech.pulverizer_block": "Pulverizer", "block.oritech.grinder_block": "Grinder", "block.oritech.assembler_block": "Assembler", + "block.oritech.foundry_block": "Foundry", + "block.oritech.centrifuge_block": "Centrifuge", + "block.oritech.atomic_forge_block": "Atomic Forge", "block.oritech.powered_furnace_block": "Powered Furnace", + "block.oritech.basic_generator_block": "Generator", + "block.oritech.laser_arm_block": "Laser Arm", "block.oritech.machine_core": "Machine core", "block.oritech.machine_speed_addon": "Speed Addon", "block.oritech.machine_efficiency_addon": "Energy Efficiency Addon", diff --git a/src/main/resources/assets/oritech/textures/block/models/test_generator_block.png b/src/main/resources/assets/oritech/textures/block/models/test_generator_block.png new file mode 100644 index 0000000000000000000000000000000000000000..e395a09957f2468a218cb1625dbe29bcb69e3a2d GIT binary patch literal 2372 zcmbuB`9BnT7stPrwAd;#VHiTXGEHa<+3!qtk`$>%H9QoVY-JluD*F~@L}Of6*FJJf zvJ4`jv5hUe$&5X_#%>zvOo=a={E{O~@}Hr6J>$E1z{0EEpzL2``L>cG&s*u}&$TU(NBo_~=M#zfXP&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VD5>KKi+ytXCk-E`iutC^HYbcwY3&3g}dF@9Mxdhx&9 zDn;c&shR@{q-{r%FC7ItC$eR|Xr`5!i&qkN<(n<0Bdeix$>~VL17hg(yyLNCXT(`o zx)O$D9(udxU14%ql=P-{UL7861#3(B6WBKAw6&byevoOrk=I_T?T#8Jb9zJ9QD-hoMC6gCjlbWT zSj+Uy2px)gbC!AO-s>}hFUl{K;LlDbJN>>mpV*m~9pK!`U7 zl|V=%rdPw!u^5H&z1h60x_aCNGk>)m0CSMF;ooryN9=U6R_zzwI`>-Adr0 zWwY`cub#=Qi%-)zKV?w(i;Cg_F-q8LO`9^dg+rT!L|yEL-($=(J-$12ZwoF5wlsf{ z&XbokT<47T2BAm0r&A33+|9-0#Qx?D5NB$h8fEl7N|4%BRnGg~08|AH*pI9CYk5qd zhRBoog^EPkLt@E|YPknaaqRw#s2q>NDAdaUd}?i+Cz67ZcpcFXx$Y%ybF0Ta%>2Mr z#yd_T8I;734f{#5APf*pfEH|8AVxCMNFIN`zG}o`!(mf9h?Rk>9wTX{!Vrjm{6s`^ z4g}FixM+t;dw#00_kN1r?Wmx|Qlv(l{7bL(%h+By_4=1+HQlwu(l^cY(n88=K9A~> zyyCmU3}CRdS77#qKsvbL5VB+pRXmCAI-3NAs#l5W5oZ+fwFXw)a5gG#zzGS9Hh$8% za($|ey$GS6UeyGKC)``CHYb8XD!!-@6I6?ZfSo}sRECXlN57aB( zn3vwNSS_8EWRhvsn6$??Cmm;-7~lzj{y^FGXc#JaYNTO55HbIMJ^RAtnaQSj@EAiz R556N{cEuV){qx@Q{{otxh~oeN literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/oritech/textures/item/target_designator.png b/src/main/resources/assets/oritech/textures/item/target_designator.png index 0d7c407bf1b5d10130b24669dd237cb955878e9a..7d0a30bea7509b3dc6fc704bbd3f2ac606a11e6f 100644 GIT binary patch literal 2732 zcmV;d3RCroP)yFZAz>pTavXpWu`~XFg~&ljfFL0NB0`IlfPesr5Fzmw$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