Refactor and import cleanup (Excluding network PR changed files)

This commit is contained in:
Justin Vitale 2020-07-09 23:04:42 +10:00
parent a36a0e6f4a
commit c4ef977f16
165 changed files with 1572 additions and 1625 deletions

View file

@ -36,7 +36,7 @@ public enum EFluidGenerator {
@Nonnull @Nonnull
private final String recipeID; private final String recipeID;
private EFluidGenerator(@Nonnull String recipeID) { EFluidGenerator(@Nonnull String recipeID) {
this.recipeID = recipeID; this.recipeID = recipeID;
} }

View file

@ -83,8 +83,6 @@ public class FluidGeneratorRecipe {
return false; return false;
} else if (!FluidUtils.fluidEquals(other.fluid, fluid)) } else if (!FluidUtils.fluidEquals(other.fluid, fluid))
return false; return false;
if (generatorType != other.generatorType) return generatorType == other.generatorType;
return false;
return true;
} }
} }

View file

@ -83,10 +83,7 @@ public class FluidGeneratorRecipeList {
return false; return false;
FluidGeneratorRecipeList other = (FluidGeneratorRecipeList) obj; FluidGeneratorRecipeList other = (FluidGeneratorRecipeList) obj;
if (recipes == null) { if (recipes == null) {
if (other.recipes != null) return other.recipes == null;
return false; } else return recipes.equals(other.recipes);
} else if (!recipes.equals(other.recipes))
return false;
return true;
} }
} }

View file

@ -25,7 +25,6 @@
package techreborn.api.generator; package techreborn.api.generator;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import java.util.EnumMap; import java.util.EnumMap;

View file

@ -34,7 +34,6 @@ import java.util.List;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class ScrapboxRecipeCrafter extends RecipeCrafter { public class ScrapboxRecipeCrafter extends RecipeCrafter {

View file

@ -37,7 +37,6 @@ import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntit
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class FusionReactorRecipe extends RebornRecipe { public class FusionReactorRecipe extends RebornRecipe {

View file

@ -48,7 +48,7 @@ public enum SlotType {
.orElse(null); .orElse(null);
} }
private BiConsumer<BlockEntityScreenHandlerBuilder, DataDrivenSlot> slotBiConsumer; private final BiConsumer<BlockEntityScreenHandlerBuilder, DataDrivenSlot> slotBiConsumer;
SlotType(BiConsumer<BlockEntityScreenHandlerBuilder, DataDrivenSlot> slotBiConsumer) { SlotType(BiConsumer<BlockEntityScreenHandlerBuilder, DataDrivenSlot> slotBiConsumer) {
this.slotBiConsumer = slotBiConsumer; this.slotBiConsumer = slotBiConsumer;

View file

@ -89,8 +89,7 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
if (!inputStack.isEmpty()) { if (!inputStack.isEmpty()) {
if (FluidUtils.isContainerEmpty(inputStack) && !tank.getFluidAmount().isEmpty()) { if (FluidUtils.isContainerEmpty(inputStack) && !tank.getFluidAmount().isEmpty()) {
FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluid()); FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluid());
} } else if (inputStack.getItem() instanceof ItemFluidInfo && getRecipes().getRecipeForFluid(((ItemFluidInfo) inputStack.getItem()).getFluid(inputStack)).isPresent()) {
else if (inputStack.getItem() instanceof ItemFluidInfo && getRecipes().getRecipeForFluid(((ItemFluidInfo) inputStack.getItem()).getFluid(inputStack)).isPresent()) {
FluidUtils.drainContainers(tank, inventory, 0, 1); FluidUtils.drainContainers(tank, inventory, 0, 1);
} }
} }
@ -118,8 +117,7 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
if (world.getTime() - lastOutput < 30 && !isActive()) { if (world.getTime() - lastOutput < 30 && !isActive()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true)); world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
} } else if (world.getTime() - lastOutput > 30 && isActive()) {
else if (world.getTime() - lastOutput > 30 && isActive()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false)); world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
} }
} }

View file

@ -54,7 +54,9 @@ public class LightningRodBlockEntity extends PowerAcceptorBlockEntity implements
public void tick() { public void tick() {
super.tick(); super.tick();
if (onStatusHoldTicks > 0) { --onStatusHoldTicks; } if (onStatusHoldTicks > 0) {
--onStatusHoldTicks;
}
Block BEBlock = getCachedState().getBlock(); Block BEBlock = getCachedState().getBlock();
if (!(BEBlock instanceof BlockMachineBase)) { if (!(BEBlock instanceof BlockMachineBase)) {
@ -83,7 +85,7 @@ public class LightningRodBlockEntity extends PowerAcceptorBlockEntity implements
lightningBolt.method_29495(Vec3d.ofBottomCenter(world.getTopPosition(Heightmap.Type.MOTION_BLOCKING, getPos()))); lightningBolt.method_29495(Vec3d.ofBottomCenter(world.getTopPosition(Heightmap.Type.MOTION_BLOCKING, getPos())));
if (!world.isClient) { if (!world.isClient) {
((ServerWorld) world).spawnEntity(lightningBolt); world.spawnEntity(lightningBolt);
} }
addEnergy(TechRebornConfig.lightningRodBaseEnergyStrike * (0.3F + weatherStrength)); addEnergy(TechRebornConfig.lightningRodBaseEnergyStrike * (0.3F + weatherStrength));
machineBaseBlock.setActive(true, world, pos); machineBaseBlock.setActive(true, world, pos);
@ -110,10 +112,7 @@ public class LightningRodBlockEntity extends PowerAcceptorBlockEntity implements
public boolean isValidIronFence(int y) { public boolean isValidIronFence(int y) {
Block block = this.world.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock(); Block block = this.world.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock();
if(block == TRContent.REFINED_IRON_FENCE){ return block == TRContent.REFINED_IRON_FENCE;
return true;
}
return false;
} }
@Override @Override

View file

@ -26,7 +26,6 @@ package techreborn.blockentity.generator;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;

View file

@ -55,8 +55,7 @@ public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IT
if (waterblocks > 0) { if (waterblocks > 0) {
addEnergy(waterblocks * TechRebornConfig.waterMillEnergyMultiplier); addEnergy(waterblocks * TechRebornConfig.waterMillEnergyMultiplier);
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true)); world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
} } else {
else {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false)); world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
} }
} }

