Further Fluid Tank Implementation #78

Closed
34will wants to merge 49 commits from feature/fluid_tank into dev/1.19.x
34will commented 2022-08-16 01:38:51 +00:00 (Migrated from github.com)

Description

Added the following functionality to Fluid Tanks:

  • The ability to fill/drain from the Block in the world, using a Bucket or something that implements/has the capability of IFluidHandlerItem
  • Fluid Tanks now contain the IFluidHandlerItem capability
  • Fixed rendering of the Fluid Tank item
  • Added animation & sound to the filling & draining of the Fluid Tank
  • Made it so that empty (and default configured) Fluid Tank Blocks when broken now stack with other empty (and default configured) Fluid Tank Items.

Possible Breaking Changes:

  • Changes to the MachineBlockEntity mean the IOConfig, Redstone Control, and Inventory data is only written to NBT if it needs to be (i.e. is non-default), so if something expects it to always be there, it now may not be
  • Changes to the copyNBT method of MachinesLootTable to use the new ImprovedContextNbtProvider may affect other things, and may not be futureproof. The ImprovedContextNbtProvider cannot simply extend the ContextNbtProvider class because it privates a lot of its underlying functionality (I implemented ImprovedContextNbtProvider by just duplicating the ContextNbtProvider class and editing the parts I needed to) so if changes occur to ContextNbtProvider in the future, they may not be reflected in this code. I don't know if this is something we could submit a PR to Forge for, to expose the class more?

Checklist:

  • My code follows the style guidelines of this project (.editorconfig, most IDEs will use this for you)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
# Description Added the following functionality to Fluid Tanks: - The ability to fill/drain from the Block in the world, using a Bucket or something that implements/has the capability of `IFluidHandlerItem` - Fluid Tanks now contain the `IFluidHandlerItem` capability - Fixed rendering of the Fluid Tank item - Added animation & sound to the filling & draining of the Fluid Tank - Made it so that empty (and default configured) Fluid Tank Blocks when broken now stack with other empty (and default configured) Fluid Tank Items. Possible Breaking Changes: - Changes to the `MachineBlockEntity` mean the IOConfig, Redstone Control, and Inventory data is only written to NBT if it needs to be (i.e. is non-default), so if something expects it to always be there, it now may not be - Changes to the `copyNBT` method of `MachinesLootTable` to use the new `ImprovedContextNbtProvider` may affect other things, and may not be futureproof. The `ImprovedContextNbtProvider` cannot simply extend the `ContextNbtProvider` class because it `private`s a lot of its underlying functionality (I implemented `ImprovedContextNbtProvider` by just duplicating the `ContextNbtProvider` class and editing the parts I needed to) so if changes occur to `ContextNbtProvider` in the future, they may not be reflected in this code. I don't know if this is something we could submit a PR to Forge for, to expose the class more? # Checklist: - [x] My code follows the style guidelines of this project (.editorconfig, most IDEs will use this for you) - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation <!-- Thanks to: https://embeddedartistry.com/blog/2017/08/04/a-github-pull-request-template-for-your-projects/ for the building blocks of this template -->
Rover656 (Migrated from github.com) requested changes 2022-08-16 12:57:25 +00:00
Rover656 (Migrated from github.com) left a comment

Just a quick skim through, a number of comments and changes. I'm not a fan of how some of the animation stuff is working in terms of tracking all the block entities in a map; might be worth looking into other ways of doing this (maybe storing the animation state on the BE instead somehow).

Just a quick skim through, a number of comments and changes. I'm not a fan of how some of the animation stuff is working in terms of tracking all the block entities in a map; might be worth looking into other ways of doing this (maybe storing the animation state on the BE instead somehow).
@ -59,0 +60,4 @@
/**
* Whether the IO config is unchanged from initial values.
*/
boolean isDefault();
Rover656 (Migrated from github.com) commented 2022-08-16 12:45:15 +00:00

Personally not a fan of having this method, but I'm unsure of a way that would alleviate the need for it

Personally not a fan of having this method, but I'm unsure of a way that would alleviate the need for it
@ -0,0 +6,4 @@
/**
* Class for animating between two values over an amount of time, using {@link Mth#lerp}.
*/
public class Animation {
Rover656 (Migrated from github.com) commented 2022-08-16 12:56:35 +00:00

Javadocs please :)

