More SonarQube fixes.

This commit is contained in:
raoulvdberge
2020-10-17 17:08:04 +02:00
parent a4cac8f971
commit 931a6990e2
22 changed files with 144 additions and 141 deletions

View File

@@ -230,8 +230,8 @@ public class ExternalStorageNetworkNode extends NetworkNode implements IStorageP
}
}
network.getNodeGraph().runActionWhenPossible(ItemStorageCache.INVALIDATE.apply(cause));
network.getNodeGraph().runActionWhenPossible(FluidStorageCache.INVALIDATE.apply(cause));
network.getNodeGraph().runActionWhenPossible(ItemStorageCache.INVALIDATE_ACTION.apply(cause));
network.getNodeGraph().runActionWhenPossible(FluidStorageCache.INVALIDATE_ACTION.apply(cause));
}
@Override

View File

@@ -26,7 +26,7 @@ import java.util.UUID;
public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
private static final String NBT_OWNER = "Owner";
private static final String NBT_VERSION = "Version";
private static final int VERSION = 1;
private static final int CURRENT_VERSION = 1;
@Nullable
protected INetwork network;
@@ -179,7 +179,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
tag.putUniqueId(NBT_OWNER, owner);
}
tag.putInt(NBT_VERSION, VERSION);
tag.putInt(NBT_VERSION, CURRENT_VERSION);
writeConfiguration(tag);

View File

@@ -150,8 +150,8 @@ public class DiskDriveNetworkNode extends NetworkNode implements IStorageProvide
LOGGER.debug("Connectivity state of disk drive at {} changed to {} due to {}", pos, state, cause);
network.getNodeGraph().runActionWhenPossible(ItemStorageCache.INVALIDATE.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
network.getNodeGraph().runActionWhenPossible(FluidStorageCache.INVALIDATE.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
network.getNodeGraph().runActionWhenPossible(ItemStorageCache.INVALIDATE_ACTION.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
network.getNodeGraph().runActionWhenPossible(FluidStorageCache.INVALIDATE_ACTION.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
WorldUtils.updateBlock(world, pos);
}

View File

@@ -98,7 +98,7 @@ public class FluidStorageNetworkNode extends NetworkNode implements IStorageScre
LOGGER.debug("Connectivity state of fluid storage block at {} changed to {} due to {}", pos, state, cause);
network.getNodeGraph().runActionWhenPossible(FluidStorageCache.INVALIDATE.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
network.getNodeGraph().runActionWhenPossible(FluidStorageCache.INVALIDATE_ACTION.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
}
@Override
@@ -144,7 +144,9 @@ public class FluidStorageNetworkNode extends NetworkNode implements IStorageScre
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).get(storageId);
if (disk == null) {
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk = API.instance().createDefaultFluidDisk((ServerWorld) world, type.getCapacity(), owner));
disk = API.instance().createDefaultFluidDisk((ServerWorld) world, type.getCapacity(), owner);
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk);
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
}

View File

@@ -98,7 +98,7 @@ public class StorageNetworkNode extends NetworkNode implements IStorageScreen, I
LOGGER.debug("Connectivity state of item storage block at {} changed to {} due to {}", pos, state, cause);
network.getNodeGraph().runActionWhenPossible(ItemStorageCache.INVALIDATE.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
network.getNodeGraph().runActionWhenPossible(ItemStorageCache.INVALIDATE_ACTION.apply(InvalidateCause.CONNECTED_STATE_CHANGED));
}
@Override
@@ -144,7 +144,9 @@ public class StorageNetworkNode extends NetworkNode implements IStorageScreen, I
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).get(storageId);
if (disk == null) {
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk = API.instance().createDefaultItemDisk((ServerWorld) world, type.getCapacity(), owner));
disk = API.instance().createDefaultItemDisk((ServerWorld) world, type.getCapacity(), owner);
API.instance().getStorageDiskManager((ServerWorld) world).set(storageId, disk);
API.instance().getStorageDiskManager((ServerWorld) world).markForSaving();
}

