Fix stuff pointed out by the static analyzer
This commit is contained in:
@@ -64,6 +64,7 @@ public final class RSUtils {
|
|||||||
private static final NonNullList EMPTY_NON_NULL_LIST = new NonNullList<Object>(Collections.emptyList(), null) {
|
private static final NonNullList EMPTY_NON_NULL_LIST = new NonNullList<Object>(Collections.emptyList(), null) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> NonNullList<T> emptyNonNullList() {
|
public static <T> NonNullList<T> emptyNonNullList() {
|
||||||
return (NonNullList<T>) EMPTY_NON_NULL_LIST;
|
return (NonNullList<T>) EMPTY_NON_NULL_LIST;
|
||||||
}
|
}
|
||||||
|
@@ -41,8 +41,8 @@ public interface IStackList<T> {
|
|||||||
* @param stack the stack
|
* @param stack the stack
|
||||||
* @return whether the remove was successful for the full amount
|
* @return whether the remove was successful for the full amount
|
||||||
*/
|
*/
|
||||||
default void remove(@Nonnull T stack) {
|
default boolean remove(@Nonnull T stack) {
|
||||||
remove(stack, getSizeFromStack(stack));
|
return remove(stack, getSizeFromStack(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -31,7 +31,6 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
private List<List<ItemStack>> oreInputs = new ArrayList<>();
|
private List<List<ItemStack>> oreInputs = new ArrayList<>();
|
||||||
private List<ItemStack> outputs = new ArrayList<>();
|
private List<ItemStack> outputs = new ArrayList<>();
|
||||||
private List<ItemStack> byproducts = new ArrayList<>();
|
private List<ItemStack> byproducts = new ArrayList<>();
|
||||||
private boolean mekanism = false; // Cause they are special in so many ways ¯\_(ツ)_/¯
|
|
||||||
|
|
||||||
public CraftingPattern(World world, ICraftingPatternContainer container, ItemStack stack) {
|
public CraftingPattern(World world, ICraftingPatternContainer container, ItemStack stack) {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
@@ -58,10 +57,11 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
recipe = CraftingManager.getInstance().getRecipeList().stream().filter(r -> r.matches(inv, world)).findFirst().orElse(null);
|
recipe = CraftingManager.getInstance().getRecipeList().stream().filter(r -> r.matches(inv, world)).findFirst().orElse(null);
|
||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
ItemStack output = recipe.getCraftingResult(inv);
|
ItemStack output = recipe.getCraftingResult(inv);
|
||||||
if (output != null) {
|
|
||||||
|
if (!output.isEmpty()) {
|
||||||
boolean shapedOre = recipe instanceof ShapedOreRecipe;
|
boolean shapedOre = recipe instanceof ShapedOreRecipe;
|
||||||
// It is a dirty fix, but hey someone has to do it. ~ way2muchnoise 2016 "bite me"
|
// It is a dirty fix, but hey someone has to do it. ~ way2muchnoise 2016 "bite me"
|
||||||
mekanism = recipe.getClass().getName().equals("mekanism.common.recipe.ShapedMekanismRecipe");
|
boolean mekanism = recipe.getClass().getName().equals("mekanism.common.recipe.ShapedMekanismRecipe");
|
||||||
|
|
||||||
outputs.add(Comparer.stripTags(output.copy()));
|
outputs.add(Comparer.stripTags(output.copy()));
|
||||||
|
|
||||||
|
@@ -96,7 +96,7 @@ public class NetworkNodeDetector extends NetworkNode implements IComparable, ITy
|
|||||||
powered = isPowered(stack == null ? null : stack.getCount());
|
powered = isPowered(stack == null ? null : stack.getCount());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
powered = mode == MODE_AUTOCRAFTING ? !network.getCraftingManager().getTasks().isEmpty() : isPowered(network.getItemStorageCache().getList().getStacks().stream().map(s -> s.getCount()).mapToInt(Number::intValue).sum());
|
powered = mode == MODE_AUTOCRAFTING ? !network.getCraftingManager().getTasks().isEmpty() : isPowered(network.getItemStorageCache().getList().getStacks().stream().map(ItemStack::getCount).mapToInt(Number::intValue).sum());
|
||||||
}
|
}
|
||||||
} else if (type == IType.FLUIDS) {
|
} else if (type == IType.FLUIDS) {
|
||||||
FluidStack slot = fluidFilters.getFluidStackInSlot(0);
|
FluidStack slot = fluidFilters.getFluidStackInSlot(0);
|
||||||
|
@@ -30,6 +30,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class NetworkNodeDiskDrive extends NetworkNode implements IStorageGui, IStorageProvider, IComparable, IFilterable, IPrioritizable, IType, IExcessVoidable, IAccessType {
|
public class NetworkNodeDiskDrive extends NetworkNode implements IStorageGui, IStorageProvider, IComparable, IFilterable, IPrioritizable, IType, IExcessVoidable, IAccessType {
|
||||||
@@ -50,6 +51,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IStorageGui, IS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public ItemStack insert(@Nonnull ItemStack stack, int size, boolean simulate) {
|
public ItemStack insert(@Nonnull ItemStack stack, int size, boolean simulate) {
|
||||||
if (!IFilterable.canTake(itemFilters, mode, getCompare(), stack)) {
|
if (!IFilterable.canTake(itemFilters, mode, getCompare(), stack)) {
|
||||||
return ItemHandlerHelper.copyStackWithSize(stack, size);
|
return ItemHandlerHelper.copyStackWithSize(stack, size);
|
||||||
@@ -97,7 +99,8 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IStorageGui, IS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack insert(FluidStack stack, int size, boolean simulate) {
|
@Nullable
|
||||||
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (!IFilterable.canTakeFluids(fluidFilters, mode, getCompare(), stack)) {
|
if (!IFilterable.canTakeFluids(fluidFilters, mode, getCompare(), stack)) {
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return RSUtils.copyStackWithSize(stack, size);
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
|||||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class NetworkNodeDiskManipulator extends NetworkNode implements IComparable, IFilterable, IType {
|
public class NetworkNodeDiskManipulator extends NetworkNode implements IComparable, IFilterable, IType {
|
||||||
@@ -162,7 +163,8 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack insert(FluidStack stack, int size, boolean simulate) {
|
@Nullable
|
||||||
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (!IFilterable.canTakeFluids(fluidFilters, mode, getCompare(), stack)) {
|
if (!IFilterable.canTakeFluids(fluidFilters, mode, getCompare(), stack)) {
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return RSUtils.copyStackWithSize(stack, size);
|
||||||
}
|
}
|
||||||
@@ -171,7 +173,8 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack extract(FluidStack stack, int size, int flags, boolean simulate) {
|
@Nullable
|
||||||
|
public FluidStack extract(@Nonnull FluidStack stack, int size, int flags, boolean simulate) {
|
||||||
if (!IFilterable.canTakeFluids(fluidFilters, mode, getCompare(), stack)) {
|
if (!IFilterable.canTakeFluids(fluidFilters, mode, getCompare(), stack)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,8 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class NetworkNodeFluidStorage extends NetworkNode implements IStorageGui, IStorageProvider, IComparable, IFilterable, IPrioritizable, IExcessVoidable, IAccessType {
|
public class NetworkNodeFluidStorage extends NetworkNode implements IStorageGui, IStorageProvider, IComparable, IFilterable, IPrioritizable, IExcessVoidable, IAccessType {
|
||||||
@@ -38,7 +40,8 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageGui,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack insert(FluidStack stack, int size, boolean simulate) {
|
@Nullable
|
||||||
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (!IFilterable.canTakeFluids(filters, mode, compare, stack)) {
|
if (!IFilterable.canTakeFluids(filters, mode, compare, stack)) {
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return RSUtils.copyStackWithSize(stack, size);
|
||||||
}
|
}
|
||||||
@@ -195,7 +198,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IStorageGui,
|
|||||||
|
|
||||||
public EnumFluidStorageType getType() {
|
public EnumFluidStorageType getType() {
|
||||||
if (type == null && holder.world().getBlockState(holder.pos()).getBlock() == RSBlocks.FLUID_STORAGE) {
|
if (type == null && holder.world().getBlockState(holder.pos()).getBlock() == RSBlocks.FLUID_STORAGE) {
|
||||||
type = ((EnumFluidStorageType) holder.world().getBlockState(holder.pos()).getValue(BlockFluidStorage.TYPE));
|
type = (EnumFluidStorageType) holder.world().getBlockState(holder.pos()).getValue(BlockFluidStorage.TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type == null ? EnumFluidStorageType.TYPE_64K : type;
|
return type == null ? EnumFluidStorageType.TYPE_64K : type;
|
||||||
|
@@ -197,7 +197,7 @@ public class NetworkNodeStorage extends NetworkNode implements IStorageGui, ISto
|
|||||||
|
|
||||||
public EnumItemStorageType getType() {
|
public EnumItemStorageType getType() {
|
||||||
if (type == null && holder.world().getBlockState(holder.pos()).getBlock() == RSBlocks.STORAGE) {
|
if (type == null && holder.world().getBlockState(holder.pos()).getBlock() == RSBlocks.STORAGE) {
|
||||||
type = ((EnumItemStorageType) holder.world().getBlockState(holder.pos()).getValue(BlockStorage.TYPE));
|
type = (EnumItemStorageType) holder.world().getBlockState(holder.pos()).getValue(BlockStorage.TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type == null ? EnumItemStorageType.TYPE_1K : type;
|
return type == null ? EnumItemStorageType.TYPE_1K : type;
|
||||||
|
@@ -41,8 +41,8 @@ public class StorageFluidExternal implements IStorage<FluidStack> {
|
|||||||
return getContents() == null ? RSUtils.emptyNonNullList() : NonNullList.withSize(1, getContents().copy());
|
return getContents() == null ? RSUtils.emptyNonNullList() : NonNullList.withSize(1, getContents().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (getProperties() != null && IFilterable.canTakeFluids(externalStorage.getFluidFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack) && getProperties().canFillFluidType(stack)) {
|
if (getProperties() != null && IFilterable.canTakeFluids(externalStorage.getFluidFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack) && getProperties().canFillFluidType(stack)) {
|
||||||
int filled = handlerSupplier.get().fill(RSUtils.copyStackWithSize(stack, size), !simulate);
|
int filled = handlerSupplier.get().fill(RSUtils.copyStackWithSize(stack, size), !simulate);
|
||||||
@@ -57,8 +57,8 @@ public class StorageFluidExternal implements IStorage<FluidStack> {
|
|||||||
return RSUtils.copyStackWithSize(stack, size);
|
return RSUtils.copyStackWithSize(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public FluidStack extract(@Nonnull FluidStack stack, int size, int flags, boolean simulate) {
|
public FluidStack extract(@Nonnull FluidStack stack, int size, int flags, boolean simulate) {
|
||||||
FluidStack toDrain = RSUtils.copyStackWithSize(stack, size);
|
FluidStack toDrain = RSUtils.copyStackWithSize(stack, size);
|
||||||
|
|
||||||
|
@@ -49,9 +49,9 @@ public class ReaderWriterHandlerFluids implements IReaderWriterHandler {
|
|||||||
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
||||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||||
if (readerWriter instanceof IReader) {
|
if (readerWriter instanceof IReader) {
|
||||||
return (T) tankReader;
|
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tankReader);
|
||||||
} else if (readerWriter instanceof IWriter) {
|
} else if (readerWriter instanceof IWriter) {
|
||||||
return (T) tankWriter;
|
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tankWriter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,9 +51,9 @@ public class ReaderWriterHandlerItems implements IReaderWriterHandler {
|
|||||||
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
||||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
if (readerWriter instanceof IReader) {
|
if (readerWriter instanceof IReader) {
|
||||||
return (T) itemsReader;
|
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemsReader);
|
||||||
} else if (readerWriter instanceof IWriter) {
|
} else if (readerWriter instanceof IWriter) {
|
||||||
return (T) itemsWriter;
|
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemsWriter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -80,6 +80,7 @@ public abstract class StorageFluidNBT implements IStorage<FluidStack> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public synchronized FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
public synchronized FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
for (FluidStack otherStack : stacks) {
|
for (FluidStack otherStack : stacks) {
|
||||||
if (otherStack.isFluidEqual(stack)) {
|
if (otherStack.isFluidEqual(stack)) {
|
||||||
@@ -151,6 +152,7 @@ public abstract class StorageFluidNBT implements IStorage<FluidStack> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public synchronized FluidStack extract(@Nonnull FluidStack stack, int size, int flags, boolean simulate) {
|
public synchronized FluidStack extract(@Nonnull FluidStack stack, int size, int flags, boolean simulate) {
|
||||||
for (FluidStack otherStack : stacks) {
|
for (FluidStack otherStack : stacks) {
|
||||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||||
|
@@ -117,6 +117,7 @@ public abstract class StorageItemNBT implements IStorage<ItemStack> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public synchronized ItemStack insert(@Nonnull ItemStack stack, int size, boolean simulate) {
|
public synchronized ItemStack insert(@Nonnull ItemStack stack, int size, boolean simulate) {
|
||||||
for (ItemStack otherStack : stacks) {
|
for (ItemStack otherStack : stacks) {
|
||||||
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||||
@@ -188,6 +189,7 @@ public abstract class StorageItemNBT implements IStorage<ItemStack> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public synchronized ItemStack extract(@Nonnull ItemStack stack, int size, int flags, boolean simulate) {
|
public synchronized ItemStack extract(@Nonnull ItemStack stack, int size, int flags, boolean simulate) {
|
||||||
for (ItemStack otherStack : stacks) {
|
for (ItemStack otherStack : stacks) {
|
||||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||||
|
@@ -18,7 +18,8 @@ public class StackListFluid implements IStackList<FluidStack> {
|
|||||||
private List<FluidStack> removeTracker = new LinkedList<>();
|
private List<FluidStack> removeTracker = new LinkedList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(FluidStack stack, int size) {
|
@Nullable
|
||||||
|
public void add(@Nonnull FluidStack stack, int size) {
|
||||||
for (FluidStack otherStack : stacks.get(stack.getFluid())) {
|
for (FluidStack otherStack : stacks.get(stack.getFluid())) {
|
||||||
if (stack.isFluidEqual(otherStack)) {
|
if (stack.isFluidEqual(otherStack)) {
|
||||||
otherStack.amount += size;
|
otherStack.amount += size;
|
||||||
@@ -31,6 +32,7 @@ public class StackListFluid implements IStackList<FluidStack> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public boolean remove(@Nonnull FluidStack stack, int size) {
|
public boolean remove(@Nonnull FluidStack stack, int size) {
|
||||||
for (FluidStack otherStack : stacks.get(stack.getFluid())) {
|
for (FluidStack otherStack : stacks.get(stack.getFluid())) {
|
||||||
if (stack.isFluidEqual(otherStack)) {
|
if (stack.isFluidEqual(otherStack)) {
|
||||||
|
@@ -64,11 +64,11 @@ public class BlockCable extends BlockNode {
|
|||||||
BlockStateContainer.Builder builder = super.createBlockStateBuilder();
|
BlockStateContainer.Builder builder = super.createBlockStateBuilder();
|
||||||
|
|
||||||
builder.add(NORTH)
|
builder.add(NORTH)
|
||||||
.add(EAST)
|
.add(EAST)
|
||||||
.add(SOUTH)
|
.add(SOUTH)
|
||||||
.add(WEST)
|
.add(WEST)
|
||||||
.add(UP)
|
.add(UP)
|
||||||
.add(DOWN);
|
.add(DOWN);
|
||||||
|
|
||||||
if (getPlacementType() != null) {
|
if (getPlacementType() != null) {
|
||||||
builder.add(DIRECTION);
|
builder.add(DIRECTION);
|
||||||
@@ -81,12 +81,12 @@ public class BlockCable extends BlockNode {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(NORTH, hasConnectionWith(world, pos, EnumFacing.NORTH))
|
.withProperty(NORTH, hasConnectionWith(world, pos, EnumFacing.NORTH))
|
||||||
.withProperty(EAST, hasConnectionWith(world, pos, EnumFacing.EAST))
|
.withProperty(EAST, hasConnectionWith(world, pos, EnumFacing.EAST))
|
||||||
.withProperty(SOUTH, hasConnectionWith(world, pos, EnumFacing.SOUTH))
|
.withProperty(SOUTH, hasConnectionWith(world, pos, EnumFacing.SOUTH))
|
||||||
.withProperty(WEST, hasConnectionWith(world, pos, EnumFacing.WEST))
|
.withProperty(WEST, hasConnectionWith(world, pos, EnumFacing.WEST))
|
||||||
.withProperty(UP, hasConnectionWith(world, pos, EnumFacing.UP))
|
.withProperty(UP, hasConnectionWith(world, pos, EnumFacing.UP))
|
||||||
.withProperty(DOWN, hasConnectionWith(world, pos, EnumFacing.DOWN));
|
.withProperty(DOWN, hasConnectionWith(world, pos, EnumFacing.DOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasConnectionWith(IBlockAccess world, BlockPos pos, EnumFacing direction) {
|
private boolean hasConnectionWith(IBlockAccess world, BlockPos pos, EnumFacing direction) {
|
||||||
@@ -104,12 +104,12 @@ public class BlockCable extends BlockNode {
|
|||||||
state = getActualState(state, world, pos);
|
state = getActualState(state, world, pos);
|
||||||
|
|
||||||
return isInAABB(CORE_AABB, hitX, hitY, hitZ) ||
|
return isInAABB(CORE_AABB, hitX, hitY, hitZ) ||
|
||||||
(state.getValue(NORTH) && isInAABB(NORTH_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(NORTH) && isInAABB(NORTH_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(EAST) && isInAABB(EAST_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(EAST) && isInAABB(EAST_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(SOUTH) && isInAABB(SOUTH_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(SOUTH) && isInAABB(SOUTH_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(WEST) && isInAABB(WEST_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(WEST) && isInAABB(WEST_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(UP) && isInAABB(UP_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(UP) && isInAABB(UP_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(DOWN) && isInAABB(DOWN_AABB, hitX, hitY, hitZ));
|
(state.getValue(DOWN) && isInAABB(DOWN_AABB, hitX, hitY, hitZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AxisAlignedBB> getUnionizedCollisionBoxes(IBlockState state) {
|
public List<AxisAlignedBB> getUnionizedCollisionBoxes(IBlockState state) {
|
||||||
@@ -202,6 +202,7 @@ public class BlockCable extends BlockNode {
|
|||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EnumPlacementType getPlacementType() {
|
public EnumPlacementType getPlacementType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -44,9 +44,9 @@ public class BlockController extends BlockBase {
|
|||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
return createBlockStateBuilder()
|
return createBlockStateBuilder()
|
||||||
.add(TYPE)
|
.add(TYPE)
|
||||||
.add(ENERGY)
|
.add(ENERGY)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,7 +62,7 @@ public class BlockController extends BlockBase {
|
|||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(ENERGY, ((TileController) world.getTileEntity(pos)).getEnergyScaledForDisplay());
|
.withProperty(ENERGY, ((TileController) world.getTileEntity(pos)).getEnergyScaledForDisplay());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -27,8 +27,8 @@ public class BlockDetector extends BlockNode {
|
|||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
return createBlockStateBuilder()
|
return createBlockStateBuilder()
|
||||||
.add(POWERED)
|
.add(POWERED)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -44,8 +44,8 @@ public class BlockFluidStorage extends BlockNode {
|
|||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
return createBlockStateBuilder()
|
return createBlockStateBuilder()
|
||||||
.add(TYPE)
|
.add(TYPE)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemBlockBase;
|
import com.raoulvdberge.refinedstorage.item.ItemBlockBase;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
@@ -40,8 +39,8 @@ public class BlockGrid extends BlockNode {
|
|||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
return createBlockStateBuilder()
|
return createBlockStateBuilder()
|
||||||
.add(TYPE)
|
.add(TYPE)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
@@ -3,7 +3,6 @@ package com.raoulvdberge.refinedstorage.block;
|
|||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeSecurityManager;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileSecurityManager;
|
import com.raoulvdberge.refinedstorage.tile.TileSecurityManager;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
@@ -30,15 +30,15 @@ public class BlockSolderer extends BlockNode {
|
|||||||
super.addInformation(stack, player, tooltip, advanced);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
|
|
||||||
tooltip.add(I18n.format(
|
tooltip.add(I18n.format(
|
||||||
"block.refinedstorage:solderer.tooltip.0",
|
"block.refinedstorage:solderer.tooltip.0",
|
||||||
TextFormatting.WHITE + I18n.format("block.refinedstorage:controller.0.name") + TextFormatting.GRAY
|
TextFormatting.WHITE + I18n.format("block.refinedstorage:controller.0.name") + TextFormatting.GRAY
|
||||||
));
|
));
|
||||||
|
|
||||||
tooltip.add(I18n.format("block.refinedstorage:solderer.tooltip.1"));
|
tooltip.add(I18n.format("block.refinedstorage:solderer.tooltip.1"));
|
||||||
|
|
||||||
tooltip.add(I18n.format(
|
tooltip.add(I18n.format(
|
||||||
"block.refinedstorage:solderer.tooltip.2",
|
"block.refinedstorage:solderer.tooltip.2",
|
||||||
TextFormatting.WHITE + I18n.format("block.refinedstorage:cable.name") + TextFormatting.GRAY
|
TextFormatting.WHITE + I18n.format("block.refinedstorage:cable.name") + TextFormatting.GRAY
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,8 +44,8 @@ public class BlockStorage extends BlockNode {
|
|||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
return createBlockStateBuilder()
|
return createBlockStateBuilder()
|
||||||
.add(TYPE)
|
.add(TYPE)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -6,16 +6,16 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
|
|
||||||
public enum EnumPlacementType {
|
public enum EnumPlacementType {
|
||||||
ANY(
|
ANY(
|
||||||
EnumFacing.VALUES
|
EnumFacing.VALUES
|
||||||
),
|
),
|
||||||
ANY_FACE_PLAYER(
|
ANY_FACE_PLAYER(
|
||||||
EnumFacing.VALUES
|
EnumFacing.VALUES
|
||||||
),
|
),
|
||||||
HORIZONTAL(
|
HORIZONTAL(
|
||||||
EnumFacing.NORTH,
|
EnumFacing.NORTH,
|
||||||
EnumFacing.EAST,
|
EnumFacing.EAST,
|
||||||
EnumFacing.SOUTH,
|
EnumFacing.SOUTH,
|
||||||
EnumFacing.WEST
|
EnumFacing.WEST
|
||||||
);
|
);
|
||||||
|
|
||||||
final EnumFacing[] allowed;
|
final EnumFacing[] allowed;
|
||||||
|
@@ -8,18 +8,18 @@ import net.minecraft.inventory.Slot;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ContainerGridFilter extends ContainerBase {
|
public class ContainerGridFilter extends ContainerBase {
|
||||||
private ItemHandlerGridFilter filter;
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public ContainerGridFilter(EntityPlayer player, ItemStack stack) {
|
public ContainerGridFilter(EntityPlayer player, ItemStack stack) {
|
||||||
super(null, player);
|
super(null, player);
|
||||||
|
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
this.filter = new ItemHandlerGridFilter(stack);
|
|
||||||
|
|
||||||
int y = 20;
|
int y = 20;
|
||||||
int x = 8;
|
int x = 8;
|
||||||
|
|
||||||
|
ItemHandlerGridFilter filter = new ItemHandlerGridFilter(stack);
|
||||||
|
|
||||||
for (int i = 0; i < 27; ++i) {
|
for (int i = 0; i < 27; ++i) {
|
||||||
addSlotToContainer(new SlotFilter(filter, i, x, y));
|
addSlotToContainer(new SlotFilter(filter, i, x, y));
|
||||||
|
|
||||||
|
@@ -97,10 +97,10 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
drawTexture(x, y, 0, 0, screenWidth, screenHeight);
|
drawTexture(x, y, 0, 0, screenWidth, screenHeight);
|
||||||
|
|
||||||
if (itemSelectedX != -1 &&
|
if (itemSelectedX != -1 &&
|
||||||
itemSelectedY != -1 &&
|
itemSelectedY != -1 &&
|
||||||
itemSelected >= 0 &&
|
itemSelected >= 0 &&
|
||||||
itemSelected < getElements().size() &&
|
itemSelected < getElements().size() &&
|
||||||
getElements().get(itemSelected).canDrawSelection()) {
|
getElements().get(itemSelected).canDrawSelection()) {
|
||||||
drawTexture(x + itemSelectedX, y + itemSelectedY, 0, 232, ITEM_WIDTH, ITEM_HEIGHT);
|
drawTexture(x + itemSelectedX, y + itemSelectedY, 0, 232, ITEM_WIDTH, ITEM_HEIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.gui;
|
package com.raoulvdberge.refinedstorage.gui;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeNetworkTransmitter;
|
|
||||||
import com.raoulvdberge.refinedstorage.container.ContainerNetworkTransmitter;
|
import com.raoulvdberge.refinedstorage.container.ContainerNetworkTransmitter;
|
||||||
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileNetworkTransmitter;
|
import com.raoulvdberge.refinedstorage.tile.TileNetworkTransmitter;
|
||||||
|
@@ -65,8 +65,8 @@ public class GuiPriority extends GuiCraftingStart {
|
|||||||
@Override
|
@Override
|
||||||
protected int[] getIncrements() {
|
protected int[] getIncrements() {
|
||||||
return new int[]{
|
return new int[]{
|
||||||
1, 5, 10,
|
1, 5, 10,
|
||||||
-1, -5, -10
|
-1, -5, -10
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,9 +75,9 @@ public class GuiReaderWriter extends GuiBase {
|
|||||||
drawTexture(x, y, 0, 0, screenWidth, screenHeight);
|
drawTexture(x, y, 0, 0, screenWidth, screenHeight);
|
||||||
|
|
||||||
if (itemSelectedX != -1 &&
|
if (itemSelectedX != -1 &&
|
||||||
itemSelectedY != -1 &&
|
itemSelectedY != -1 &&
|
||||||
itemSelected >= 0 &&
|
itemSelected >= 0 &&
|
||||||
itemSelected < getChannels().size()) {
|
itemSelected < getChannels().size()) {
|
||||||
drawTexture(x + itemSelectedX, y + itemSelectedY, 0, 216, ITEM_WIDTH, ITEM_HEIGHT);
|
drawTexture(x + itemSelectedX, y + itemSelectedY, 0, 216, ITEM_WIDTH, ITEM_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -84,8 +84,8 @@ public class GuiStorage extends GuiBase {
|
|||||||
public void drawForeground(int mouseX, int mouseY) {
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
drawString(7, 7, t(gui.getGuiTitle()));
|
drawString(7, 7, t(gui.getGuiTitle()));
|
||||||
drawString(7, 42, gui.getCapacity() == -1 ?
|
drawString(7, 42, gui.getCapacity() == -1 ?
|
||||||
t("misc.refinedstorage:storage.stored_minimal", RSUtils.formatQuantity(gui.getStored())) :
|
t("misc.refinedstorage:storage.stored_minimal", RSUtils.formatQuantity(gui.getStored())) :
|
||||||
t("misc.refinedstorage:storage.stored_capacity_minimal", RSUtils.formatQuantity(gui.getStored()), RSUtils.formatQuantity(gui.getCapacity()))
|
t("misc.refinedstorage:storage.stored_capacity_minimal", RSUtils.formatQuantity(gui.getStored()), RSUtils.formatQuantity(gui.getCapacity()))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (texture.contains("disk_drive")) { // HACK!
|
if (texture.contains("disk_drive")) { // HACK!
|
||||||
@@ -102,8 +102,8 @@ public class GuiStorage extends GuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawTooltip(mouseX, mouseY, (gui.getCapacity() == -1 ?
|
drawTooltip(mouseX, mouseY, (gui.getCapacity() == -1 ?
|
||||||
t("misc.refinedstorage:storage.stored_minimal", gui.getStored()) :
|
t("misc.refinedstorage:storage.stored_minimal", gui.getStored()) :
|
||||||
t("misc.refinedstorage:storage.stored_capacity_minimal", gui.getStored(), gui.getCapacity())
|
t("misc.refinedstorage:storage.stored_capacity_minimal", gui.getStored(), gui.getCapacity())
|
||||||
) + "\n" + t("misc.refinedstorage:storage.full", full));
|
) + "\n" + t("misc.refinedstorage:storage.full", full));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -186,10 +186,10 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
|||||||
SORTING_NAME.setSortingDirection(grid.getSortingDirection());
|
SORTING_NAME.setSortingDirection(grid.getSortingDirection());
|
||||||
SORTING_QUANTITY.setSortingDirection(grid.getSortingDirection());
|
SORTING_QUANTITY.setSortingDirection(grid.getSortingDirection());
|
||||||
|
|
||||||
Collections.sort(stacks, SORTING_NAME);
|
stacks.sort(SORTING_NAME);
|
||||||
|
|
||||||
if (grid.getSortingType() == NetworkNodeGrid.SORTING_TYPE_QUANTITY) {
|
if (grid.getSortingType() == NetworkNodeGrid.SORTING_TYPE_QUANTITY) {
|
||||||
Collections.sort(stacks, SORTING_QUANTITY);
|
stacks.sort(SORTING_QUANTITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,9 +50,9 @@ public class ReaderWriterHandlerForgeEnergy implements IReaderWriterHandler {
|
|||||||
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
||||||
if (capability == CapabilityEnergy.ENERGY) {
|
if (capability == CapabilityEnergy.ENERGY) {
|
||||||
if (readerWriter instanceof IReader) {
|
if (readerWriter instanceof IReader) {
|
||||||
return (T) storageReader;
|
return CapabilityEnergy.ENERGY.cast(storageReader);
|
||||||
} else if (readerWriter instanceof IWriter) {
|
} else if (readerWriter instanceof IWriter) {
|
||||||
return (T) storageWriter;
|
return CapabilityEnergy.ENERGY.cast(storageWriter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -59,11 +59,11 @@ public class ReaderWriterHandlerTesla implements IReaderWriterHandler {
|
|||||||
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
public <T> T getCapability(IReaderWriter readerWriter, Capability<T> capability) {
|
||||||
if (readerWriter instanceof IReader || readerWriter instanceof IWriter) {
|
if (readerWriter instanceof IReader || readerWriter instanceof IWriter) {
|
||||||
if (capability == TeslaCapabilities.CAPABILITY_HOLDER) {
|
if (capability == TeslaCapabilities.CAPABILITY_HOLDER) {
|
||||||
return (T) container;
|
return TeslaCapabilities.CAPABILITY_HOLDER.cast(container);
|
||||||
} else if (capability == TeslaCapabilities.CAPABILITY_CONSUMER && readerWriter instanceof IReader) {
|
} else if (capability == TeslaCapabilities.CAPABILITY_CONSUMER && readerWriter instanceof IReader) {
|
||||||
return (T) containerReader;
|
return TeslaCapabilities.CAPABILITY_CONSUMER.cast(containerReader);
|
||||||
} else if (capability == TeslaCapabilities.CAPABILITY_PRODUCER && readerWriter instanceof IWriter) {
|
} else if (capability == TeslaCapabilities.CAPABILITY_PRODUCER && readerWriter instanceof IWriter) {
|
||||||
return (T) containerWriter;
|
return TeslaCapabilities.CAPABILITY_PRODUCER.cast(containerWriter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -202,10 +202,10 @@ public abstract class ItemNetworkItem extends ItemBase implements INetworkItemPr
|
|||||||
|
|
||||||
public boolean isValid(ItemStack stack) {
|
public boolean isValid(ItemStack stack) {
|
||||||
return stack.hasTagCompound()
|
return stack.hasTagCompound()
|
||||||
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_X)
|
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_X)
|
||||||
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_Y)
|
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_Y)
|
||||||
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_Z)
|
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_Z)
|
||||||
&& stack.getTagCompound().hasKey(NBT_DIMENSION_ID);
|
&& stack.getTagCompound().hasKey(NBT_DIMENSION_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NetworkItemCapabilityProvider implements ICapabilityProvider {
|
private class NetworkItemCapabilityProvider implements ICapabilityProvider {
|
||||||
@@ -218,7 +218,7 @@ public abstract class ItemNetworkItem extends ItemBase implements INetworkItemPr
|
|||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||||
return capability == CapabilityEnergy.ENERGY ||
|
return capability == CapabilityEnergy.ENERGY ||
|
||||||
(IntegrationTesla.isLoaded() && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER));
|
(IntegrationTesla.isLoaded() && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -139,8 +139,8 @@ public class ItemWrench extends ItemBase {
|
|||||||
next.writeToNBT(stack.getTagCompound());
|
next.writeToNBT(stack.getTagCompound());
|
||||||
|
|
||||||
player.sendMessage(new TextComponentTranslation(
|
player.sendMessage(new TextComponentTranslation(
|
||||||
"item.refinedstorage:wrench.mode",
|
"item.refinedstorage:wrench.mode",
|
||||||
new TextComponentTranslation("item.refinedstorage:wrench.mode." + next.id).setStyle(new Style().setColor(TextFormatting.YELLOW))
|
new TextComponentTranslation("item.refinedstorage:wrench.mode." + next.id).setStyle(new Style().setColor(TextFormatting.YELLOW))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class MessageGridItemUpdate implements IMessage, IMessageHandler<MessageGridItemUpdate, IMessage> {
|
public class MessageGridItemUpdate implements IMessage, IMessageHandler<MessageGridItemUpdate, IMessage> {
|
||||||
private INetworkMaster network;
|
private INetworkMaster network;
|
||||||
@@ -46,7 +47,7 @@ public class MessageGridItemUpdate implements IMessage, IMessageHandler<MessageG
|
|||||||
int size = network.getItemStorageCache().getList().getStacks().size();
|
int size = network.getItemStorageCache().getList().getStacks().size();
|
||||||
|
|
||||||
for (ICraftingPattern pattern : network.getCraftingManager().getPatterns()) {
|
for (ICraftingPattern pattern : network.getCraftingManager().getPatterns()) {
|
||||||
size += pattern.getOutputs().stream().filter(o -> o != null).count();
|
size += pattern.getOutputs().stream().filter(Objects::nonNull).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.writeInt(size);
|
buf.writeInt(size);
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.proxy;
|
package com.raoulvdberge.refinedstorage.proxy;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeProxy;
|
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeProxy;
|
||||||
@@ -10,8 +12,6 @@ import net.minecraftforge.common.capabilities.Capability;
|
|||||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
public class CapabilityNetworkNodeProxy {
|
public class CapabilityNetworkNodeProxy {
|
||||||
@CapabilityInject(INetworkNodeProxy.class)
|
@CapabilityInject(INetworkNodeProxy.class)
|
||||||
public static Capability<INetworkNodeProxy> NETWORK_NODE_PROXY_CAPABILITY = null;
|
public static Capability<INetworkNodeProxy> NETWORK_NODE_PROXY_CAPABILITY = null;
|
||||||
|
@@ -55,58 +55,58 @@ public class ProxyClient extends ProxyCommon {
|
|||||||
|
|
||||||
// Item Variants
|
// Item Variants
|
||||||
ModelBakery.registerItemVariants(RSItems.STORAGE_DISK,
|
ModelBakery.registerItemVariants(RSItems.STORAGE_DISK,
|
||||||
new ResourceLocation("refinedstorage:1k_storage_disk"),
|
new ResourceLocation("refinedstorage:1k_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:4k_storage_disk"),
|
new ResourceLocation("refinedstorage:4k_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:16k_storage_disk"),
|
new ResourceLocation("refinedstorage:16k_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:64k_storage_disk"),
|
new ResourceLocation("refinedstorage:64k_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:creative_storage_disk")
|
new ResourceLocation("refinedstorage:creative_storage_disk")
|
||||||
);
|
);
|
||||||
|
|
||||||
ModelBakery.registerItemVariants(RSItems.STORAGE_PART,
|
ModelBakery.registerItemVariants(RSItems.STORAGE_PART,
|
||||||
new ResourceLocation("refinedstorage:1k_storage_part"),
|
new ResourceLocation("refinedstorage:1k_storage_part"),
|
||||||
new ResourceLocation("refinedstorage:4k_storage_part"),
|
new ResourceLocation("refinedstorage:4k_storage_part"),
|
||||||
new ResourceLocation("refinedstorage:16k_storage_part"),
|
new ResourceLocation("refinedstorage:16k_storage_part"),
|
||||||
new ResourceLocation("refinedstorage:64k_storage_part")
|
new ResourceLocation("refinedstorage:64k_storage_part")
|
||||||
);
|
);
|
||||||
|
|
||||||
ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_DISK,
|
ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_DISK,
|
||||||
new ResourceLocation("refinedstorage:64k_fluid_storage_disk"),
|
new ResourceLocation("refinedstorage:64k_fluid_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:128k_fluid_storage_disk"),
|
new ResourceLocation("refinedstorage:128k_fluid_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:256k_fluid_storage_disk"),
|
new ResourceLocation("refinedstorage:256k_fluid_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:512k_fluid_storage_disk"),
|
new ResourceLocation("refinedstorage:512k_fluid_storage_disk"),
|
||||||
new ResourceLocation("refinedstorage:creative_fluid_storage_disk")
|
new ResourceLocation("refinedstorage:creative_fluid_storage_disk")
|
||||||
);
|
);
|
||||||
|
|
||||||
ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_PART,
|
ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_PART,
|
||||||
new ResourceLocation("refinedstorage:64k_fluid_storage_part"),
|
new ResourceLocation("refinedstorage:64k_fluid_storage_part"),
|
||||||
new ResourceLocation("refinedstorage:128k_fluid_storage_part"),
|
new ResourceLocation("refinedstorage:128k_fluid_storage_part"),
|
||||||
new ResourceLocation("refinedstorage:256k_fluid_storage_part"),
|
new ResourceLocation("refinedstorage:256k_fluid_storage_part"),
|
||||||
new ResourceLocation("refinedstorage:512k_fluid_storage_part")
|
new ResourceLocation("refinedstorage:512k_fluid_storage_part")
|
||||||
);
|
);
|
||||||
|
|
||||||
ModelBakery.registerItemVariants(RSItems.PROCESSOR,
|
ModelBakery.registerItemVariants(RSItems.PROCESSOR,
|
||||||
new ResourceLocation("refinedstorage:basic_printed_processor"),
|
new ResourceLocation("refinedstorage:basic_printed_processor"),
|
||||||
new ResourceLocation("refinedstorage:improved_printed_processor"),
|
new ResourceLocation("refinedstorage:improved_printed_processor"),
|
||||||
new ResourceLocation("refinedstorage:advanced_printed_processor"),
|
new ResourceLocation("refinedstorage:advanced_printed_processor"),
|
||||||
new ResourceLocation("refinedstorage:basic_processor"),
|
new ResourceLocation("refinedstorage:basic_processor"),
|
||||||
new ResourceLocation("refinedstorage:improved_processor"),
|
new ResourceLocation("refinedstorage:improved_processor"),
|
||||||
new ResourceLocation("refinedstorage:advanced_processor"),
|
new ResourceLocation("refinedstorage:advanced_processor"),
|
||||||
new ResourceLocation("refinedstorage:printed_silicon")
|
new ResourceLocation("refinedstorage:printed_silicon")
|
||||||
);
|
);
|
||||||
|
|
||||||
ModelBakery.registerItemVariants(RSItems.CORE,
|
ModelBakery.registerItemVariants(RSItems.CORE,
|
||||||
new ResourceLocation("refinedstorage:construction_core"),
|
new ResourceLocation("refinedstorage:construction_core"),
|
||||||
new ResourceLocation("refinedstorage:destruction_core")
|
new ResourceLocation("refinedstorage:destruction_core")
|
||||||
);
|
);
|
||||||
|
|
||||||
ModelBakery.registerItemVariants(RSItems.UPGRADE,
|
ModelBakery.registerItemVariants(RSItems.UPGRADE,
|
||||||
new ResourceLocation("refinedstorage:upgrade"),
|
new ResourceLocation("refinedstorage:upgrade"),
|
||||||
new ResourceLocation("refinedstorage:range_upgrade"),
|
new ResourceLocation("refinedstorage:range_upgrade"),
|
||||||
new ResourceLocation("refinedstorage:speed_upgrade"),
|
new ResourceLocation("refinedstorage:speed_upgrade"),
|
||||||
new ResourceLocation("refinedstorage:stack_upgrade"),
|
new ResourceLocation("refinedstorage:stack_upgrade"),
|
||||||
new ResourceLocation("refinedstorage:interdimensional_upgrade"),
|
new ResourceLocation("refinedstorage:interdimensional_upgrade"),
|
||||||
new ResourceLocation("refinedstorage:silk_touch_upgrade"),
|
new ResourceLocation("refinedstorage:silk_touch_upgrade"),
|
||||||
new ResourceLocation("refinedstorage:fortune_upgrade")
|
new ResourceLocation("refinedstorage:fortune_upgrade")
|
||||||
);
|
);
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeConstructor;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeConstructor;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
|
@@ -121,7 +121,7 @@ public class TileController extends TileBase implements INetworkMaster, IRedston
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(nodes, CLIENT_NODE_COMPARATOR);
|
nodes.sort(CLIENT_NODE_COMPARATOR);
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
@@ -221,8 +221,8 @@ public class TileController extends TileBase implements INetworkMaster, IRedston
|
|||||||
public void update() {
|
public void update() {
|
||||||
if (!getWorld().isRemote) {
|
if (!getWorld().isRemote) {
|
||||||
if (canRun()) {
|
if (canRun()) {
|
||||||
Collections.sort(itemStorage.getStorages(), STORAGE_COMPARATOR);
|
itemStorage.getStorages().sort(STORAGE_COMPARATOR);
|
||||||
Collections.sort(fluidStorage.getStorages(), STORAGE_COMPARATOR);
|
fluidStorage.getStorages().sort(STORAGE_COMPARATOR);
|
||||||
|
|
||||||
craftingManager.update();
|
craftingManager.update();
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ public class TileExporter extends TileNode<NetworkNodeExporter> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
public static final TileDataParameter<Boolean> CRAFT_ONLY = new TileDataParameter<Boolean>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileExporter>() {
|
public static final TileDataParameter<Boolean> CRAFT_ONLY = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileExporter>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean getValue(TileExporter tile) {
|
public Boolean getValue(TileExporter tile) {
|
||||||
return tile.getNode().isCraftOnly();
|
return tile.getNode().isCraftOnly();
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeInterface;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeInterface;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeNetworkTransmitter;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeNetworkTransmitter;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
@@ -20,7 +20,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class TileNode<T extends NetworkNode> extends TileBase implements INetworkNodeProxy<T>, INetworkNodeHolder, IRedstoneConfigurable {
|
public abstract class TileNode<N extends NetworkNode> extends TileBase implements INetworkNodeProxy<N>, INetworkNodeHolder, IRedstoneConfigurable {
|
||||||
public static final TileDataParameter<Integer> REDSTONE_MODE = RedstoneMode.createParameter();
|
public static final TileDataParameter<Integer> REDSTONE_MODE = RedstoneMode.createParameter();
|
||||||
|
|
||||||
private NBTTagCompound legacyTagToRead;
|
private NBTTagCompound legacyTagToRead;
|
||||||
@@ -121,7 +121,7 @@ public abstract class TileNode<T extends NetworkNode> extends TileBase implement
|
|||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public T getNode() {
|
public N getNode() {
|
||||||
INetworkNodeProvider provider = API.instance().getNetworkNodeProvider(getWorld().provider.getDimension());
|
INetworkNodeProvider provider = API.instance().getNetworkNodeProvider(getWorld().provider.getDimension());
|
||||||
|
|
||||||
INetworkNode node = provider.getNode(pos);
|
INetworkNode node = provider.getNode(pos);
|
||||||
@@ -130,10 +130,10 @@ public abstract class TileNode<T extends NetworkNode> extends TileBase implement
|
|||||||
provider.setNode(pos, node = createNode());
|
provider.setNode(pos, node = createNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
return (T) node;
|
return (N) node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract T createNode();
|
public abstract N createNode();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
|
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeStorage;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeStorage;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageItemNBT;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageItemNBT;
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeWirelessTransmitter;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeWirelessTransmitter;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
||||||
|
Reference in New Issue
Block a user