View file

@ -37,7 +37,7 @@ import techreborn.init.TRBlockEntities;
public class LampBlockEntity extends PowerAcceptorBlockEntity public class LampBlockEntity extends PowerAcceptorBlockEntity
implements IToolDrop { implements IToolDrop {
private static int capacity = 33; private static final int capacity = 33;
public LampBlockEntity() { public LampBlockEntity() {
super(TRBlockEntities.LAMP); super(TRBlockEntities.LAMP);

View file

@ -38,7 +38,6 @@ import reborncore.common.util.RebornInventory;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
implements IToolDrop, InventoryProvider, IRecipeCrafterProvider { implements IToolDrop, InventoryProvider, IRecipeCrafterProvider {

View file

@ -60,6 +60,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Checks that we have all inputs and can put output into slot * Checks that we have all inputs and can put output into slot
*
* @return * @return
*/ */
protected abstract boolean canSmelt(); protected abstract boolean canSmelt();
@ -73,6 +74,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Returns the number of ticks that the supplied fuel item will keep the * Returns the number of ticks that the supplied fuel item will keep the
* furnace burning, or 0 if the item isn't fuel * furnace burning, or 0 if the item isn't fuel
*
* @param stack Itemstack of fuel * @param stack Itemstack of fuel
* @return Integer Number of ticks * @return Integer Number of ticks
*/ */
@ -85,6 +87,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Returns remaining fraction of fuel burn time * Returns remaining fraction of fuel burn time
*
* @param scale Scale to use for burn time * @param scale Scale to use for burn time
* @return int scaled remaining fuel burn time * @return int scaled remaining fuel burn time
*/ */
@ -98,6 +101,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Returns crafting progress * Returns crafting progress
*
* @param scale Scale to use for crafting progress * @param scale Scale to use for crafting progress
* @return int Scaled crafting progress * @return int Scaled crafting progress
*/ */
@ -110,6 +114,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Returns true if Iron Machine is burning fuel thus can do work * Returns true if Iron Machine is burning fuel thus can do work
*
* @return Boolean True if machine is burning * @return Boolean True if machine is burning
*/ */
public boolean isBurning() { public boolean isBurning() {

View file

@ -87,7 +87,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
@Override @Override
public RecipeCrafter getRecipeCrafter() { public RecipeCrafter getRecipeCrafter() {
return (RecipeCrafter) crafter; return crafter;
} }
// TilePowerAcceptor // TilePowerAcceptor

View file

@ -25,7 +25,6 @@
package techreborn.blockentity.machine.multiblock; package techreborn.blockentity.machine.multiblock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.BuiltScreenHandlerProvider;

View file

@ -150,9 +150,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
} }
} }
if (!missingOutput) { if (!missingOutput) {
if (hasOutputSpace(recipe.getOutput(), 9)) { return hasOutputSpace(recipe.getOutput(), 9);
return true;
}
} }
return false; return false;
} }
@ -173,9 +171,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
return true; return true;
} }
if (ItemUtils.isItemEqual(stack, output, true, true)) { if (ItemUtils.isItemEqual(stack, output, true, true)) {
if (stack.getMaxCount() > stack.getCount() + output.getCount()) { return stack.getMaxCount() > stack.getCount() + output.getCount();
return true;
}
} }
return false; return false;
} }

View file