View File

@@ -24,7 +24,7 @@ import java.util.function.Consumer;
import java.util.function.Function;
public class FluidStorageCache implements IStorageCache<FluidStack> {
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE = cause -> network -> network.getFluidStorageCache().invalidate(cause);
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE_ACTION = cause -> network -> network.getFluidStorageCache().invalidate(cause);
private static final Logger LOGGER = LogManager.getLogger(FluidStorageCache.class);

View File

@@ -24,7 +24,7 @@ import java.util.function.Consumer;
import java.util.function.Function;
public class ItemStorageCache implements IStorageCache<ItemStack> {
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE = cause -> network -> network.getItemStorageCache().invalidate(cause);
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE_ACTION = cause -> network -> network.getItemStorageCache().invalidate(cause);
private static final Logger LOGGER = LogManager.getLogger(ItemStorageCache.class);

View File

@@ -87,7 +87,7 @@ public class PortableFluidStorageCache implements IStorageCache<FluidStack> {
@Override
public IStackList<FluidStack> getCraftablesList() {
throw new RuntimeException("Unsupported");
throw new UnsupportedOperationException();
}
@Override

View File

@@ -55,7 +55,7 @@ public class PortableItemStorageCache implements IStorageCache<ItemStack> {
@Override
public void flush() {
throw new UnsupportedOperationException("Cannot flush portable grid storage cache");
throw new UnsupportedOperationException();
}
@Override
@@ -87,7 +87,7 @@ public class PortableItemStorageCache implements IStorageCache<ItemStack> {
@Override
public IStackList<ItemStack> getCraftablesList() {
throw new RuntimeException("Unsupported");
throw new UnsupportedOperationException();
}
@Override

View File

@@ -33,7 +33,7 @@ public enum BlockDirection {
case HORIZONTAL:
return entity.getHorizontalFacing().getOpposite();
default:
throw new RuntimeException("Unknown direction type");
throw new IllegalStateException("Unknown direction type");
}
}
@@ -45,7 +45,7 @@ public enum BlockDirection {
case HORIZONTAL:
return previous.rotateYCCW();
default:
throw new RuntimeException("Unknown direction type");
throw new IllegalStateException("Unknown direction type");
}
}
}

View File

@@ -51,6 +51,14 @@ public class ListNetworkCommand implements Command<CommandSource> {
this.tickTime = mean(network.getTickTimes()) * 1.0E-6D;
this.tps = Math.min(1000.0 / tickTime, 20);
}
private long mean(long[] values) {
long sum = 0L;
for (long v : values) {
sum += v;
}
return sum / values.length;
}
}
public static void sendInfo(CommandContext<CommandSource> context, NetworkInList listItem, boolean detailed) {
@@ -83,12 +91,4 @@ public class ListNetworkCommand implements Command<CommandSource> {
), false);
}
}
private static long mean(long[] values) {
long sum = 0L;
for (long v : values) {
sum += v;
}
return sum / values.length;
}
}

View File