Javadocs please :)
Rover656 (Migrated from github.com) commented 2022-08-16 12:46:09 +00:00

Might be worth investigating if there's a vanilla constant for this, but I do like the idea of keeping all our tags together

Might be worth investigating if there's a vanilla constant for this, but I do like the idea of keeping all our tags together
Rover656 (Migrated from github.com) commented 2022-08-16 12:46:47 +00:00

Can you use the annotations instead of registering manually here please

Can you use the annotations instead of registering manually here please
Rover656 (Migrated from github.com) commented 2022-08-16 12:48:54 +00:00

I'm not a massive fan of tracking things like this, but again I understand why its here

I'm not a massive fan of tracking things like this, but again I understand why its here
@ -35,2 +42,2 @@
if (tank.getFluidAmount() > 0) {
FluidStack fluidStack = tank.getFluid();
// Check to see if there is an existing animation for this block.
AnimationInformation information = blockEntity.getAnimationInformation();
Rover656 (Migrated from github.com) commented 2022-08-16 12:47:23 +00:00

Could I ask for more documentation around the animation implementation you've added?

Could I ask for more documentation around the animation implementation you've added?
@ -96,2 +107,4 @@
&& outputItem.getCount() < outputItem.getMaxStackSize())) {
if (fillTankFromBucket(filledBucket) > 0) {
inputItem.shrink(1);
getInventory().insertItem(1, Items.BUCKET.getDefaultInstance(), false);
Rover656 (Migrated from github.com) commented 2022-08-16 12:50:16 +00:00

Maybe move this into a static utility class like the EnergyUtil?

Maybe move this into a static utility class like the EnergyUtil?
Rover656 (Migrated from github.com) commented 2022-08-16 12:50:48 +00:00

Mark shouldDrain as nullable if you're allowing null

Mark shouldDrain as nullable if you're allowing null
Rover656 (Migrated from github.com) commented 2022-08-16 12:51:36 +00:00

is it necessary to try calling remove? As far as my understanding goes, whenever save is called its a fresh tag, so existing keys shouldn't be present?

is it necessary to try calling remove? As far as my understanding goes, whenever save is called its a fresh tag, so existing keys shouldn't be present?
@ -417,3 +415,3 @@
public void load(CompoundTag pTag) {
// Load io config.
ioConfig.deserializeNBT(pTag.getCompound("io_config"));
ioConfig.deserializeNBT(pTag.getCompound(MachineNbtTags.IO_CONFIG_NBT_KEY));
Rover656 (Migrated from github.com) commented 2022-08-16 12:52:33 +00:00

I don't think its necessary to do this check, for the very little storage it saves it'll add a bunch of time onto the saving process

I don't think its necessary to do this check, for the very little storage it saves it'll add a bunch of time onto the saving process
@ -26,4 +58,28 @@ public class FluidTankItem extends BlockItem {
}
Rover656 (Migrated from github.com) commented 2022-08-16 12:53:40 +00:00

Why this check? We know this is a FluidTankItem

Why this check? We know this is a FluidTankItem
@ -0,0 +27,4 @@
* entity's NBT data based on an {@link LootContext.EntityTarget} but without
* the id and positional data.
*/
public class ImprovedContextNbtProvider implements NbtProvider {
Rover656 (Migrated from github.com) commented 2022-08-16 12:54:34 +00:00

What is the motive behind needing this over the old system?

What is the motive behind needing this over the old system?
justliliandev (Migrated from github.com) reviewed 2022-08-16 13:00:52 +00:00
justliliandev (Migrated from github.com) commented 2022-08-16 13:00:51 +00:00

There is only a private one in BlockItem

There is only a private one in BlockItem
justliliandev (Migrated from github.com) reviewed 2022-08-16 13:02:03 +00:00
@ -96,2 +107,4 @@
&& outputItem.getCount() < outputItem.getMaxStackSize())) {
if (fillTankFromBucket(filledBucket) > 0) {
inputItem.shrink(1);
getInventory().insertItem(1, Items.BUCKET.getDefaultInstance(), false);
justliliandev (Migrated from github.com) commented 2022-08-16 13:02:02 +00:00

also fix naming. Methods start with a lowercase words

also fix naming. Methods start with a lowercase words
34will (Migrated from github.com) reviewed 2022-08-16 20:08:49 +00:00
@ -417,3 +415,3 @@
public void load(CompoundTag pTag) {
// Load io config.
ioConfig.deserializeNBT(pTag.getCompound("io_config"));
ioConfig.deserializeNBT(pTag.getCompound(MachineNbtTags.IO_CONFIG_NBT_KEY));
34will (Migrated from github.com) commented 2022-08-16 20:08:49 +00:00

The reason for this check is that when the BlockEntity is converted over into an Item after being broken, it retains the extra information in the NBT data. So, for example, when a Fluid Tank is spawned/crafted into the inventory, its item NBT data is {id: "enderio:fluid_tank", Count: 1b}. When it is placed into the world, then immediately broken again, its item NBT data (without my changes) becomes: {id: "enderio:fluid_tank", Count: 1b, tag: {BlockEntityTag: {x: ..., y: ..., z: ..., io_config: ..., redstone: ..., inventory: ..., id: "enderio:fluid_tank"}}}. This has the annoying (to me at least), although admittedly not game-breaking, issue of the fact that that Fluid Tank item will not stack with another empty Fluid Tank, despite no logical reason not to.

This was simply the first way I came across of (partly) solving the issue. So I could move the functionality across into the NBT copying? But would probably need a specific provider for the Machine blocks, in the event that other things need to use that functionality.

I'll have to defer to your better judgement about the about the time in the saving process, but I could try to simplify the checks to just simple boolean checks by updating whether each item is empty/default when they are changed? Also isn't it better to potentially not save & transmit data, even at the slight increased complexity/time cost?

The reason for this check is that when the `BlockEntity` is converted over into an `Item` after being broken, it retains the extra information in the NBT data. So, for example, when a Fluid Tank is spawned/crafted into the inventory, its item NBT data is `{id: "enderio:fluid_tank", Count: 1b}`. When it is placed into the world, then immediately broken again, its item NBT data (without my changes) becomes: `{id: "enderio:fluid_tank", Count: 1b, tag: {BlockEntityTag: {x: ..., y: ..., z: ..., io_config: ..., redstone: ..., inventory: ..., id: "enderio:fluid_tank"}}}`. This has the annoying (to me at least), although admittedly not game-breaking, issue of the fact that that Fluid Tank item will not stack with another empty Fluid Tank, despite no logical reason not to. This was simply the first way I came across of (partly) solving the issue. So I could move the functionality across into the NBT copying? But would probably need a specific provider for the Machine blocks, in the event that other things need to use that functionality. I'll have to defer to your better judgement about the about the time in the saving process, but I could try to simplify the checks to just simple boolean checks by updating whether each item is empty/default when they are changed? Also isn't it better to potentially not save & transmit data, even at the slight increased complexity/time cost?
34will (Migrated from github.com) reviewed 2022-08-16 20:14:58 +00:00
@ -26,4 +58,28 @@ public class FluidTankItem extends BlockItem {
}
34will (Migrated from github.com) commented 2022-08-16 20:14:57 +00:00

I just copied this from the BucketIem where they do the same check. It does seem odd, so happy to remove.

I just copied this from the `BucketIem` where they do the same check. It does seem odd, so happy to remove.
34will (Migrated from github.com) reviewed 2022-08-16 20:16:39 +00:00
@ -35,2 +42,2 @@
if (tank.getFluidAmount() > 0) {
FluidStack fluidStack = tank.getFluid();
// Check to see if there is an existing animation for this block.
AnimationInformation information = blockEntity.getAnimationInformation();
34will (Migrated from github.com) commented 2022-08-16 20:16:39 +00:00

Yes of course, do you mean just comments and Javadocs, or actual documentation in like a wiki or something?

Yes of course, do you mean just comments and Javadocs, or actual documentation in like a wiki or something?
34will (Migrated from github.com) reviewed 2022-08-16 21:56:30 +00:00
34will (Migrated from github.com) commented 2022-08-16 21:56:30 +00:00

Fixed in 7de7cbaaa8 and 11535800ec

Fixed in 7de7cbaaa8a9c24b9bea48518feedc2b6fafac79 and 11535800ec28e4b58dcd4a4123647bda116bc039
34will (Migrated from github.com) reviewed 2022-08-16 22:17:35 +00:00
@ -96,2 +107,4 @@
&& outputItem.getCount() < outputItem.getMaxStackSize())) {
if (fillTankFromBucket(filledBucket) > 0) {
inputItem.shrink(1);
getInventory().insertItem(1, Items.BUCKET.getDefaultInstance(), false);
34will (Migrated from github.com) commented 2022-08-16 22:17:34 +00:00

Fixed in ccb0d52f86

Fixed in ccb0d52f862fb553321db570a897ecd4b6c7b7db
34will (Migrated from github.com) reviewed 2022-08-16 22:48:48 +00:00
@ -96,2 +107,4 @@
&& outputItem.getCount() < outputItem.getMaxStackSize())) {
if (fillTankFromBucket(filledBucket) > 0) {
inputItem.shrink(1);
getInventory().insertItem(1, Items.BUCKET.getDefaultInstance(), false);
34will (Migrated from github.com) commented 2022-08-16 22:48:48 +00:00

Fixed in 06c076d25b

Fixed in 06c076d25b74df9093933ecb397774aed2d55f4f
Rover656 (Migrated from github.com) reviewed 2022-08-16 22:49:53 +00:00
@ -35,2 +42,2 @@
if (tank.getFluidAmount() > 0) {
FluidStack fluidStack = tank.getFluid();
// Check to see if there is an existing animation for this block.
AnimationInformation information = blockEntity.getAnimationInformation();
Rover656 (Migrated from github.com) commented 2022-08-16 22:49:52 +00:00

Yeah just comments and javadocs please

Yeah just comments and javadocs please
34will (Migrated from github.com) reviewed 2022-08-16 23:26:02 +00:00
@ -0,0 +6,4 @@
/**
* Class for animating between two values over an amount of time, using {@link Mth#lerp}.
*/
public class Animation {
34will (Migrated from github.com) commented 2022-08-16 23:26:02 +00:00

Fixed in cb65ecffc8

Fixed in cb65ecffc869a1b00025ff0c587219e4f69e6153
34will (Migrated from github.com) reviewed 2022-08-17 00:02:21 +00:00
@ -35,2 +42,2 @@
if (tank.getFluidAmount() > 0) {
FluidStack fluidStack = tank.getFluid();
// Check to see if there is an existing animation for this block.
AnimationInformation information = blockEntity.getAnimationInformation();
34will (Migrated from github.com) commented 2022-08-17 00:02:21 +00:00

Fixed in 3010b205c2

Fixed in 3010b205c2c2779c487f29d5f68ad5f32ac068e6
34will commented 2022-08-17 00:05:32 +00:00 (Migrated from github.com)

I'm not a fan of how some of the animation stuff is working in terms of tracking all the block entities in a map; might be worth looking into other ways of doing this (maybe storing the animation state on the BE instead somehow).

I'm not sure why I didn't store the animation information in the BE in the first place 😅 I will give that a go.

> I'm not a fan of how some of the animation stuff is working in terms of tracking all the block entities in a map; might be worth looking into other ways of doing this (maybe storing the animation state on the BE instead somehow). I'm not sure why I didn't store the animation information in the BE in the first place 😅 I will give that a go.
34will (Migrated from github.com) reviewed 2022-08-22 18:44:14 +00:00
@ -0,0 +27,4 @@
* entity's NBT data based on an {@link LootContext.EntityTarget} but without
* the id and positional data.
*/
public class ImprovedContextNbtProvider implements NbtProvider {
34will (Migrated from github.com) commented 2022-08-22 18:44:14 +00:00

As with the other checks above the reason for this is that when the BlockEntity is converted over into an Item after being broken, it retains extra unneeded BlockEntity information in the NBT data. So, for example, when a Fluid Tank is spawned/crafted into the inventory, its item NBT data is {id: "enderio:fluid_tank", Count: 1b}. When it is placed into the world, then immediately broken again, its item NBT data (without this class) becomes: {id: "enderio:fluid_tank", Count: 1b, tag: {BlockEntityTag: {x: ..., y: ..., z: ..., id: "enderio:fluid_tank"}}}. Again, this has the annoying issue of the Fluid Tank item not stacking with another empty Fluid Tank.

This issue comes from the ContextNbtProvider calling saveWithFullMetadata on the BlockEntity, writing the x, y, z, and id to the NBT Tag. This provider is a carbon copy of the ContextNbtProvider class, except it calls saveWithoutMetadata on the BlockEntity, and returns null if that returns null. I would have just extended the ContextNbtProvider class, but the relevant methods to override are private.

As I mentioned above, the other exclusion of tags being written could be performed here as well.

As with the other checks above the reason for this is that when the `BlockEntity` is converted over into an Item after being broken, it retains extra unneeded `BlockEntity` information in the NBT data. So, for example, when a Fluid Tank is spawned/crafted into the inventory, its item NBT data is `{id: "enderio:fluid_tank", Count: 1b}`. When it is placed into the world, then immediately broken again, its item NBT data (without this class) becomes: `{id: "enderio:fluid_tank", Count: 1b, tag: {BlockEntityTag: {x: ..., y: ..., z: ..., id: "enderio:fluid_tank"}}}`. Again, this has the annoying issue of the Fluid Tank item not stacking with another empty Fluid Tank. This issue comes from the `ContextNbtProvider` calling `saveWithFullMetadata` on the `BlockEntity`, writing the `x`, `y`, `z`, and `id` to the NBT Tag. This provider is a carbon copy of the `ContextNbtProvider` class, except it calls `saveWithoutMetadata` on the `BlockEntity`, and returns `null` if that returns `null`. I would have just extended the `ContextNbtProvider` class, but the relevant methods to override are `private`. As I mentioned above, the other exclusion of tags being written could be performed here as well.
justliliandev (Migrated from github.com) requested changes 2022-08-31 13:05:19 +00:00
@ -0,0 +1,84 @@
package com.enderio.core.client.rendering;
justliliandev (Migrated from github.com) commented 2022-08-31 10:22:02 +00:00

Fix link using # and put in one line

 * Class for animating between two values over an amount of time, using {@link Mth#lerp}.
Fix link using # and put in one line ```suggestion * Class for animating between two values over an amount of time, using {@link Mth#lerp}. ```
justliliandev (Migrated from github.com) commented 2022-08-31 10:34:59 +00:00

make start, target and totalDurationTick final

make start, target and totalDurationTick final
@ -16,57 +19,152 @@ import net.minecraft.core.Direction;
import net.minecraft.world.inventory.InventoryMenu;
justliliandev (Migrated from github.com) commented 2022-08-31 11:17:25 +00:00

fluid will be assigned in the constructor, don't do it here

fluid will be assigned in the constructor, don't do it here
justliliandev (Migrated from github.com) commented 2022-08-31 11:22:13 +00:00

fluids shouldn't be nullable but rather Fluids.EMPTY

fluids shouldn't be nullable but rather Fluids.EMPTY
justliliandev (Migrated from github.com) commented 2022-08-31 11:22:36 +00:00

not Nullable

not Nullable
justliliandev (Migrated from github.com) commented 2022-08-31 11:23:45 +00:00

mark nullable

mark nullable
justliliandev (Migrated from github.com) commented 2022-08-31 11:27:30 +00:00

Don't use exceptions for controlflow, the exception will never be thrown here, as ANIMATION_TICKS is positive

Don't use exceptions for controlflow, the exception will never be thrown here, as ANIMATION_TICKS is positive
justliliandev (Migrated from github.com) commented 2022-08-31 11:20:48 +00:00

mark as nullable

mark as nullable
@ -0,0 +1,200 @@
package com.enderio.machines.common.block;
justliliandev (Migrated from github.com) commented 2022-08-31 11:58:51 +00:00
            sound = fluid.getPickupSound().orElse(SoundEvents.BUCKET_FILL);
```suggestion sound = fluid.getPickupSound().orElse(SoundEvents.BUCKET_FILL); ```
justliliandev (Migrated from github.com) commented 2022-08-31 12:06:05 +00:00

use fluidHandlerCap.isEmpty

use fluidHandlerCap.isEmpty
justliliandev (Migrated from github.com) commented 2022-08-31 12:12:23 +00:00
            itemIsEmpty = fluidHandler.getFluidInTank(i).isEmpty();
```suggestion itemIsEmpty = fluidHandler.getFluidInTank(i).isEmpty(); ```
justliliandev (Migrated from github.com) commented 2022-08-31 12:23:20 +00:00

can be simplified to blockIsEmpty, because if blockIsEmpty, item can't be empty, because of the return ealier

can be simplified to blockIsEmpty, because if blockIsEmpty, item can't be empty, because of the return ealier
justliliandev (Migrated from github.com) commented 2022-08-31 12:23:48 +00:00

can be simplified to itemIsEmpty, because block can't be empty, because of previous returns

can be simplified to itemIsEmpty, because block can't be empty, because of previous returns
justliliandev (Migrated from github.com) commented 2022-08-31 12:25:31 +00:00

the fallthorugh sems to handle this correctly, but is hard to read, add return result.getLeft(); to the first case

the fallthorugh sems to handle this correctly, but is hard to read, add `return result.getLeft();` to the first case
justliliandev (Migrated from github.com) commented 2022-08-31 12:28:24 +00:00

move fluidHandler to a local variable in the constructor, as it's only used there

move fluidHandler to a local variable in the constructor, as it's only used there
justliliandev (Migrated from github.com) commented 2022-08-31 12:30:58 +00:00

add Nullable annotation and add UseOnly(LogicalSide.CLIENT)

add Nullable annotation and add UseOnly(LogicalSide.CLIENT)
@ -115,0 +125,4 @@
public int fillTankFromBucket(@Nullable BucketItem bucket) {
return FluidUtil.fillTankFromBucket(fluidTank, bucket);
}
justliliandev (Migrated from github.com) commented 2022-08-31 12:31:53 +00:00

Add UseOnly(LogicalSide.CLIENT) Annotation

Add UseOnly(LogicalSide.CLIENT) Annotation
justliliandev (Migrated from github.com) commented 2022-08-31 12:32:28 +00:00

Add Nullable Annotation

Add Nullable Annotation
@ -390,3 +381,4 @@
neighbor.getCapability(ForgeCapabilities.FLUID_HANDLER, direction.getOpposite())));
} else {
itemHandlerCache.put(direction, LazyOptional.empty());
fluidHandlerCache.put(direction, LazyOptional.empty());
justliliandev (Migrated from github.com) commented 2022-08-31 12:37:51 +00:00

undo change

undo change
@ -412,1 +402,3 @@
pTag.put("inventory", inventory.serializeNBT());
if (supportsRedstoneControl()) {
RedstoneControl redstoneControl = getRedstoneControl();
if (redstoneControl != RedstoneControl.ALWAYS_ACTIVE) {
justliliandev (Migrated from github.com) commented 2022-08-31 12:44:22 +00:00

add this to MachineInventory

public boolean isEmpty() {
    return stacks.stream().noneMatch(ItemStack::isEmpty);
}

so this can be replaced with !inventory.isEmpty()

add this to MachineInventory ``` public boolean isEmpty() { return stacks.stream().noneMatch(ItemStack::isEmpty); } ``` so this can be replaced with !inventory.isEmpty()
@ -0,0 +1,136 @@
package com.enderio.base.common.loot.providers.nbt;
justliliandev (Migrated from github.com) commented 2022-08-31 13:01:10 +00:00

use Set.of

use Set.of
justliliandev (Migrated from github.com) commented 2022-08-31 13:01:51 +00:00

name parameter

name parameter
justliliandev (Migrated from github.com) commented 2022-08-31 13:02:13 +00:00

use Set.of

use Set.of
justliliandev (Migrated from github.com) commented 2022-08-31 13:03:28 +00:00

This seems to be unused, if there is likely a future reason for it, keep it

This seems to be unused, if there is likely a future reason for it, keep it
justliliandev (Migrated from github.com) commented 2022-08-31 13:04:53 +00:00

put on one line, rename Serializer to JsonSeriailzer or something, so you can import it

put on one line, rename Serializer to JsonSeriailzer or something, so you can import it
justliliandev (Migrated from github.com) commented 2022-08-31 13:05:00 +00:00

name parameter

name parameter
34will (Migrated from github.com) reviewed 2022-09-07 20:45:17 +00:00
@ -16,57 +19,152 @@ import net.minecraft.core.Direction;
import net.minecraft.world.inventory.InventoryMenu;
34will (Migrated from github.com) commented 2022-09-07 20:45:16 +00:00

So would you prefer that I don't throw the Exception in the Animation constructor? Is there a way for it to bypass the Exception with an Annotation or something given that we know ANIMATION_TICKS is greater than zero? Sorry, I'm not versed in the deeper nuances of Java

So would you prefer that I don't throw the Exception in the `Animation` constructor? Is there a way for it to bypass the Exception with an Annotation or something given that we know `ANIMATION_TICKS` is greater than zero? Sorry, I'm not versed in the deeper nuances of Java
34will (Migrated from github.com) reviewed 2022-09-07 21:33:05 +00:00
34will (Migrated from github.com) commented 2022-09-07 21:33:04 +00:00

Apologies, this is because I am coding with VSCode, and the .editorconfig values don't seem to be being respected. I did download IntelliJ to check, and it put this on one line, which is different from what this was originally. I have just left it as one line.

Apologies, this is because I am coding with VSCode, and the `.editorconfig` values don't seem to be being respected. I did download IntelliJ to check, and it put this on one line, which is different from what this was originally. I have just left it as one line.
34will (Migrated from github.com) reviewed 2022-09-07 21:34:01 +00:00
@ -390,3 +381,4 @@
neighbor.getCapability(ForgeCapabilities.FLUID_HANDLER, direction.getOpposite())));
} else {
itemHandlerCache.put(direction, LazyOptional.empty());
fluidHandlerCache.put(direction, LazyOptional.empty());
34will (Migrated from github.com) commented 2022-09-07 21:34:01 +00:00

Again, this is because I am coding with VSCode, my apologies. I did format it with IntelliJ which gave something different to both, so I have left that in.

Again, this is because I am coding with VSCode, my apologies. I did format it with IntelliJ which gave something different to both, so I have left that in.
justliliandev (Migrated from github.com) reviewed 2022-09-07 21:35:00 +00:00
@ -16,57 +19,152 @@ import net.minecraft.core.Direction;
import net.minecraft.world.inventory.InventoryMenu;
justliliandev (Migrated from github.com) commented 2022-09-07 21:35:00 +00:00

throw an illegalargumentexception, don't declare that the constructor throws something and remove the catch

throw an illegalargumentexception, don't declare that the constructor throws something and remove the catch
34will (Migrated from github.com) reviewed 2022-09-07 21:46:31 +00:00
@ -0,0 +1,136 @@
package com.enderio.base.common.loot.providers.nbt;
34will (Migrated from github.com) commented 2022-09-07 21:46:31 +00:00

The ContextNbtProvider that I shamelessly copied this from uses this, so I'm reluctant to change it, but if you think it's okay, then I will.

The `ContextNbtProvider` that I shamelessly copied this from uses this, so I'm reluctant to change it, but if you think it's okay, then I will.
34will (Migrated from github.com) reviewed 2022-09-07 21:46:35 +00:00
@ -0,0 +1,136 @@
package com.enderio.base.common.loot.providers.nbt;
34will (Migrated from github.com) commented 2022-09-07 21:46:35 +00:00

The ContextNbtProvider that I shamelessly copied this from uses this, so I'm reluctant to change it, but if you think it's okay, then I will.

The `ContextNbtProvider` that I shamelessly copied this from uses this, so I'm reluctant to change it, but if you think it's okay, then I will.
justliliandev (Migrated from github.com) reviewed 2022-09-07 22:13:57 +00:00
@ -0,0 +1,136 @@
package com.enderio.base.common.loot.providers.nbt;
justliliandev (Migrated from github.com) commented 2022-09-07 22:13:56 +00:00

it's effectivly the same, and at that point it's personal preference. ImmutableSet could indicate, that someone wants implementationdetails for a specific reason, while the set just indicates, that you want a set

it's effectivly the same, and at that point it's personal preference. ImmutableSet could indicate, that someone wants implementationdetails for a specific reason, while the set just indicates, that you want a set

Pull request closed

Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Team-EnderIO/EnderIO#78
No description provided.