@ -156,8 +156,7 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
ItemStack outputStack = inventory.getStack(outputSlot); ItemStack outputStack = inventory.getStack(outputSlot);
if (outputStack.isEmpty()) { if (outputStack.isEmpty()) {
inventory.setStack(outputSlot, recipe.getOutput().copy()); inventory.setStack(outputSlot, recipe.getOutput().copy());
} } else {
else {
// Just increment. We already checked stack match and stack size // Just increment. We already checked stack match and stack size
outputStack.increment(1); outputStack.increment(1);
} }
@ -187,6 +186,7 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
public void setCookTimeTotal(int cookTimeTotal) { public void setCookTimeTotal(int cookTimeTotal) {
this.cookTimeTotal = cookTimeTotal; this.cookTimeTotal = cookTimeTotal;
} }
// TilePowerAcceptor // TilePowerAcceptor
@Override @Override
public void tick() { public void tick() {

View file

@ -77,8 +77,7 @@ public class RecyclerBlockEntity extends PowerAcceptorBlockEntity
if (randomchance == 1) { if (randomchance == 1) {
if (inventory.getStack(1).isEmpty()) { if (inventory.getStack(1).isEmpty()) {
inventory.setStack(1, itemstack.copy()); inventory.setStack(1, itemstack.copy());
} } else {
else {
inventory.getStack(1).increment(itemstack.getCount()); inventory.getStack(1).increment(itemstack.getCount());
} }
} }
@ -92,10 +91,7 @@ public class RecyclerBlockEntity extends PowerAcceptorBlockEntity
public boolean hasSlotGotSpace(int slot) { public boolean hasSlotGotSpace(int slot) {
if (inventory.getStack(slot).isEmpty()) { if (inventory.getStack(slot).isEmpty()) {
return true; return true;
} else if (inventory.getStack(slot).getCount() < inventory.getStack(slot).getMaxCount()) { } else return inventory.getStack(slot).getCount() < inventory.getStack(slot).getMaxCount();
return true;
}
return false;
} }
public boolean isBurning() { public boolean isBurning() {
@ -129,8 +125,7 @@ public class RecyclerBlockEntity extends PowerAcceptorBlockEntity
boolean updateInventory = false; boolean updateInventory = false;
if (canRecycle() && !isBurning() && getEnergy() != 0) { if (canRecycle() && !isBurning() && getEnergy() != 0) {
setBurning(true); setBurning(true);
} } else if (isBurning()) {
else if (isBurning()) {
if (useEnergy(getEuPerTick(cost)) != getEuPerTick(cost)) { if (useEnergy(getEuPerTick(cost)) != getEuPerTick(cost)) {
this.setBurning(false); this.setBurning(false);
} }

View file

@ -69,7 +69,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
@Nonnull @Nonnull
public ItemStack currentRecipeOutput; public ItemStack currentRecipeOutput;
public RollingMachineRecipe currentRecipe; public RollingMachineRecipe currentRecipe;
private int outputSlot; private final int outputSlot;
public boolean locked = false; public boolean locked = false;
public int balanceSlot = 0; public int balanceSlot = 0;
@ -213,7 +213,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
List<Integer> possibleSlots = new ArrayList<>(); List<Integer> possibleSlots = new ArrayList<>();
for (int s = 0; s < currentRecipe.getPreviewInputs().size(); s++) { for (int s = 0; s < currentRecipe.getPreviewInputs().size(); s++) {
ItemStack stackInSlot = inventory.getStack(s); ItemStack stackInSlot = inventory.getStack(s);
Ingredient ingredient = (Ingredient) currentRecipe.getPreviewInputs().get(s); Ingredient ingredient = currentRecipe.getPreviewInputs().get(s);
if (ingredient != Ingredient.EMPTY && ingredient.test(sourceStack)) { if (ingredient != Ingredient.EMPTY && ingredient.test(sourceStack)) {
if (stackInSlot.isEmpty()) { if (stackInSlot.isEmpty()) {
possibleSlots.add(s); possibleSlots.add(s);

View file

@ -76,8 +76,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
private void addOutputProducts(int slot) { private void addOutputProducts(int slot) {
if (inventory.getStack(slot).isEmpty()) { if (inventory.getStack(slot).isEmpty()) {
inventory.setStack(slot, TRContent.Parts.UU_MATTER.getStack()); inventory.setStack(slot, TRContent.Parts.UU_MATTER.getStack());
} } else if (ItemUtils.isItemEqual(this.inventory.getStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)) {
else if (ItemUtils.isItemEqual(this.inventory.getStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)) {
inventory.getStack(slot).setCount((Math.min(64, 1 + inventory.getStack(slot).getCount()))); inventory.getStack(slot).setCount((Math.min(64, 1 + inventory.getStack(slot).getCount())));
} }
} }

View file

@ -113,7 +113,9 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
// MachineBaseBlockEntity // MachineBaseBlockEntity
@Override @Override
public void setFacing(Direction enumFacing) { public void setFacing(Direction enumFacing) {
if (world == null) { return; } if (world == null) {
return;
}
world.setBlockState(pos, world.getBlockState(pos).with(EnergyStorageBlock.FACING, enumFacing)); world.setBlockState(pos, world.getBlockState(pos).with(EnergyStorageBlock.FACING, enumFacing));
} }

View file

@ -34,7 +34,6 @@ import techreborn.init.TRContent;
/** /**
* Created by modmuss50 on 14/03/2016. * Created by modmuss50 on 14/03/2016.
*
*/ */
public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider { public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider {

View file

@ -34,7 +34,6 @@ import techreborn.init.TRContent;
/** /**
* Created by modmuss50 on 14/03/2016. * Created by modmuss50 on 14/03/2016.
*
*/ */
public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider { public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider {

View file

@ -43,7 +43,7 @@ import java.util.ArrayList;
public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider { public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider {
private int connectedBlocks = 0; private int connectedBlocks = 0;
private ArrayList<LesuNetwork> countedNetworks = new ArrayList<>(); private final ArrayList<LesuNetwork> countedNetworks = new ArrayList<>();
public LapotronicSUBlockEntity() { public LapotronicSUBlockEntity() {
super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.LOW, TechRebornConfig.lesuStoragePerBlock); super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.LOW, TechRebornConfig.lesuStoragePerBlock);
@ -62,11 +62,9 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements
maxOutput = TechRebornConfig.lesuBaseOutput + (connectedBlocks * TechRebornConfig.lesuExtraIOPerBlock); maxOutput = TechRebornConfig.lesuBaseOutput + (connectedBlocks * TechRebornConfig.lesuExtraIOPerBlock);
if (connectedBlocks < 32) { if (connectedBlocks < 32) {
return; return;
} } else if (connectedBlocks < 128) {
else if (connectedBlocks < 128) {
maxInput = EnergyTier.MEDIUM.getMaxInput(); maxInput = EnergyTier.MEDIUM.getMaxInput();
} } else {
else {
maxInput = EnergyTier.HIGH.getMaxInput(); maxInput = EnergyTier.HIGH.getMaxInput();
} }
} }

View file

@ -25,7 +25,6 @@
package techreborn.blockentity.storage.fluid; package techreborn.blockentity.storage.fluid;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;

View file

@ -32,10 +32,8 @@ import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;

View file

@ -30,7 +30,6 @@ import techreborn.client.GuiType;
/** /**
* @author modmuss50 * @author modmuss50
*
*/ */
public class DataDrivenMachineBlock extends GenericMachineBlock { public class DataDrivenMachineBlock extends GenericMachineBlock {

View file

@ -34,11 +34,10 @@ import java.util.function.Supplier;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class GenericMachineBlock extends BlockMachineBase { public class GenericMachineBlock extends BlockMachineBase {
private IMachineGuiHandler gui; private final IMachineGuiHandler gui;
Supplier<BlockEntity> blockEntityClass; Supplier<BlockEntity> blockEntityClass;
public GenericMachineBlock(IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) { public GenericMachineBlock(IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) {
@ -62,7 +61,6 @@ public class GenericMachineBlock extends BlockMachineBase {
} }
@Override @Override
public IMachineGuiHandler getGui() { public IMachineGuiHandler getGui() {
return gui; return gui;

View file

@ -56,8 +56,8 @@ public class BlockLamp extends BaseBlockEntityProvider {
public static BooleanProperty ACTIVE; public static BooleanProperty ACTIVE;
protected final VoxelShape[] shape; protected final VoxelShape[] shape;
private int cost; private final int cost;
private static int brightness = 15; private static final int brightness = 15;
public BlockLamp(int cost, double depth, double width) { public BlockLamp(int cost, double depth, double width) {
super(FabricBlockSettings.of(Material.REDSTONE_LAMP).strength(2f, 2f).lightLevel(brightness)); super(FabricBlockSettings.of(Material.REDSTONE_LAMP).strength(2f, 2f).lightLevel(brightness));
@ -97,7 +97,7 @@ public class BlockLamp extends BaseBlockEntityProvider {
} }
public static void setActive(Boolean active, World world, BlockPos pos) { public static void setActive(Boolean active, World world, BlockPos pos) {
Direction facing = (Direction)world.getBlockState(pos).get(FACING); Direction facing = world.getBlockState(pos).get(FACING);
BlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing); BlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
world.setBlockState(pos, state, 3); world.setBlockState(pos, state, 3);
} }

View file

@ -59,7 +59,7 @@ public class IronAlloyFurnaceBlock extends GenericMachineBlock {
worldIn.playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); worldIn.playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
} }
Direction facing = (Direction) stateIn.get(FACING); Direction facing = stateIn.get(FACING);
Direction.Axis facing$Axis = facing.getAxis(); Direction.Axis facing$Axis = facing.getAxis();
double double_5 = rand.nextDouble() * 0.6D - 0.3D; double double_5 = rand.nextDouble() * 0.6D - 0.3D;
double deltaX = facing$Axis == Direction.Axis.X ? (double) facing.getOffsetX() * 0.52D : double_5; double deltaX = facing$Axis == Direction.Axis.X ? (double) facing.getOffsetX() * 0.52D : double_5;

View file

@ -59,7 +59,7 @@ public class IronFurnaceBlock extends GenericMachineBlock {
worldIn.playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); worldIn.playSound(x, y, z, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
} }
Direction facing = (Direction) stateIn.get(FACING); Direction facing = stateIn.get(FACING);
Direction.Axis facing$Axis = facing.getAxis(); Direction.Axis facing$Axis = facing.getAxis();
double double_5 = rand.nextDouble() * 0.6D - 0.3D; double double_5 = rand.nextDouble() * 0.6D - 0.3D;
double deltaX = facing$Axis == Direction.Axis.X ? (double) facing.getOffsetX() * 0.52D : double_5; double deltaX = facing$Axis == Direction.Axis.X ? (double) facing.getOffsetX() * 0.52D : double_5;

View file

@ -177,7 +177,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
private final String name; private final String name;
private PlayerDetectorType(String name) { PlayerDetectorType(String name) {
this.name = name; this.name = name;
} }

View file

@ -84,7 +84,7 @@ public class BlockAlarm extends BaseBlockEntityProvider {
} }
public static Direction getFacing(BlockState state) { public static Direction getFacing(BlockState state) {
return (Direction) state.get(FACING); return state.get(FACING);
} }
public static void setFacing(Direction facing, World world, BlockPos pos) { public static void setFacing(Direction facing, World world, BlockPos pos) {

View file

@ -63,8 +63,7 @@ public class BlockComputerCube extends BlockMachineBase {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} } else {
else {
rotate(worldIn.getBlockState(pos), BlockRotation.CLOCKWISE_90); rotate(worldIn.getBlockState(pos), BlockRotation.CLOCKWISE_90);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }

View file

@ -56,10 +56,10 @@ public class BlockNuke extends BaseBlock {
public void ignite(World worldIn, BlockPos pos, BlockState state, LivingEntity igniter) { public void ignite(World worldIn, BlockPos pos, BlockState state, LivingEntity igniter) {
if (!worldIn.isClient) { if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F), EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (float) pos.getX() + 0.5F,
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter); pos.getY(), (float) pos.getZ() + 0.5F, igniter);
worldIn.spawnEntity(entitynukeprimed); worldIn.spawnEntity(entitynukeprimed);
worldIn.playSound((PlayerEntity) null, entitynukeprimed.getX(), entitynukeprimed.getY(), entitynukeprimed.getZ(), worldIn.playSound(null, entitynukeprimed.getX(), entitynukeprimed.getY(), entitynukeprimed.getZ(),
SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
} }
} }
@ -67,8 +67,8 @@ public class BlockNuke extends BaseBlock {
@Override @Override
public void onDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) { public void onDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
if (!worldIn.isClient) { if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F), EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (float) pos.getX() + 0.5F,
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getCausingEntity()); pos.getY(), (float) pos.getZ() + 0.5F, explosionIn.getCausingEntity());
entitynukeprimed.setFuse(worldIn.random.nextInt(TechRebornConfig.nukeFuseTime / 4) + TechRebornConfig.nukeFuseTime / 8); entitynukeprimed.setFuse(worldIn.random.nextInt(TechRebornConfig.nukeFuseTime / 4) + TechRebornConfig.nukeFuseTime / 8);
worldIn.spawnEntity(entitynukeprimed); worldIn.spawnEntity(entitynukeprimed);
} }

View file

@ -134,7 +134,9 @@ public class BlockRubberLog extends PillarBlock {
if (Energy.valid(stack)) { if (Energy.valid(stack)) {
Energy.of(stack).use(20); Energy.of(stack).use(20);
} else { } else {
stack.damage(1, playerIn, player -> { player.sendToolBreakStatus(hand); }); stack.damage(1, playerIn, player -> {
player.sendToolBreakStatus(hand);
});
} }
if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) { if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) {
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide())); WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide()));

View file

@ -29,7 +29,6 @@ import techreborn.utils.InitUtils;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class RubberButtonBlock extends WoodButtonBlock { public class RubberButtonBlock extends WoodButtonBlock {

View file

@ -29,7 +29,6 @@ import techreborn.utils.InitUtils;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class RubberDoorBlock extends DoorBlock { public class RubberDoorBlock extends DoorBlock {

View file

@ -29,7 +29,6 @@ import techreborn.utils.InitUtils;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class RubberPressurePlateBlock extends PressurePlateBlock { public class RubberPressurePlateBlock extends PressurePlateBlock {

View file

@ -29,7 +29,6 @@ import techreborn.utils.InitUtils;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class RubberTrapdoorBlock extends TrapdoorBlock { public class RubberTrapdoorBlock extends TrapdoorBlock {

View file

@ -28,10 +28,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolItem;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
@ -41,12 +39,10 @@ import net.minecraft.world.World;
import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.fluid.FluidValue; import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.RebornBucketItem;
import reborncore.common.fluid.container.FluidInstance; import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.fluid.container.ItemFluidInfo; import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity; import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.client.GuiType; import techreborn.client.GuiType;
import techreborn.init.TRContent; import techreborn.init.TRContent;

View file

@ -38,7 +38,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.api.items.InventoryBase;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.RebornInventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.WorldUtils; import reborncore.common.util.WorldUtils;
@ -114,7 +113,6 @@ public class StorageUnitBlock extends BlockMachineBase {
} }
@Override @Override
public IMachineGuiHandler getGui() { public IMachineGuiHandler getGui() {
return GuiType.STORAGE_UNIT; return GuiType.STORAGE_UNIT;

View file

@ -24,7 +24,6 @@
package techreborn.client; package techreborn.client;
import io.netty.buffer.Unpooled;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry; import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;

View file

@ -87,7 +87,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel); furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
++levels; ++levels;
} }
message = message + "+" + String.valueOf(levels) + "L"; message = message + "+" + levels + "L";
} }
} }

View file

@ -35,7 +35,6 @@ import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class GuiPlasmaGenerator extends GuiBase<BuiltScreenHandler> { public class GuiPlasmaGenerator extends GuiBase<BuiltScreenHandler> {

View file

@ -58,7 +58,9 @@ import java.util.function.Supplier;
public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBakedModel { public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBakedModel {
public abstract ModelIdentifier getBaseModel(); public abstract ModelIdentifier getBaseModel();
public abstract ModelIdentifier getBackgroundModel(); public abstract ModelIdentifier getBackgroundModel();
public abstract ModelIdentifier getFluidModel(); public abstract ModelIdentifier getFluidModel();
@Override @Override

View file

@ -24,34 +24,20 @@
package techreborn.client.render.entitys; package techreborn.client.render.entitys;
import net.minecraft.block.BlockState;
import net.minecraft.block.SignBlock;
import net.minecraft.block.WallSignBlock;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer; import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.StringRenderable;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity; import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import java.util.List;
import static net.minecraft.client.render.block.entity.SignBlockEntityRenderer.getModelTexture;
/** /**
* Created by drcrazy on 07-Jan-20 for TechReborn-1.15. * Created by drcrazy on 07-Jan-20 for TechReborn-1.15.
*/ */

View file

@ -34,8 +34,8 @@ import techreborn.init.TRContent;
public class DestructoPackScreenHandler extends ScreenHandler { public class DestructoPackScreenHandler extends ScreenHandler {
private PlayerEntity player; private final PlayerEntity player;
private RebornInventory<?> inv; private final RebornInventory<?> inv;
public DestructoPackScreenHandler(int syncID, PlayerEntity player) { public DestructoPackScreenHandler(int syncID, PlayerEntity player) {
super(null, syncID); super(null, syncID);

View file

@ -37,19 +37,16 @@ public class FurnaceFuelSlot extends BaseSlot {
} }
@Override @Override
public boolean canInsert(ItemStack stack) public boolean canInsert(ItemStack stack) {
{
return AbstractFurnaceBlockEntity.canUseAsFuel(stack) || isBucket(stack); return AbstractFurnaceBlockEntity.canUseAsFuel(stack) || isBucket(stack);
} }
@Override @Override
public int getMaxStackAmount(ItemStack stack) public int getMaxStackAmount(ItemStack stack) {
{
return isBucket(stack) ? 1 : super.getMaxStackAmount(stack); return isBucket(stack) ? 1 : super.getMaxStackAmount(stack);
} }
public static boolean isBucket(ItemStack stack) public static boolean isBucket(ItemStack stack) {
{
return stack.getItem() == Items.BUCKET; return stack.getItem() == Items.BUCKET;
} }
} }

View file

@ -109,8 +109,8 @@ public class TRRecipeParser {
} }
return new StackIngredient(Collections.singletonList(stack), amount, tag, requireEmpty); return new StackIngredient(Collections.singletonList(stack), amount, tag, requireEmpty);
} }
} } else
else throw new CDSyntaxError("Illegal object passed to TechReborn ingredient parser of type " + input.getClass().getName()); throw new CDSyntaxError("Illegal object passed to TechReborn ingredient parser of type " + input.getClass().getName());
} }
public static FluidInstance parseFluid(String fluid) { public static FluidInstance parseFluid(String fluid) {

View file

@ -62,7 +62,7 @@ import java.util.concurrent.Executor;
public class TRTweaker implements Tweaker { public class TRTweaker implements Tweaker {
public static final TRTweaker INSTANCE = new TRTweaker(); public static final TRTweaker INSTANCE = new TRTweaker();
private RecipeTweaker tweaker = RecipeTweaker.INSTANCE; private final RecipeTweaker tweaker = RecipeTweaker.INSTANCE;
private JsonObject debug; private JsonObject debug;
List<FluidGeneratorRecipe> added = new ArrayList<>(); List<FluidGeneratorRecipe> added = new ArrayList<>();
@ -112,6 +112,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Create a fluid ingredient * Create a fluid ingredient
*
* @param fluid The fluid required. * @param fluid The fluid required.
* @param holders The fluid-holding items the fluid can be in, or [] for any. * @param holders The fluid-holding items the fluid can be in, or [] for any.
* @param amount The amount of fluid needed, or -1 for any. * @param amount The amount of fluid needed, or -1 for any.
@ -136,6 +137,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a generic TechReborn recipe. * Register a generic TechReborn recipe.
*
* @param type The type of RebornRecipe to add. * @param type The type of RebornRecipe to add.
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
@ -169,6 +171,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to smelt in an alloy smelter. * Register a recipe to smelt in an alloy smelter.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -180,6 +183,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to assemble in an assembling machine. * Register a recipe to assemble in an assembling machine.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -191,6 +195,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to smelt in a TechReborn blast furnace. * Register a recipe to smelt in a TechReborn blast furnace.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -216,6 +221,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a centrifuge. * Register a recipe to process in a centrifuge.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -227,6 +233,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a chemical reactor. * Register a recipe to process in a chemical reactor.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -238,6 +245,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to compress in a compressor. * Register a recipe to compress in a compressor.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -249,6 +257,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to distil in a distillation tower. * Register a recipe to distil in a distillation tower.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -260,6 +269,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to extract in an extractor. * Register a recipe to extract in an extractor.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -271,6 +281,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a grinder. * Register a recipe to process in a grinder.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -282,6 +293,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in an implosion compressor. * Register a recipe to process in an implosion compressor.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -293,6 +305,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in an industrial electrolyzer. * Register a recipe to process in an industrial electrolyzer.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -304,6 +317,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in an industrial grinder. * Register a recipe to process in an industrial grinder.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -328,6 +342,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in an industrial grinder. * Register a recipe to process in an industrial grinder.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -354,6 +369,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in an industria sawmilll. * Register a recipe to process in an industria sawmilll.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -378,6 +394,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in an industrial sawmill. * Register a recipe to process in an industrial sawmill.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -404,6 +421,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a recycler. * Register a recipe to process in a recycler.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -415,6 +433,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to get from a scrapbox. Input is always a scrap box. * Register a recipe to get from a scrapbox. Input is always a scrap box.
*
* @param output The outputs of the recipe. * @param output The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
* @param time How many ticks (1/20 of a second) to process for. * @param time How many ticks (1/20 of a second) to process for.
@ -425,6 +444,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a vacuum freezer. * Register a recipe to process in a vacuum freezer.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -436,6 +456,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a fluid replicator. * Register a recipe to process in a fluid replicator.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
* @param time How many ticks (1/20 of a second) to process for. * @param time How many ticks (1/20 of a second) to process for.
@ -457,6 +478,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a fusion reactor. * Register a recipe to process in a fusion reactor.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -483,6 +505,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a rolling machine recipe from a 2D array of inputs, like a standard CraftTweaker recipe. * Register a rolling machine recipe from a 2D array of inputs, like a standard CraftTweaker recipe.
*
* @param inputs the 2D array (array of arrays) of inputs to use. * @param inputs the 2D array (array of arrays) of inputs to use.
* @param output The output of the recipe. * @param output The output of the recipe.
*/ */
@ -499,6 +522,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a rolling machine recipe from a 1D array of inputs. * Register a rolling machine recipe from a 1D array of inputs.
*
* @param inputs The input item or tag ids required in order: left to right, top to bottom. * @param inputs The input item or tag ids required in order: left to right, top to bottom.
* @param output The output of the recipe. * @param output The output of the recipe.
* @param width How many rows the recipe needs. * @param width How many rows the recipe needs.
@ -522,6 +546,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a rolling machine recipe from a pattern and dictionary. * Register a rolling machine recipe from a pattern and dictionary.
*
* @param pattern A crafting pattern like one you'd find in a vanilla recipe JSON. * @param pattern A crafting pattern like one you'd find in a vanilla recipe JSON.
* @param dictionary A map of single characters to item or tag ids. * @param dictionary A map of single characters to item or tag ids.
* @param output The output of the recipe. * @param output The output of the recipe.
@ -543,6 +568,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a solid canning machine. * Register a recipe to process in a solid canning machine.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -554,6 +580,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a recipe to process in a wire mill. * Register a recipe to process in a wire mill.
*
* @param inputs The input ingredients for the recipe. * @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe. * @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick. * @param power How much power the recipe consumes per tick.
@ -565,6 +592,7 @@ public class TRTweaker implements Tweaker {
/** /**
* Register a fluid to process in a fluid generator. * Register a fluid to process in a fluid generator.
*
* @param generator The type of generator: thermal, gas, diesel, semifluid, or plasma. * @param generator The type of generator: thermal, gas, diesel, semifluid, or plasma.
* @param fluid The fluid to add a recipe for. * @param fluid The fluid to add a recipe for.
* @param euPerMB How much EU should be generated per millibucket of fluid. * @param euPerMB How much EU should be generated per millibucket of fluid.

View file

@ -49,7 +49,7 @@ import java.util.List;
public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCategory<MachineRecipeDisplay<R>> { public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCategory<MachineRecipeDisplay<R>> {
private final RebornRecipeType<R> rebornRecipeType; private final RebornRecipeType<R> rebornRecipeType;
private int recipeLines; private final int recipeLines;
MachineRecipeCategory(RebornRecipeType<R> rebornRecipeType) { MachineRecipeCategory(RebornRecipeType<R> rebornRecipeType) {
this(rebornRecipeType, 2); this(rebornRecipeType, 2);

View file

@ -40,8 +40,8 @@ import java.util.Optional;
public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDisplay { public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDisplay {
private final R recipe; private final R recipe;
private List<List<EntryStack>> inputs; private final List<List<EntryStack>> inputs;
private List<EntryStack> outputs; private final List<EntryStack> outputs;
private int energy = 0; private int energy = 0;
private int heat = 0; private int heat = 0;
private int time = 0; private int time = 0;

View file

@ -43,8 +43,8 @@ import java.util.List;
public class FluidGeneratorRecipeCategory implements RecipeCategory<FluidGeneratorRecipeDisplay> { public class FluidGeneratorRecipeCategory implements RecipeCategory<FluidGeneratorRecipeDisplay> {
private TRContent.Machine generator; private final TRContent.Machine generator;
private Identifier identifier; private final Identifier identifier;
public FluidGeneratorRecipeCategory(TRContent.Machine generator) { public FluidGeneratorRecipeCategory(TRContent.Machine generator) {
this.generator = generator; this.generator = generator;

View file

@ -36,9 +36,9 @@ import java.util.List;
public class FluidGeneratorRecipeDisplay implements RecipeDisplay { public class FluidGeneratorRecipeDisplay implements RecipeDisplay {
private List<List<EntryStack>> inputs; private final List<List<EntryStack>> inputs;
private Identifier category; private final Identifier category;
private int totalEnergy; private final int totalEnergy;
public FluidGeneratorRecipeDisplay(FluidGeneratorRecipe recipe, Identifier category) { public FluidGeneratorRecipeDisplay(FluidGeneratorRecipe recipe, Identifier category) {
this.category = category; this.category = category;

View file

@ -41,9 +41,9 @@ import java.util.List;
public class FluidReplicatorRecipeDisplay implements RecipeDisplay { public class FluidReplicatorRecipeDisplay implements RecipeDisplay {
private final FluidReplicatorRecipe recipe; private final FluidReplicatorRecipe recipe;
private List<List<EntryStack>> inputs; private final List<List<EntryStack>> inputs;
private List<EntryStack> output; private final List<EntryStack> output;
private FluidInstance fluidInstance; private final FluidInstance fluidInstance;
private int energy = 0; private int energy = 0;
private int time = 0; private int time = 0;

View file

@ -28,16 +28,10 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MovementType; import net.minecraft.entity.MovementType;
import net.minecraft.entity.TntEntity; import net.minecraft.entity.TntEntity;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
import net.minecraft.particle.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.common.explosion.RebornExplosion; import reborncore.common.explosion.RebornExplosion;
import team.reborn.energy.EnergyTier;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
/** /**
* Created by Mark on 13/03/2016. * Created by Mark on 13/03/2016.

View file

@ -59,7 +59,7 @@ import java.util.Map;
public class StackToolTipHandler implements ItemTooltipCallback { public class StackToolTipHandler implements ItemTooltipCallback {
private static ArrayList<Block> wipBlocks = new ArrayList<>(); private static final ArrayList<Block> wipBlocks = new ArrayList<>();
public static final Map<Item, Boolean> ITEM_ID = Maps.newHashMap(); public static final Map<Item, Boolean> ITEM_ID = Maps.newHashMap();
public static void setup() { public static void setup() {

View file

@ -56,7 +56,7 @@ public class TRRecipeHandler {
if (!recipe.getId().getNamespace().equals(TechReborn.MOD_ID)) { if (!recipe.getId().getNamespace().equals(TechReborn.MOD_ID)) {
return false; return false;
} }
return !recipe.getPreviewInputs().stream().anyMatch((Predicate<Ingredient>) ingredient -> ingredient.test(TRContent.Parts.UU_MATTER.getStack())); return !recipe.getPreviewInputs().stream().anyMatch(ingredient -> ingredient.test(TRContent.Parts.UU_MATTER.getStack()));
} }
} }

View file

@ -71,7 +71,6 @@ public class ModLoot {
LootPoolEntry energyFlowChip = makeEntry(Parts.ENERGY_FLOW_CHIP); LootPoolEntry energyFlowChip = makeEntry(Parts.ENERGY_FLOW_CHIP);
LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot) LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot)
.withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedronIngot).withEntry(advancedalloyIngot) .withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedronIngot).withEntry(advancedalloyIngot)
.withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootTableRange.between(1.0f, 2.0f)) .withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootTableRange.between(1.0f, 2.0f))

View file

@ -73,7 +73,7 @@ import java.util.function.Supplier;
public class TRBlockEntities { public class TRBlockEntities {
private static List<BlockEntityType<?>> TYPES = new ArrayList<>(); private static final List<BlockEntityType<?>> TYPES = new ArrayList<>();
public static final BlockEntityType<StorageUnitBaseBlockEntity> STORAGE_UNIT = register(StorageUnitBaseBlockEntity::new, "storage_unit", TRContent.StorageUnit.values()); public static final BlockEntityType<StorageUnitBaseBlockEntity> STORAGE_UNIT = register(StorageUnitBaseBlockEntity::new, "storage_unit", TRContent.StorageUnit.values());

View file

@ -25,12 +25,7 @@
package techreborn.init; package techreborn.init;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.*;
import net.minecraft.block.Material;
import net.minecraft.block.OreBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.StairsBlock;
import net.minecraft.block.WallBlock;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemConvertible;
@ -67,11 +62,7 @@ import techreborn.blocks.machine.tier0.IronAlloyFurnaceBlock;
import techreborn.blocks.machine.tier0.IronFurnaceBlock; import techreborn.blocks.machine.tier0.IronFurnaceBlock;
import techreborn.blocks.machine.tier1.BlockPlayerDetector; import techreborn.blocks.machine.tier1.BlockPlayerDetector;
import techreborn.blocks.machine.tier1.ResinBasinBlock; import techreborn.blocks.machine.tier1.ResinBasinBlock;
import techreborn.blocks.misc.BlockAlarm; import techreborn.blocks.misc.*;
import techreborn.blocks.misc.BlockMachineCasing;
import techreborn.blocks.misc.BlockMachineFrame;
import techreborn.blocks.misc.BlockStorage;
import techreborn.blocks.misc.TechRebornStairsBlock;
import techreborn.blocks.storage.energy.*; import techreborn.blocks.storage.energy.*;
import techreborn.blocks.storage.fluid.TankUnitBlock; import techreborn.blocks.storage.fluid.TankUnitBlock;
import techreborn.blocks.storage.item.StorageUnitBlock; import techreborn.blocks.storage.item.StorageUnitBlock;
@ -88,11 +79,7 @@ import techreborn.items.armor.QuantumSuitItem;
import techreborn.utils.InitUtils; import techreborn.utils.InitUtils;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Arrays; import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Stream; import java.util.stream.Stream;

View file

@ -96,8 +96,7 @@ public class TRDispenserBehavior {
} else { } else {
return super.dispenseSilently(pointer, stack); return super.dispenseSilently(pointer, stack);
} }
} } else {
else {
// drain cell // drain cell
if (cell.placeFluid(null, pointer.getWorld(), blockPos, null, stack)) { if (cell.placeFluid(null, pointer.getWorld(), blockPos, null, stack)) {
ItemStack emptyCell = cell.getEmpty(); ItemStack emptyCell = cell.getEmpty();

View file

@ -57,9 +57,13 @@ public enum TRToolTier implements ToolMaterial {
* against. * against.
*/ */
private final float efficiency; private final float efficiency;
/** Damage versus entities. */ /**
* Damage versus entities.
*/
private final float attackDamage; private final float attackDamage;
/** Defines the natural enchantability factor of the material. */ /**
* Defines the natural enchantability factor of the material.
*/
private final int enchantability; private final int enchantability;
private final Lazy<Ingredient> repairMaterial; private final Lazy<Ingredient> repairMaterial;

View file

@ -7,7 +7,6 @@ import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.util.registry.Registry;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import java.io.IOException; import java.io.IOException;

View file

@ -1,10 +1,6 @@
package techreborn.init.template; package techreborn.init.template;
import com.google.gson.Gson; import com.google.gson.*;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;

View file

@ -102,7 +102,9 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
} }
@Override @Override
public boolean isEnchantable(ItemStack stack) { return true; } public boolean isEnchantable(ItemStack stack) {
return true;
}
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override

View file

@ -147,8 +147,6 @@ public class FluidUtils {
if (!(inputStack.getItem() instanceof ItemFluidInfo)) if (!(inputStack.getItem() instanceof ItemFluidInfo))
return false; return false;
ItemFluidInfo itemFluidInfo = (ItemFluidInfo) inputStack.getItem(); ItemFluidInfo itemFluidInfo = (ItemFluidInfo) inputStack.getItem();
if (itemFluidInfo.getFluid(inputStack) != Fluids.EMPTY) return itemFluidInfo.getFluid(inputStack) == Fluids.EMPTY;
return false;
return true;
} }
} }

View file

@ -26,7 +26,6 @@ package techreborn.utils;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class PlayerUtils { public class PlayerUtils {

View file

@ -41,9 +41,7 @@ public class RecipeUtils {
} }
/** /**
*
* Used to get the matching output of a recipe type that only has 1 input * Used to get the matching output of a recipe type that only has 1 input
*
*/ */
public static <T extends Recipe<?>> ItemStack getMatchingRecipes(World world, RecipeType<T> type, ItemStack input) { public static <T extends Recipe<?>> ItemStack getMatchingRecipes(World world, RecipeType<T> type, ItemStack input) {
return getRecipes(world, type).stream() return getRecipes(world, type).stream()

View file

@ -85,7 +85,7 @@ public class ToolTipAssistUtils {
if (I18n.hasTranslation(key)) { if (I18n.hasTranslation(key)) {
if (!hidden || Screen.hasShiftDown()) { if (!hidden || Screen.hasShiftDown()) {
String info = I18n.translate(key); String info = I18n.translate(key);
String infoLines[] = info.split("\\r?\\n"); String[] infoLines = info.split("\\r?\\n");
for (String infoLine : infoLines) { for (String infoLine : infoLines) {
list.add(new LiteralText(infoColour + infoLine)); list.add(new LiteralText(infoColour + infoLine));

View file

@ -71,6 +71,7 @@ public class ToolsUtil {
/** /**
* Fills in set of BlockPos which should be broken by AOE mining * Fills in set of BlockPos which should be broken by AOE mining
*
* @param worldIn World reference * @param worldIn World reference
* @param pos BlockPos Position of originally broken block * @param pos BlockPos Position of originally broken block
* @param entityLiving LivingEntity Player who broke block * @param entityLiving LivingEntity Player who broke block

View file

@ -40,7 +40,6 @@ import java.util.Set;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class RubberTreeFeature extends TreeFeature { public class RubberTreeFeature extends TreeFeature {
@ -82,5 +81,4 @@ public class RubberTreeFeature extends TreeFeature {
} }
} }

View file

@ -55,7 +55,6 @@ import java.util.List;
/** /**
* @author drcrazy * @author drcrazy
*
*/ */
public class WorldGenerator { public class WorldGenerator {
@ -64,7 +63,7 @@ public class WorldGenerator {
public static TreeFeatureConfig RUBBER_TREE_CONFIG; public static TreeFeatureConfig RUBBER_TREE_CONFIG;
private static List<Biome> checkedBiomes = new ArrayList<>(); private static final List<Biome> checkedBiomes = new ArrayList<>();
public static void initBiomeFeatures() { public static void initBiomeFeatures() {
setupTrees(); setupTrees();