@@ -82,7 +82,7 @@ public class CrafterManagerContainer extends BaseContainer {
if (data == null) { // We're only resizing, get the previous inventory...
dummy = dummyInventories.get(category.getKey());
} else {
dummyInventories.put(category.getKey(), dummy = new BaseItemHandler(category.getValue()) {
dummy = new BaseItemHandler(category.getValue()) {
@Override
public int getSlotLimit(int slot) {
return 1;
@@ -97,7 +97,9 @@ public class CrafterManagerContainer extends BaseContainer {
return stack;
}
});
};
dummyInventories.put(category.getKey(), dummy);
}
boolean foundItemsInCategory = false;

View File

@@ -157,7 +157,8 @@ public class GridContainer extends BaseContainer implements ICraftingGridListene
}
}
addSlot(craftingResultSlot = new ResultCraftingGridSlot(getPlayer(), grid, 0, 130 + 4, headerAndSlots + 22));
craftingResultSlot = new ResultCraftingGridSlot(getPlayer(), grid, 0, 130 + 4, headerAndSlots + 22);
addSlot(craftingResultSlot);
}
private void addPatternSlots() {
@@ -216,7 +217,8 @@ public class GridContainer extends BaseContainer implements ICraftingGridListene
}
}
addSlot(patternResultSlot = (new LegacyDisabledSlot(grid.getCraftingResult(), 0, 134, headerAndSlots + 22).setEnableHandler(() -> !((GridNetworkNode) grid).isProcessingPattern())));
patternResultSlot = new LegacyDisabledSlot(grid.getCraftingResult(), 0, 134, headerAndSlots + 22).setEnableHandler(() -> !((GridNetworkNode) grid).isProcessingPattern());
addSlot(patternResultSlot);
}
public IGrid getGrid() {

View File

@@ -3,16 +3,16 @@ package com.refinedmods.refinedstorage.container.slot;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.SlotItemHandler;
import java.util.function.Supplier;
import java.util.function.BooleanSupplier;
public class BaseSlot extends SlotItemHandler {
private Supplier<Boolean> enableHandler = () -> true;
private BooleanSupplier enableHandler = () -> true;
public BaseSlot(IItemHandler itemHandler, int inventoryIndex, int x, int y) {
super(itemHandler, inventoryIndex, x, y);
}
public BaseSlot setEnableHandler(Supplier<Boolean> enableHandler) {
public BaseSlot setEnableHandler(BooleanSupplier enableHandler) {
this.enableHandler = enableHandler;
return this;
@@ -20,6 +20,6 @@ public class BaseSlot extends SlotItemHandler {
@Override
public boolean isEnabled() {
return enableHandler.get();
return enableHandler.getAsBoolean();
}
}

View File

@@ -3,16 +3,16 @@ package com.refinedmods.refinedstorage.container.slot.legacy;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.Slot;
import java.util.function.Supplier;
import java.util.function.BooleanSupplier;
public class LegacyBaseSlot extends Slot {
private Supplier<Boolean> enableHandler = () -> true;
private BooleanSupplier enableHandler = () -> true;
public LegacyBaseSlot(IInventory inventory, int inventoryIndex, int x, int y) {
super(inventory, inventoryIndex, x, y);
}
public LegacyBaseSlot setEnableHandler(Supplier<Boolean> enableHandler) {
public LegacyBaseSlot setEnableHandler(BooleanSupplier enableHandler) {
this.enableHandler = enableHandler;
return this;
@@ -20,7 +20,6 @@ public class LegacyBaseSlot extends Slot {
@Override
public boolean isEnabled() {
return enableHandler.get();
return enableHandler.getAsBoolean();
}
}

View File

@@ -16,52 +16,48 @@ import net.minecraft.util.ResourceLocation;
import java.util.function.Consumer;
public class RecipeGenerator extends RecipeProvider {
private static final String GRID_ID = RS.ID + ":grid";
public RecipeGenerator(DataGenerator generator) {
super(generator);
}
@Override
protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {
//Tag + Color -> Colored Block
RSItems.COLORED_ITEM_TAGS.forEach((tag, map) -> {
map.forEach((color, item) -> {
ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(tag)
.addIngredient(color.getTag())
.setGroup(RS.ID)
.addCriterion("refinedstorage:controller", InventoryChangeTrigger.Instance.forItems(RSItems.CONTROLLER.get(ColorMap.DEFAULT_COLOR).get()))
.build(consumer, new ResourceLocation(RS.ID, "coloring_recipes/" + item.getId().getPath()));
});
});
protected void registerRecipes(Consumer<IFinishedRecipe> recipeAcceptor) {
// Tag + Color -> Colored Block
RSItems.COLORED_ITEM_TAGS.forEach((tag, map) -> map.forEach((color, item) -> ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(tag)
.addIngredient(color.getTag())
.setGroup(RS.ID)
.addCriterion("refinedstorage:controller", InventoryChangeTrigger.Instance.forItems(RSItems.CONTROLLER.get(ColorMap.DEFAULT_COLOR).get()))
.build(recipeAcceptor, new ResourceLocation(RS.ID, "coloring_recipes/" + item.getId().getPath()))
));
//Crafting Grid
RSItems.CRAFTING_GRID.forEach((color, item) -> {
ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(RSItems.GRID.get(color).get())
.addIngredient(RSItems.PROCESSORS.get(ProcessorItem.Type.ADVANCED).get())
.addIngredient(ItemTags.makeWrapperTag("refinedstorage:crafting_tables"))
.addCriterion("refinedstorage:grid", InventoryChangeTrigger.Instance.forItems(RSItems.GRID.get(ColorMap.DEFAULT_COLOR).get()))
.build(consumer, new ResourceLocation(RS.ID, "crafting_grid/" + item.getId().getPath()));
});
// Crafting Grid
RSItems.CRAFTING_GRID.forEach((color, item) -> ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(RSItems.GRID.get(color).get())
.addIngredient(RSItems.PROCESSORS.get(ProcessorItem.Type.ADVANCED).get())
.addIngredient(ItemTags.makeWrapperTag("refinedstorage:crafting_tables"))
.addCriterion(GRID_ID, InventoryChangeTrigger.Instance.forItems(RSItems.GRID.get(ColorMap.DEFAULT_COLOR).get()))
.build(recipeAcceptor, new ResourceLocation(RS.ID, "crafting_grid/" + item.getId().getPath()))
);
//Fluid Grid
RSItems.FLUID_GRID.forEach((color, item) -> {
ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(RSItems.GRID.get(color).get())
.addIngredient(RSItems.PROCESSORS.get(ProcessorItem.Type.ADVANCED).get())
.addIngredient(Items.BUCKET)
.addCriterion("refinedstorage:grid", InventoryChangeTrigger.Instance.forItems(RSItems.GRID.get(ColorMap.DEFAULT_COLOR).get()))
.build(consumer, new ResourceLocation(RS.ID, "fluid_grid/" + item.getId().getPath()));
});
// Fluid Grid
RSItems.FLUID_GRID.forEach((color, item) -> ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(RSItems.GRID.get(color).get())
.addIngredient(RSItems.PROCESSORS.get(ProcessorItem.Type.ADVANCED).get())
.addIngredient(Items.BUCKET)
.addCriterion(GRID_ID, InventoryChangeTrigger.Instance.forItems(RSItems.GRID.get(ColorMap.DEFAULT_COLOR).get()))
.build(recipeAcceptor, new ResourceLocation(RS.ID, "fluid_grid/" + item.getId().getPath()))
);
//Pattern Grid
RSItems.PATTERN_GRID.forEach((color, item) -> {
ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(RSItems.GRID.get(color).get())
.addIngredient(RSItems.PROCESSORS.get(ProcessorItem.Type.ADVANCED).get())
.addIngredient(RSItems.PATTERN.get())
.addCriterion("refinedstorage:grid", InventoryChangeTrigger.Instance.forItems(RSItems.GRID.get(ColorMap.DEFAULT_COLOR).get()))
.build(consumer, new ResourceLocation(RS.ID, "pattern_grid/" + item.getId().getPath()));
});
// Pattern Grid
RSItems.PATTERN_GRID.forEach((color, item) -> ShapelessRecipeBuilder.shapelessRecipe(item.get())
.addIngredient(RSItems.GRID.get(color).get())
.addIngredient(RSItems.PROCESSORS.get(ProcessorItem.Type.ADVANCED).get())
.addIngredient(RSItems.PATTERN.get())
.addCriterion(GRID_ID, InventoryChangeTrigger.Instance.forItems(RSItems.GRID.get(ColorMap.DEFAULT_COLOR).get()))
.build(recipeAcceptor, new ResourceLocation(RS.ID, "pattern_grid/" + item.getId().getPath()))
);
}
}

View File

@@ -104,6 +104,33 @@ public class DiskDriveBakedModel extends DelegateBakedModel {
return quads;
}
private IBakedModel getDiskModel(DiskState diskState) {
switch (diskState) {
case DISCONNECTED:
return diskDisconnected;
case NEAR_CAPACITY:
return diskNearCapacity;
case FULL:
return diskFull;
default:
return disk;
}
}
private Vector3f getDiskTranslation(Direction facing, int x, int y) {
Vector3f translation = new Vector3f();
if (facing == Direction.NORTH || facing == Direction.SOUTH) {
translation.add(((2F / 16F) + ((float) x * 7F) / 16F) * (facing == Direction.NORTH ? -1 : 1), 0, 0); // Add to X
} else if (facing == Direction.EAST || facing == Direction.WEST) {
translation.add(0, 0, ((2F / 16F) + ((float) x * 7F) / 16F) * (facing == Direction.EAST ? -1 : 1)); // Add to Z
}
translation.add(0, -((2F / 16F) + ((float) y * 3F) / 16F), 0); // Remove from Y
return translation;
}
});
public DiskDriveBakedModel(IBakedModel base,
@@ -119,33 +146,6 @@ public class DiskDriveBakedModel extends DelegateBakedModel {
this.diskDisconnected = diskDisconnected;
}
private IBakedModel getDiskModel(DiskState diskState) {
switch (diskState) {
case DISCONNECTED:
return diskDisconnected;
case NEAR_CAPACITY:
return diskNearCapacity;
case FULL:
return diskFull;
default:
return disk;
}
}
private Vector3f getDiskTranslation(Direction facing, int x, int y) {
Vector3f translation = new Vector3f();
if (facing == Direction.NORTH || facing == Direction.SOUTH) {
translation.add(((2F / 16F) + ((float) x * 7F) / 16F) * (facing == Direction.NORTH ? -1 : 1), 0, 0); // Add to X
} else if (facing == Direction.EAST || facing == Direction.WEST) {
translation.add(0, 0, ((2F / 16F) + ((float) x * 7F) / 16F) * (facing == Direction.EAST ? -1 : 1)); // Add to Z
}
translation.add(0, -((2F / 16F) + ((float) y * 3F) / 16F), 0); // Remove from Y
return translation;
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData data) {

View File

@@ -116,6 +116,33 @@ public class DiskManipulatorBakedModel extends DelegateBakedModel {
return quads;
}
private IBakedModel getDiskModel(DiskState diskState) {
switch (diskState) {
case DISCONNECTED:
return diskDisconnected;
case NEAR_CAPACITY:
return diskNearCapacity;
case FULL:
return diskFull;
default:
return disk;
}
}
private Vector3f getDiskTranslation(Direction facing, int x, int y) {
Vector3f translation = new Vector3f();
if (facing == Direction.NORTH || facing == Direction.SOUTH) {
translation.add((2F / 16F + ((float) x * 7F) / 16F) * (facing == Direction.NORTH ? -1 : 1), 0, 0); // Add to X
} else if (facing == Direction.EAST || facing == Direction.WEST) {
translation.add(0, 0, (2F / 16F + ((float) x * 7F) / 16F) * (facing == Direction.EAST ? -1 : 1)); // Add to Z
}
translation.add(0, -((6F / 16F) + (3F * y) / 16F), 0); // Remove from Y
return translation;
}
});
public DiskManipulatorBakedModel(IBakedModel baseConnected, IBakedModel baseDisconnected, IBakedModel disk, IBakedModel diskNearCapacity, IBakedModel diskFull, IBakedModel diskDisconnected) {
@@ -129,33 +156,6 @@ public class DiskManipulatorBakedModel extends DelegateBakedModel {
this.diskDisconnected = diskDisconnected;
}
private IBakedModel getDiskModel(DiskState diskState) {
switch (diskState) {
case DISCONNECTED:
return diskDisconnected;
case NEAR_CAPACITY:
return diskNearCapacity;
case FULL:
return diskFull;
default:
return disk;
}
}
private Vector3f getDiskTranslation(Direction facing, int x, int y) {
Vector3f translation = new Vector3f();
if (facing == Direction.NORTH || facing == Direction.SOUTH) {
translation.add((2F / 16F + ((float) x * 7F) / 16F) * (facing == Direction.NORTH ? -1 : 1), 0, 0); // Add to X
} else if (facing == Direction.EAST || facing == Direction.WEST) {
translation.add(0, 0, (2F / 16F + ((float) x * 7F) / 16F) * (facing == Direction.EAST ? -1 : 1)); // Add to Z
}
translation.add(0, -((6F / 16F) + (3F * y) / 16F), 0); // Remove from Y
return translation;
}
@Override
@Nonnull
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData data) {

View File

@@ -12,16 +12,16 @@ import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import java.util.function.Function;
import java.util.function.UnaryOperator;
public class FluidAmountScreen extends AmountSpecifyingScreen<FluidAmountContainer> {
private final int containerSlot;
private final FluidStack stack;
private final int maxAmount;
@Nullable
private final Function<Screen, Screen> alternativesScreenFactory;
private final UnaryOperator<Screen> alternativesScreenFactory;
public FluidAmountScreen(BaseScreen parent, PlayerEntity player, int containerSlot, FluidStack stack, int maxAmount, @Nullable Function<Screen, Screen> alternativesScreenFactory) {
public FluidAmountScreen(BaseScreen parent, PlayerEntity player, int containerSlot, FluidStack stack, int maxAmount, @Nullable UnaryOperator<Screen> alternativesScreenFactory) {
super(parent, new FluidAmountContainer(player, stack), alternativesScreenFactory != null ? 194 : 172, 99, player.inventory, new TranslationTextComponent("gui.refinedstorage.fluid_amount"));
this.containerSlot = containerSlot;

View File

@@ -12,16 +12,16 @@ import net.minecraftforge.items.ItemHandlerHelper;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import java.util.function.Function;
import java.util.function.UnaryOperator;
public class ItemAmountScreen extends AmountSpecifyingScreen<AmountContainer> {
private final int containerSlot;
private final ItemStack stack;
private final int maxAmount;
@Nullable
private final Function<Screen, Screen> alternativesScreenFactory;
private final UnaryOperator<Screen> alternativesScreenFactory;
public ItemAmountScreen(BaseScreen parent, PlayerEntity player, int containerSlot, ItemStack stack, int maxAmount, @Nullable Function<Screen, Screen> alternativesScreenFactory) {
public ItemAmountScreen(BaseScreen parent, PlayerEntity player, int containerSlot, ItemStack stack, int maxAmount, @Nullable UnaryOperator<Screen> alternativesScreenFactory) {
super(parent, new AmountContainer(player, stack), alternativesScreenFactory != null ? 194 : 172, 99, player.inventory, new TranslationTextComponent("gui.refinedstorage.item_amount"));
this.containerSlot = containerSlot;

View File

@@ -62,7 +62,7 @@ public abstract class NetworkNodeTile<N extends NetworkNode> extends BaseTile im
INetworkNode node = manager.getNode(pos);
if (node == null) {
throw new RuntimeException("No network node present at " + pos.toString() + ", consider removing the block at this position");
throw new IllegalStateException("No network node present at " + pos.toString() + ", consider removing the block at this position");
}
return (N) node;

View File

@@ -11,7 +11,7 @@ import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
public class TileDataManager {
private static int LAST_ID = 0;
private static int lastId = 0;
private static final Map<Integer, TileDataParameter> REGISTRY = new HashMap<>();
private final TileEntity tile;
@@ -60,9 +60,9 @@ public class TileDataManager {
}
public static void registerParameter(TileDataParameter parameter) {
parameter.setId(LAST_ID);
parameter.setId(lastId);
REGISTRY.put(LAST_ID++, parameter);
REGISTRY.put(lastId++, parameter);
}
public static TileDataParameter getParameter(int id) {