Modular machine blockentity #173
No reviewers
Labels
No labels
Area-Assets
Area-Backend
Area-Conduits
Area-Datapacks
Area-Lang
Area-Mod Compat
Area-Parity
Area-Rendering
Good first issue
MC-1.19.2
MC-1.20.1
MC-1.20.4
MC-1.20.6
MC-1.21
MC-1.21.1
Modtoberfest
P-0-High
P-1-Medium
P-2-Low
Status-Awaiting Response
Status-Behind-Flag
Status-Blocked
Status-Cannot Reproduce
Status-Duplicate
Status-Help Wanted
Status-Incomplete Report
Status-Invalid
Status-Needs LTS Backport
Status-Needs Updating
Status-Stale
Status-To Implement
Status-Triage
Status-Wontfix
Status-Wontmerge
Type-Backport
Type-Bug
Type-Documentation
Type-Enhancement
Type-Question
Type-RFC
Type-Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Team-EnderIO/EnderIO#173
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/modular-machine-blockentity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Change summary:
Future work
Checklist:
@ -0,0 +61,4 @@protected abstract void consumeInputs(R recipe);protected abstract int makeProgress(int remainingProgress);The rationale behind "progress" is to allow machines that may not necessarily consume power to still take advantage of the crafting tasks. 90% of time, "progress" will just be "energy".
@ -0,0 +140,4 @@// region Resource Depletionprotected boolean placeOutputs(List<OutputStack> outputs, boolean simulate) {// TODO: Handle fluids too.At some point I might make a "MachineStorages" class/interface or something that will allow fetching of inventories, tanks or any other kinds of resource targets, rather than having to pass the inventory, tank etc. every time individually.
This class has just been "stubbed" to use the new task host, it prove that the host had the same functionality as the original.
The idea however is for this class (and other abstract classes inheriting from PoweredMachineEntity) will be getting removed.
This was removed because it was simply not required turns out; idk who added this or why (was probably me during one of the million rewrites)
I need to verify this; feels like it should actually be false.
This is the most important read; this is what a converted machine will look like.
Is this not the way other mods interact with our caps? This is how we expose caps no?
Capability providers are doing this for us;
9e37ca9b2a/src/core/java/com/enderio/core/common/blockentity/EnderBlockEntity.java (L237)Some more comments for myself.
@ -172,2 +50,2 @@public static final QuadraticScalable CAPACITY = new QuadraticScalable(CapacitorModifier.ENERGY_CAPACITY, () -> 100000f);public static final QuadraticScalable USAGE = new QuadraticScalable(CapacitorModifier.ENERGY_USE, () -> 30f);public static final QuadraticScalable CAPACITY = new QuadraticScalable(CapacitorModifier.ENERGY_CAPACITY, MachinesConfig.COMMON.ENERGY.ALLOY_SMELTER_CAPACITY);public static final QuadraticScalable USAGE = new QuadraticScalable(CapacitorModifier.ENERGY_USE, MachinesConfig.COMMON.ENERGY.ALLOY_SMELTER_USAGE);Still need to move this into its own file for clarity
I think I will make this go at the same config value for the generation rate of the stirling generator.
Might just do a hasEnergy() on the PoweredMachineEntity class
@ -0,0 +1,12 @@package com.enderio.machines.common.blockentity.task;Still need to do this
This method will return the event rather than the (non existent) SpawnGroupData
Just some minor questions on my first read
@ -41,2 +46,4 @@private final MachineTaskHost taskHost;public PoweredSpawnerBlockEntity(BlockEntityType type, BlockPos worldPosition, BlockState blockState) {Seems I have forgotten to turn the colour into a config like the vacuum blocks, but that should be done.
@ -36,10 +43,18 @@ public class StirlingGeneratorBlockEntity extends PowerGeneratingMachineEntity {public StirlingGeneratorBlockEntity(BlockEntityType<?> type, BlockPos worldPosition,BlockState blockState) {What does the min do here, as less then 1 is 0?
this generateParticle method should be a base method (together with the range values).
@ -0,0 +121,4 @@return;}// Load any pending tasks.This is still the same
OnLoadlogic, right? So it still doesn't run properly when placing a block (needed for the spawner).@ -36,10 +43,18 @@ public class StirlingGeneratorBlockEntity extends PowerGeneratingMachineEntity {public StirlingGeneratorBlockEntity(BlockEntityType<?> type, BlockPos worldPosition,BlockState blockState) {ah crap yea that should be a max, its just to stop the scale going to 0.
could you expland?
@ -41,2 +46,4 @@private final MachineTaskHost taskHost;public PoweredSpawnerBlockEntity(BlockEntityType type, BlockPos worldPosition, BlockState blockState) {I'd leave that to a future PR, this one's scope is already really wise
@ -0,0 +121,4 @@return;}// Load any pending tasks.Yeah it is, whats not working exactly?
Currently, you can find the same method in all classes that have a range (vacuum blocks and powered spawner). It would be better to place it in the base machine class with a getRange method (and storing of that range in nbt) that these classes can overwrite. As to not reimplement it every time.
@ -0,0 +121,4 @@return;}// Load any pending tasks.that OnLoad is called before Load when placing a block, making it so the BlockEntityData with the entitytype is empty when the task is created. After adding power the task gets remade and is fine.
@ -36,10 +43,18 @@ public class StirlingGeneratorBlockEntity extends PowerGeneratingMachineEntity {public StirlingGeneratorBlockEntity(BlockEntityType<?> type, BlockPos worldPosition,BlockState blockState) {Yeah that makes more sense
I'm going to say that that's a future PR thing; this PR's scope is already pretty wide
looks good
@ -74,22 +75,29 @@ public class MachineBlock extends BaseEntityBlock {private void updateBlockEntityCache(LevelReader level, BlockPos pos) {don't do a blind cast
@ -0,0 +36,4 @@public VacuumMachineBlockEntity(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState, Class<T> targetClass) {super(pType, pWorldPosition, pBlockState);this.targetClass = targetClass;add2WayDataSlot(new IntegerDataSlot(this::getRange, this::setRange, SyncMode.GUI));rename clazz to targetClass