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
private final String recipeID;
private EFluidGenerator(@Nonnull String recipeID) {
EFluidGenerator(@Nonnull String recipeID) {
this.recipeID = recipeID;
}

View file

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

View file

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

View file

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

View file

@ -34,7 +34,6 @@ import java.util.List;
/**
* @author drcrazy
*
*/
public class ScrapboxRecipeCrafter extends RecipeCrafter {
@ -49,9 +48,9 @@ public class ScrapboxRecipeCrafter extends RecipeCrafter {
}
@Override
public void updateCurrentRecipe(){
public void updateCurrentRecipe() {
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(blockEntity.getWorld());
if(scrapboxRecipeList.isEmpty()){
if (scrapboxRecipeList.isEmpty()) {
setCurrentRecipe(null);
return;
}
@ -62,4 +61,4 @@ public class ScrapboxRecipeCrafter extends RecipeCrafter {
this.currentTickTime = 0;
setIsActive();
}
}
}

View file

@ -37,7 +37,6 @@ import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntit
/**
* @author drcrazy
*
*/
public class FusionReactorRecipe extends RebornRecipe {
@ -54,7 +53,7 @@ public class FusionReactorRecipe extends RebornRecipe {
this.minSize = minSize;
}
public int getStartEnergy () {
public int getStartEnergy() {
return startE;
}

View file

@ -58,7 +58,7 @@ public class RollingMachineRecipe extends RebornRecipe {
@Override
public void deserialize(JsonObject jsonObject) {
if(jsonObject.has("shaped")) {
if (jsonObject.has("shaped")) {
JsonObject json = JsonHelper.getObject(jsonObject, "shaped");
shapedRecipe = RecipeSerializer.SHAPED.read(getId(), json);
} else {

View file

@ -63,7 +63,7 @@ public class DataDrivenBEProvider extends BlockEntityType<DataDrivenBEProvider.D
private final List<DataDrivenSlot> slots;
public static DataDrivenBEProvider create(Block block, Identifier identifier){
public static DataDrivenBEProvider create(Block block, Identifier identifier) {
String location = String.format("%s/machines/%s.json", identifier.getNamespace(), identifier.getPath());
JsonObject jsonObject;
try {
@ -127,7 +127,7 @@ public class DataDrivenBEProvider extends BlockEntityType<DataDrivenBEProvider.D
@Override
public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) {
return provider.createScreenHandler(this,syncID, player);
return provider.createScreenHandler(this, syncID, player);
}
public DataDrivenBEProvider getProvider() {
@ -139,13 +139,13 @@ public class DataDrivenBEProvider extends BlockEntityType<DataDrivenBEProvider.D
return slots.stream().filter(slot -> slot.getType() == SlotType.ENERGY).findFirst().orElse(null).getId();
}
private int countOfSlotType(SlotType type){
private int countOfSlotType(SlotType type) {
return (int) slots.stream()
.filter(slot -> slot.getType() == type)
.count();
}
private int[] slotIds(SlotType type){
private int[] slotIds(SlotType type) {
return slots.stream()
.filter(slot -> slot.getType() == type)
.mapToInt(DataDrivenSlot::getId)
@ -156,7 +156,7 @@ public class DataDrivenBEProvider extends BlockEntityType<DataDrivenBEProvider.D
return Collections.unmodifiableList(slots);
}
private String getSimpleName(){
private String getSimpleName() {
return WordUtils.capitalize(identifier.getPath());
}
}

View file

@ -41,7 +41,7 @@ import java.util.stream.Collectors;
public class DataDrivenSlot {
public static List<DataDrivenSlot> read(JsonArray jsonArray){
public static List<DataDrivenSlot> read(JsonArray jsonArray) {
AtomicInteger idCount = new AtomicInteger();
return SerializationUtil.stream(jsonArray)
.map(JsonElement::getAsJsonObject)
@ -78,14 +78,14 @@ public class DataDrivenSlot {
return type;
}
public void add(BlockEntityScreenHandlerBuilder inventoryBuilder){
public void add(BlockEntityScreenHandlerBuilder inventoryBuilder) {
type.getSlotBiConsumer().accept(inventoryBuilder, this);
}
@Environment(EnvType.CLIENT)
public void draw(MatrixStack matrixStack, GuiBase<?> guiBase, GuiBase.Layer layer){
public void draw(MatrixStack matrixStack, GuiBase<?> guiBase, GuiBase.Layer layer) {
//TODO find a better way to do this
if(getType() == SlotType.OUTPUT){
if (getType() == SlotType.OUTPUT) {
guiBase.drawOutputSlot(matrixStack, getX(), getY(), layer);
} else {
guiBase.drawSlot(matrixStack, getX(), getY(), layer);

View file

@ -41,14 +41,14 @@ public enum SlotType {
builder.energySlot(slot.getId(), slot.getX(), slot.getY());
});
public static SlotType fromString(String string){
public static SlotType fromString(String string) {
return Arrays.stream(values())
.filter(slotType -> slotType.name().equalsIgnoreCase(string))
.findFirst()
.orElse(null);
}
private BiConsumer<BlockEntityScreenHandlerBuilder, DataDrivenSlot> slotBiConsumer;
private final BiConsumer<BlockEntityScreenHandlerBuilder, DataDrivenSlot> slotBiConsumer;
SlotType(BiConsumer<BlockEntityScreenHandlerBuilder, DataDrivenSlot> slotBiConsumer) {
this.slotBiConsumer = slotBiConsumer;

View file

@ -79,7 +79,7 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
super.tick();
ticksSinceLastChange++;
if(world.isClient){
if (world.isClient) {
return;
}
@ -89,8 +89,7 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
if (!inputStack.isEmpty()) {
if (FluidUtils.isContainerEmpty(inputStack) && !tank.getFluidAmount().isEmpty()) {
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);
}
}
@ -118,14 +117,13 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
if (world.getTime() - lastOutput < 30 && !isActive()) {
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));
}
}
public int getProgressScaled(int scale) {
if (isActive()){
if (isActive()) {
return ticksSinceLastChange * scale;
}
return 0;
@ -207,11 +205,11 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
this.ticksSinceLastChange = ticksSinceLastChange;
}
public FluidValue getTankAmount(){
public FluidValue getTankAmount() {
return tank.getFluidAmount();
}
public void setTankAmount(FluidValue amount){
public void setTankAmount(FluidValue amount) {
tank.setFluidAmount(amount);
}

View file

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

View file

@ -26,7 +26,6 @@ package techreborn.blockentity.generator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
@ -151,7 +150,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
public void tick() {
super.tick();
if (world == null){
if (world == null) {
return;
}
@ -191,7 +190,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
@Override
public double getBaseMaxOutput() {
if (getPanel() == TRContent.SolarPanels.CREATIVE){
if (getPanel() == TRContent.SolarPanels.CREATIVE) {
return EnergyTier.INSANE.getMaxOutput();
}
// Solar panel output will only be limited by the cables the users use

View file

@ -64,11 +64,11 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
}
public static int getItemBurnTime(@Nonnull ItemStack stack) {
if (stack.isEmpty()){
if (stack.isEmpty()) {
return 0;
}
Map<Item, Integer> burnMap = AbstractFurnaceBlockEntity.createFuelTimeMap();
if(burnMap.containsKey(stack.getItem())){
if (burnMap.containsKey(stack.getItem())) {
return burnMap.get(stack.getItem()) / 4;
}
return 0;

View file

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

View file

@ -52,7 +52,7 @@ public class WindMillBlockEntity extends PowerAcceptorBlockEntity implements ITo
boolean generating = pos.getY() > 64;
if(world.isClient) {
if (world.isClient) {
bladeAngle += spinSpeed;
if (generating) {

View file

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

View file

@ -38,10 +38,9 @@ import reborncore.common.util.RebornInventory;
/**
* @author drcrazy
*
*/
public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
implements IToolDrop, InventoryProvider, IRecipeCrafterProvider{
implements IToolDrop, InventoryProvider, IRecipeCrafterProvider {
public String name;
public int maxInput;

View file

@ -60,6 +60,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/**
* Checks that we have all inputs and can put output into slot
*
* @return
*/
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
* furnace burning, or 0 if the item isn't fuel
*
* @param stack Itemstack of fuel
* @return Integer Number of ticks
*/
@ -85,6 +87,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/**
* Returns remaining fraction of fuel burn time
*
* @param scale Scale to use for burn time
* @return int scaled remaining fuel burn time
*/
@ -98,6 +101,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/**
* Returns crafting progress
*
* @param scale Scale to use for 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
*
* @return Boolean True if machine is burning
*/
public boolean isBurning() {
@ -146,7 +151,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
@Override
public void tick() {
super.tick();
if(world.isClient){
if (world.isClient) {
return;
}
boolean isBurning = isBurning();
@ -175,7 +180,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
progress = 0;
smelt();
}
} else if(!canSmelt()) {
} else if (!canSmelt()) {
progress = 0;
}

View file

@ -87,7 +87,7 @@ public class AlarmBlockEntity extends BlockEntity
// ITickable
@Override
public void tick() {
if (world.isClient()){
if (world.isClient()) {
return;
}
if (world.getTime() % 25 != 0) {

View file

@ -53,7 +53,7 @@ public class ChargeOMatBlockEntity extends PowerAcceptorBlockEntity
public void tick() {
super.tick();
if(world.isClient){
if (world.isClient) {
return;
}
for (int i = 0; i < 6; i++) {

View file

@ -43,7 +43,7 @@ public class DrainBlockEntity extends MachineBaseBlockEntity {
protected Tank internalTank = new Tank("tank", FluidValue.BUCKET, this);
public DrainBlockEntity(){
public DrainBlockEntity() {
this(TRBlockEntities.DRAIN);
}
@ -54,13 +54,13 @@ public class DrainBlockEntity extends MachineBaseBlockEntity {
@Override
public void tick() {
super.tick();
if(world.isClient){
if (world.isClient) {
return;
}
if (world.getTime() % 10 == 0) {
if(internalTank.isEmpty()) {
if (internalTank.isEmpty()) {
tryDrain();
}
}
@ -72,7 +72,7 @@ public class DrainBlockEntity extends MachineBaseBlockEntity {
return internalTank;
}
private void tryDrain(){
private void tryDrain() {
// Position above drain
BlockPos above = this.getPos().up();

View file

@ -51,7 +51,7 @@ public class DistillationTowerBlockEntity extends GenericMachineBlockEntity impl
@Override
public void writeMultiblock(MultiblockWriter writer) {
writer .translate(1, 0, -1)
writer.translate(1, 0, -1)
.fill(0, 0, 0, 3, 1, 3, TRContent.MachineBlocks.BASIC.getCasing().getDefaultState())
.ringWithAir(Direction.Axis.Y, 3, 1, 3, TRContent.MachineBlocks.INDUSTRIAL.getCasing().getDefaultState())
.ringWithAir(Direction.Axis.Y, 3, 2, 3, TRContent.MachineBlocks.BASIC.getCasing().getDefaultState())

View file

@ -65,7 +65,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
@Override
public void writeMultiblock(MultiblockWriter writer) {
BlockState state = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState();
writer .translate(1, 0, -1)
writer.translate(1, 0, -1)
.ring(Direction.Axis.Y, 3, 0, 3, (v, p) -> v.getBlockState(p) == state, state, null, null);
}
@ -87,7 +87,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
@Override
public RecipeCrafter getRecipeCrafter() {
return (RecipeCrafter) crafter;
return crafter;
}
// TilePowerAcceptor

View file

@ -51,7 +51,7 @@ public class ImplosionCompressorBlockEntity extends GenericMachineBlockEntity im
@Override
public void writeMultiblock(MultiblockWriter writer) {
writer .translate(-1, -3, -1)
writer.translate(-1, -3, -1)
.fill(0, 0, 0, 3, 1, 3, TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState())
.ringWithAir(Direction.Axis.Y, 3, 1, 3, TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState())
.fill(0, 2, 0, 3, 3, 3, TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState());

View file

@ -79,7 +79,7 @@ public class IndustrialBlastFurnaceBlockEntity extends GenericMachineBlockEntity
return state == lava || state.getBlock() == Blocks.AIR;
};
writer .translate(1, 0, -1)
writer.translate(1, 0, -1)
.fill(0, 0, 0, 3, 1, 3, casing, basic)
.ring(Direction.Axis.Y, 3, 1, 3, casing, basic, maybeLava, lava)
.ring(Direction.Axis.Y, 3, 2, 3, casing, basic, maybeLava, lava)

View file

@ -67,7 +67,7 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
public void writeMultiblock(MultiblockWriter writer) {
BlockState basic = TRContent.MachineBlocks.BASIC.getCasing().getDefaultState();
BlockState advanced = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState();
writer .translate(1, -1, -1)
writer.translate(1, -1, -1)
.fill(0, 0, 0, 3, 1, 3, basic)
.ring(Direction.Axis.Y, 3, 1, 3, (view, pos) -> view.getBlockState(pos) == advanced, advanced, (view, pos) -> view.getBlockState(pos).getMaterial() == Material.WATER, Blocks.WATER.getDefaultState())
.fill(0, 2, 0, 3, 3, 3, basic);

View file

@ -67,7 +67,7 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
public void writeMultiblock(MultiblockWriter writer) {
BlockState basic = TRContent.MachineBlocks.BASIC.getCasing().getDefaultState();
BlockState advanced = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState();
writer .translate(1, -1, -1)
writer.translate(1, -1, -1)
.fill(0, 0, 0, 3, 1, 3, basic)
.ring(Direction.Axis.Y, 3, 1, 3, (view, pos) -> view.getBlockState(pos) == advanced, advanced, (view, pos) -> view.getBlockState(pos).getMaterial() == Material.WATER, Blocks.WATER.getDefaultState())
.fill(0, 2, 0, 3, 3, 3, basic);

View file

@ -25,7 +25,6 @@
package techreborn.blockentity.machine.multiblock;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.Direction;
import reborncore.client.screen.BuiltScreenHandlerProvider;
@ -56,7 +55,7 @@ public class VacuumFreezerBlockEntity extends GenericMachineBlockEntity implemen
BlockState advanced = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState();
BlockState industrial = TRContent.MachineBlocks.INDUSTRIAL.getCasing().getDefaultState();
writer .translate(-1, -3, -1)
writer.translate(-1, -3, -1)
.fill(0, 0, 0, 3, 1, 3, advanced)
.ringWithAir(Direction.Axis.Y, 3, 1, 3, industrial)
.fill(0, 2, 0, 3, 3, 3, advanced);

View file

@ -40,8 +40,8 @@ public class AlloySmelterBlockEntity extends GenericMachineBlockEntity implement
public AlloySmelterBlockEntity() {
super(TRBlockEntities.ALLOY_SMELTER, "AlloySmelter", TechRebornConfig.alloySmelterMaxInput, TechRebornConfig.alloySmelterMaxEnergy, TRContent.Machine.ALLOY_SMELTER.block, 3);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2 };
final int[] inputs = new int[]{0, 1};
final int[] outputs = new int[]{2};
this.inventory = new RebornInventory<>(4, "AlloySmelterBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.ALLOY_SMELTER, this, 2, 1, this.inventory, inputs, outputs);
}

View file

@ -40,8 +40,8 @@ public class AssemblingMachineBlockEntity extends GenericMachineBlockEntity impl
public AssemblingMachineBlockEntity() {
super(TRBlockEntities.ASSEMBLY_MACHINE, "AssemblingMachine", TechRebornConfig.assemblingMachineMaxInput, TechRebornConfig.assemblingMachineMaxEnergy, TRContent.Machine.ASSEMBLY_MACHINE.block, 3);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2 };
final int[] inputs = new int[]{0, 1};
final int[] outputs = new int[]{2};
this.inventory = new RebornInventory<>(4, "AssemblingMachineBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.ASSEMBLING_MACHINE, this, 2, 2, this.inventory, inputs, outputs);
}

View file

@ -127,7 +127,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
if (ingredient != Ingredient.EMPTY) {
boolean foundIngredient = false;
for (int i = 0; i < 9; i++) {
if(checkedSlots.contains(i)) {
if (checkedSlots.contains(i)) {
continue;
}
ItemStack stack = inventory.getStack(i);
@ -150,9 +150,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
}
}
if (!missingOutput) {
if (hasOutputSpace(recipe.getOutput(), 9)) {
return true;
}
return hasOutputSpace(recipe.getOutput(), 9);
}
return false;
}
@ -173,9 +171,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
return true;
}
if (ItemUtils.isItemEqual(stack, output, true, true)) {
if (stack.getMaxCount() > stack.getCount() + output.getCount()) {
return true;
}
return stack.getMaxCount() > stack.getCount() + output.getCount();
}
return false;
}
@ -191,7 +187,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
ItemStack bestSlot = inventory.getStack(i);
if (ingredient.test(bestSlot)) {
ItemStack remainderStack = getRemainderItem(bestSlot);
if(remainderStack.isEmpty()) {
if (remainderStack.isEmpty()) {
bestSlot.decrement(1);
} else {
inventory.setStack(i, remainderStack);
@ -202,7 +198,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
ItemStack stack = inventory.getStack(j);
if (ingredient.test(stack)) {
ItemStack remainderStack = getRemainderItem(stack);
if(remainderStack.isEmpty()) {
if (remainderStack.isEmpty()) {
stack.decrement(1);
} else {
inventory.setStack(j, remainderStack);
@ -223,7 +219,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
}
private ItemStack getRemainderItem(ItemStack stack) {
if(stack.getItem() instanceof ExtendedRecipeRemainder) {
if (stack.getItem() instanceof ExtendedRecipeRemainder) {
return ((ExtendedRecipeRemainder) stack.getItem()).getRemainderStack(stack);
} else if (stack.getItem().hasRecipeRemainder()) {
@ -310,7 +306,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
List<Integer> possibleSlots = new ArrayList<>();
for (int s = 0; s < currentRecipe.getPreviewInputs().size(); s++) {
for (int i = 0; i < 9; i++) {
if(possibleSlots.contains(i)) {
if (possibleSlots.contains(i)) {
continue;
}
ItemStack stackInSlot = inventory.getStack(i);
@ -325,7 +321,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
}
if(!possibleSlots.isEmpty()){
if (!possibleSlots.isEmpty()) {
int totalItems = possibleSlots.stream()
.mapToInt(value -> inventory.getStack(value).getCount()).sum();
int slots = possibleSlots.size();
@ -334,11 +330,11 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
int[] split = new int[slots];
int remainder = totalItems % slots;
Arrays.fill(split, totalItems / slots);
while (remainder > 0){
while (remainder > 0) {
for (int i = 0; i < split.length; i++) {
if(remainder > 0){
split[i] +=1;
remainder --;
if (remainder > 0) {
split[i] += 1;
remainder--;
}
}
}
@ -350,7 +346,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
boolean needsBalance = false;
for (int i = 0; i < split.length; i++) {
int required = split[i];
if(slotEnvTyperubution.contains(required)){
if (slotEnvTyperubution.contains(required)) {
//We need to remove the int, not at the int, this seems to work around that
slotEnvTyperubution.remove(new Integer(required));
} else {

View file

@ -40,8 +40,8 @@ public class ChemicalReactorBlockEntity extends GenericMachineBlockEntity implem
public ChemicalReactorBlockEntity() {
super(TRBlockEntities.CHEMICAL_REACTOR, "ChemicalReactor", TechRebornConfig.chemicalReactorMaxInput, TechRebornConfig.chemicalReactorMaxEnergy, TRContent.Machine.CHEMICAL_REACTOR.block, 3);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2 };
final int[] inputs = new int[]{0, 1};
final int[] outputs = new int[]{2};
this.inventory = new RebornInventory<>(4, "ChemicalReactorBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.CHEMICAL_REACTOR, this, 2, 2, this.inventory, inputs, outputs);
}

View file

@ -40,8 +40,8 @@ public class CompressorBlockEntity extends GenericMachineBlockEntity implements
public CompressorBlockEntity() {
super(TRBlockEntities.COMPRESSOR, "Compressor", TechRebornConfig.compressorMaxInput, TechRebornConfig.compressorMaxEnergy, TRContent.Machine.COMPRESSOR.block, 2);
final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 };
final int[] inputs = new int[]{0};
final int[] outputs = new int[]{1};
this.inventory = new RebornInventory<>(3, "CompressorBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.COMPRESSOR, this, 2, 1, this.inventory, inputs, outputs);
}

View file

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

View file

@ -40,8 +40,8 @@ public class ExtractorBlockEntity extends GenericMachineBlockEntity implements B
public ExtractorBlockEntity() {
super(TRBlockEntities.EXTRACTOR, "Extractor", TechRebornConfig.extractorMaxInput, TechRebornConfig.extractorMaxEnergy, TRContent.Machine.EXTRACTOR.block, 2);
final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 };
final int[] inputs = new int[]{0};
final int[] outputs = new int[]{1};
this.inventory = new RebornInventory<>(3, "ExtractorBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.EXTRACTOR, this, 2, 1, this.inventory, inputs, outputs);
}

View file

@ -42,8 +42,8 @@ public class IndustrialElectrolyzerBlockEntity extends GenericMachineBlockEntity
public IndustrialElectrolyzerBlockEntity() {
super(TRBlockEntities.INDUSTRIAL_ELECTROLYZER, "IndustrialElectrolyzer", TechRebornConfig.industrialElectrolyzerMaxInput, TechRebornConfig.industrialElectrolyzerMaxEnergy, TRContent.Machine.INDUSTRIAL_ELECTROLYZER.block, 6);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4, 5 };
final int[] inputs = new int[]{0, 1};
final int[] outputs = new int[]{2, 3, 4, 5};
this.inventory = new RebornInventory<>(7, "IndustrialElectrolyzerBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_ELECTROLYZER, this, 2, 4, this.inventory, inputs, outputs);
}

View file

@ -60,7 +60,7 @@ public class PlayerDectectorBlockEntity extends PowerAcceptorBlockEntity impleme
boolean lastRedstone = redstone;
redstone = false;
if (canUseEnergy(TechRebornConfig.playerDetectorEuPerTick)) {
for(PlayerEntity player : world.getPlayers()){
for (PlayerEntity player : world.getPlayers()) {
if (player.distanceTo(player) <= 256.0D) {
PlayerDetectorType type = world.getBlockState(pos).get(BlockPlayerDetector.TYPE);
if (type == PlayerDetectorType.ALL) {// ALL

View file

@ -77,8 +77,7 @@ public class RecyclerBlockEntity extends PowerAcceptorBlockEntity
if (randomchance == 1) {
if (inventory.getStack(1).isEmpty()) {
inventory.setStack(1, itemstack.copy());
}
else {
} else {
inventory.getStack(1).increment(itemstack.getCount());
}
}
@ -86,16 +85,13 @@ public class RecyclerBlockEntity extends PowerAcceptorBlockEntity
}
public boolean canRecycle() {
return !inventory.getStack(0) .isEmpty() && hasSlotGotSpace(1);
return !inventory.getStack(0).isEmpty() && hasSlotGotSpace(1);
}
public boolean hasSlotGotSpace(int slot) {
if (inventory.getStack(slot).isEmpty()) {
return true;
} else if (inventory.getStack(slot).getCount() < inventory.getStack(slot).getMaxCount()) {
return true;
}
return false;
} else return inventory.getStack(slot).getCount() < inventory.getStack(slot).getMaxCount();
}
public boolean isBurning() {
@ -129,13 +125,12 @@ public class RecyclerBlockEntity extends PowerAcceptorBlockEntity
boolean updateInventory = false;
if (canRecycle() && !isBurning() && getEnergy() != 0) {
setBurning(true);
}
else if (isBurning()) {
} else if (isBurning()) {
if (useEnergy(getEuPerTick(cost)) != getEuPerTick(cost)) {
this.setBurning(false);
}
progress++;
if (progress >= Math.max((int) (time* (1.0 - getSpeedMultiplier())), 1)) {
if (progress >= Math.max((int) (time * (1.0 - getSpeedMultiplier())), 1)) {
progress = 0;
recycleItems();
updateInventory = true;

View file

@ -153,7 +153,7 @@ public class ResinBasinBlockEntity extends MachineBaseBlockEntity {
this.isFull = blockState.get(ResinBasinBlock.FULL);
if(blockState.get(ResinBasinBlock.POURING)){
if (blockState.get(ResinBasinBlock.POURING)) {
this.isPouring = true;
pouringTimer = TechRebornConfig.sapTimeTicks;
}

View file

@ -61,7 +61,7 @@ import java.util.stream.Collectors;
public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
implements IToolDrop, InventoryProvider, BuiltScreenHandlerProvider {
public int[] craftingSlots = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
public int[] craftingSlots = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8};
private CraftingInventory craftCache;
public RebornInventory<RollingMachineBlockEntity> inventory = new RebornInventory<>(12, "RollingMachineBlockEntity", 64, this);
public boolean isRunning;
@ -69,7 +69,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
@Nonnull
public ItemStack currentRecipeOutput;
public RollingMachineRecipe currentRecipe;
private int outputSlot;
private final int outputSlot;
public boolean locked = false;
public int balanceSlot = 0;
@ -177,12 +177,12 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
}
public void setIsActive(boolean active) {
if (active == isRunning){
if (active == isRunning) {
return;
}
isRunning = active;
if (this.getWorld().getBlockState(this.getPos()).getBlock() instanceof BlockMachineBase) {
BlockMachineBase blockMachineBase = (BlockMachineBase)this.getWorld().getBlockState(this.getPos()).getBlock();
BlockMachineBase blockMachineBase = (BlockMachineBase) this.getWorld().getBlockState(this.getPos()).getBlock();
blockMachineBase.setActive(active, this.getWorld(), this.getPos());
}
this.getWorld().updateListeners(this.getPos(), this.getWorld().getBlockState(this.getPos()), this.getWorld().getBlockState(this.getPos()), 3);
@ -213,7 +213,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
List<Integer> possibleSlots = new ArrayList<>();
for (int s = 0; s < currentRecipe.getPreviewInputs().size(); 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 (stackInSlot.isEmpty()) {
possibleSlots.add(s);
@ -223,7 +223,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
}
}
if(!possibleSlots.isEmpty()){
if (!possibleSlots.isEmpty()) {
int totalItems = possibleSlots.stream()
.mapToInt(value -> inventory.getStack(value).getCount()).sum();
int slots = possibleSlots.size();
@ -232,11 +232,11 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
int[] split = new int[slots];
int remainder = totalItems % slots;
Arrays.fill(split, totalItems / slots);
while (remainder > 0){
while (remainder > 0) {
for (int i = 0; i < split.length; i++) {
if(remainder > 0){
split[i] +=1;
remainder --;
if (remainder > 0) {
split[i] += 1;
remainder--;
}
}
}
@ -248,7 +248,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
boolean needsBalance = false;
for (int i = 0; i < split.length; i++) {
int required = split[i];
if(slotEnvTyperubution.contains(required)){
if (slotEnvTyperubution.contains(required)) {
//We need to remove the int, not at the int, this seems to work around that
slotEnvTyperubution.remove(new Integer(required));
} else {
@ -322,13 +322,13 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
return ItemUtils.isItemEqual(stack, output, true, true);
}
public List<RollingMachineRecipe> getAllRecipe(World world){
public List<RollingMachineRecipe> getAllRecipe(World world) {
return ModRecipes.ROLLING_MACHINE.getRecipes(world);
}
public ItemStack findMatchingRecipeOutput(CraftingInventory inv, World world) {
RollingMachineRecipe recipe = findMatchingRecipe(inv, world);
if(recipe == null){
if (recipe == null) {
return ItemStack.EMPTY;
}
return recipe.getOutput();
@ -379,10 +379,10 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
}
public int getBurnTimeRemainingScaled(final int scale) {
if (tickTime == 0 || Math.max((int) (TechRebornConfig.rollingMachineRunTime* (1.0 - getSpeedMultiplier())), 1) == 0) {
if (tickTime == 0 || Math.max((int) (TechRebornConfig.rollingMachineRunTime * (1.0 - getSpeedMultiplier())), 1) == 0) {
return 0;
}
return tickTime * scale / Math.max((int) (TechRebornConfig.rollingMachineRunTime* (1.0 - getSpeedMultiplier())), 1);
return tickTime * scale / Math.max((int) (TechRebornConfig.rollingMachineRunTime * (1.0 - getSpeedMultiplier())), 1);
}
@Override
@ -409,8 +409,8 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
}
public int getProgressScaled(final int scale) {
if (tickTime != 0 && Math.max((int) (TechRebornConfig.rollingMachineRunTime* (1.0 - getSpeedMultiplier())), 1) != 0) {
return tickTime * scale / Math.max((int) (TechRebornConfig.rollingMachineRunTime* (1.0 - getSpeedMultiplier())), 1);
if (tickTime != 0 && Math.max((int) (TechRebornConfig.rollingMachineRunTime * (1.0 - getSpeedMultiplier())), 1) != 0) {
return tickTime * scale / Math.max((int) (TechRebornConfig.rollingMachineRunTime * (1.0 - getSpeedMultiplier())), 1);
}
return 0;
}

View file

@ -39,8 +39,8 @@ public class ScrapboxinatorBlockEntity extends GenericMachineBlockEntity impleme
public ScrapboxinatorBlockEntity() {
super(TRBlockEntities.SCRAPBOXINATOR, "Scrapboxinator", TechRebornConfig.scrapboxinatorMaxInput, TechRebornConfig.scrapboxinatorMaxEnergy, TRContent.Machine.SCRAPBOXINATOR.block, 2);
final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 };
final int[] inputs = new int[]{0};
final int[] outputs = new int[]{1};
this.inventory = new RebornInventory<>(3, "ScrapboxinatorBlockEntity", 64, this);
this.crafter = new ScrapboxRecipeCrafter(this, this.inventory, inputs, outputs);
}

View file

@ -40,8 +40,8 @@ public class SoildCanningMachineBlockEntity extends GenericMachineBlockEntity im
public SoildCanningMachineBlockEntity() {
super(TRBlockEntities.SOLID_CANNING_MACHINE, "SolidCanningMachine", TechRebornConfig.solidCanningMachineMaxInput, TechRebornConfig.solidCanningMachineMaxEnergy, TRContent.Machine.SOLID_CANNING_MACHINE.block, 3);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2 };
final int[] inputs = new int[]{0, 1};
final int[] outputs = new int[]{2};
this.inventory = new RebornInventory<>(4, "SolidCanningMachineBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.SOLID_CANNING_MACHINE, this, 2, 1, this.inventory, inputs, outputs);
}

View file

@ -39,8 +39,8 @@ public class WireMillBlockEntity extends GenericMachineBlockEntity implements Bu
public WireMillBlockEntity() {
super(TRBlockEntities.WIRE_MILL, "WireMill", 32, 1000, TRContent.Machine.WIRE_MILL.block, 2);
final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 };
final int[] inputs = new int[]{0};
final int[] outputs = new int[]{1};
this.inventory = new RebornInventory<>(3, "WireMillBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.WIRE_MILL, this, 1, 1, this.inventory, inputs, outputs);
}

View file

@ -55,7 +55,7 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
private String ownerUdid;
public ChunkLoaderBlockEntity() {
super(TRBlockEntities.CHUNK_LOADER );
super(TRBlockEntities.CHUNK_LOADER);
this.radius = 1;
}
@ -71,7 +71,7 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
reload();
if(playerEntity != null){
if (playerEntity != null) {
ChunkLoaderManager manager = ChunkLoaderManager.get(getWorld());
manager.syncChunkLoaderToClient((ServerPlayerEntity) playerEntity, getPos());
}
@ -82,20 +82,20 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
return TRContent.Machine.CHUNK_LOADER.getStack();
}
private void reload(){
private void reload() {
unloadAll();
load();
}
private void load(){
private void load() {
ChunkLoaderManager manager = ChunkLoaderManager.get(getWorld());
ChunkPos rootPos = getChunkPos();
int loadRadius = radius -1;
int loadRadius = radius - 1;
for (int i = -loadRadius; i <= loadRadius; i++) {
for (int j = -loadRadius; j <= loadRadius; j++) {
ChunkPos loadPos = new ChunkPos(rootPos.x + i, rootPos.z + j);
if(!manager.isChunkLoaded(getWorld(), loadPos, getPos())){
if (!manager.isChunkLoaded(getWorld(), loadPos, getPos())) {
manager.loadChunk(getWorld(), loadPos, getPos(), ownerUdid);
}
}
@ -105,7 +105,7 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
@Override
public void onBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState) {
if(world.isClient){
if (world.isClient) {
return;
}
unloadAll();
@ -114,19 +114,19 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
@Override
public void onPlace(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
if(world.isClient){
if (world.isClient) {
return;
}
ownerUdid = placer.getUuidAsString();
reload();
}
private void unloadAll(){
private void unloadAll() {
ChunkLoaderManager manager = ChunkLoaderManager.get(world);
manager.unloadChunkLoader(world, getPos());
}
public ChunkPos getChunkPos(){
public ChunkPos getChunkPos() {
return new ChunkPos(getPos());
}
@ -144,7 +144,7 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
super.fromTag(blockState, nbttagcompound);
this.radius = nbttagcompound.getInt("radius");
this.ownerUdid = nbttagcompound.getString("ownerUdid");
if(!StringUtils.isBlank(ownerUdid)){
if (!StringUtils.isBlank(ownerUdid)) {
nbttagcompound.putString("ownerUdid", this.ownerUdid);
}
inventory.read(nbttagcompound);

View file

@ -48,8 +48,8 @@ public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity i
public IndustrialCentrifugeBlockEntity() {
super(TRBlockEntities.INDUSTRIAL_CENTRIFUGE, "IndustrialCentrifuge", TechRebornConfig.industrialCentrifugeMaxInput, TechRebornConfig.industrialCentrifugeMaxEnergy, TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block, 6);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4, 5 };
final int[] inputs = new int[]{0, 1};
final int[] outputs = new int[]{2, 3, 4, 5};
this.inventory = new RebornInventory<>(7, "IndustrialCentrifugeBlockEntity", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.CENTRIFUGE, this, 2, 4, this.inventory, inputs, outputs);
}
@ -70,7 +70,7 @@ public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity i
@Override
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) {
super.addInfo(info, isReal, hasData);
if(Screen.hasControlDown()) {
if (Screen.hasControlDown()) {
info.add(new LiteralText("Round and round it goes"));
}
}

View file

@ -46,7 +46,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
private int amplifier = 0;
public MatterFabricatorBlockEntity() {
super(TRBlockEntities.MATTER_FABRICATOR );
super(TRBlockEntities.MATTER_FABRICATOR);
}
private boolean spaceForOutput() {
@ -76,8 +76,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
private void addOutputProducts(int slot) {
if (inventory.getStack(slot).isEmpty()) {
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())));
}
}

View file

@ -49,19 +49,19 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnergyTier.INSANE, TechRebornConfig.aesuMaxEnergy);
}
public int getMaxConfigOutput(){
public int getMaxConfigOutput() {
int extra = 0;
if(superconductors > 0){
if (superconductors > 0) {
extra = (int) Math.pow(2, (superconductors + 2)) * maxOutput;
}
return maxOutput + extra;
}
public void handleGuiInputFromClient(int id, boolean shift, boolean ctrl) {
if(shift){
if (shift) {
id *= 4;
}
if(ctrl){
if (ctrl) {
id *= 8;
}
@ -88,14 +88,14 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
@Override
public void tick() {
super.tick();
if (world == null){
if (world == null) {
return;
}
if (OUTPUT > getMaxConfigOutput()) {
OUTPUT = getMaxConfigOutput();
}
if(world.getTime() % 20 == 0){
if (world.getTime() % 20 == 0) {
checkTier();
}
}
@ -118,7 +118,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
@Override
public double getBaseMaxInput() {
//If we have super conductors increase the max input of the machine
if(getMaxConfigOutput() > maxOutput){
if (getMaxConfigOutput() > maxOutput) {
return getMaxConfigOutput();
}
return maxInput;

View file

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

View file

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

View file

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

View file

@ -42,11 +42,11 @@ public class IDSUManager extends PersistentState {
}
@Nonnull
public static IDSUPlayer getPlayer(World world, String uuid){
public static IDSUPlayer getPlayer(World world, String uuid) {
return get(world).getPlayer(uuid);
}
public static IDSUManager get(World world){
public static IDSUManager get(World world) {
ServerWorld serverWorld = (ServerWorld) world;
return serverWorld.getPersistentStateManager().getOrCreate(IDSUManager::new, KEY);
}
@ -54,13 +54,13 @@ public class IDSUManager extends PersistentState {
private final HashMap<String, IDSUPlayer> playerHashMap = new HashMap<>();
@Nonnull
public IDSUPlayer getPlayer(String uuid){
public IDSUPlayer getPlayer(String uuid) {
return playerHashMap.computeIfAbsent(uuid, s -> new IDSUPlayer());
}
@Override
public void fromTag(CompoundTag tag) {
for(String uuid : tag.getKeys()){
for (String uuid : tag.getKeys()) {
playerHashMap.put(uuid, new IDSUPlayer(tag.getCompound(uuid)));
}
}
@ -78,7 +78,7 @@ public class IDSUManager extends PersistentState {
private IDSUPlayer() {
}
private IDSUPlayer(CompoundTag compoundTag){
private IDSUPlayer(CompoundTag compoundTag) {
read(compoundTag);
}

View file

@ -54,7 +54,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
if (ownerUdid == null || ownerUdid.isEmpty()) {
return 0.0;
}
if(world.isClient){
if (world.isClient) {
return clientEnergy;
}
return IDSUManager.getPlayer(world, ownerUdid).getEnergy();
@ -65,7 +65,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
if (ownerUdid == null || ownerUdid.isEmpty()) {
return;
}
if(world.isClient){
if (world.isClient) {
clientEnergy = energy;
} else {
IDSUManager.getPlayer(world, ownerUdid).setEnergy(energy);
@ -77,7 +77,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
if (ownerUdid == null || ownerUdid.isEmpty()) {
return 0.0;
}
if(world.isClient){
if (world.isClient) {
throw new UnsupportedOperationException("cannot set energy on the client!");
}
double energy = IDSUManager.getPlayer(world, ownerUdid).getEnergy();
@ -95,7 +95,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
if (ownerUdid == null || ownerUdid.isEmpty()) {
return false;
}
if(world.isClient){
if (world.isClient) {
throw new UnsupportedOperationException("cannot set energy on the client!");
}
return input <= IDSUManager.getPlayer(world, ownerUdid).getEnergy();

View file

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

View file

@ -25,7 +25,6 @@
package techreborn.blockentity.storage.fluid;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
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.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop;

View file

@ -85,7 +85,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
@Override
public boolean canAcceptEnergy(Direction direction) {
if (TechRebornConfig.IC2TransformersStyle){
if (TechRebornConfig.IC2TransformersStyle) {
return getFacingEnum() == direction;
}
return getFacingEnum() != direction;
@ -93,7 +93,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
@Override
public boolean canProvideEnergy(Direction direction) {
if (TechRebornConfig.IC2TransformersStyle){
if (TechRebornConfig.IC2TransformersStyle) {
return getFacingEnum() != direction;
}
return getFacing() == direction;
@ -122,7 +122,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
// TileMachineBase
@Override
public Direction getFacingEnum() {
if(world == null){
if (world == null) {
return null;
}
Block block = world.getBlockState(pos).getBlock();

View file

@ -30,13 +30,12 @@ import techreborn.client.GuiType;
/**
* @author modmuss50
*
*/
public class DataDrivenMachineBlock extends GenericMachineBlock {
private final DataDrivenBEProvider provider;
public DataDrivenMachineBlock(String ident){
public DataDrivenMachineBlock(String ident) {
super(GuiType.DATA_DRIVEN, null);
provider = DataDrivenBEProvider.create(this, new Identifier(ident));
blockEntityClass = provider;

View file

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

View file

@ -56,8 +56,8 @@ public final class CableShapeUtil {
final VoxelShape baseShape = Block.createCuboidShape(size, size, size, 16.0D - size, 16.0D - size, 16.0D - size);
final List<VoxelShape> connections = new ArrayList<>();
for(Direction dir : Direction.values()){
if(state.get(CableBlock.PROPERTY_MAP.get(dir))) {
for (Direction dir : Direction.values()) {
if (state.get(CableBlock.PROPERTY_MAP.get(dir))) {
double x = dir == Direction.WEST ? 0 : dir == Direction.EAST ? 16D : size;
double z = dir == Direction.NORTH ? 0 : dir == Direction.SOUTH ? 16D : size;
double y = dir == Direction.DOWN ? 0 : dir == Direction.UP ? 16D : size;

View file

@ -52,23 +52,23 @@ public class BlockFusionControlComputer extends BlockMachineBase {
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, BlockHitResult hitResult) {
final FusionControlComputerBlockEntity blockEntityFusionControlComputer = (FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos);
if(!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){
if (!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())) {
List<BlockPos> coils = Torus.generate(blockEntityFusionControlComputer.getPos(), blockEntityFusionControlComputer.size);
boolean placed = false;
for(BlockPos coil : coils){
if(playerIn.getStackInHand(hand).isEmpty()){
for (BlockPos coil : coils) {
if (playerIn.getStackInHand(hand).isEmpty()) {
return ActionResult.SUCCESS;
}
if(worldIn.getBlockState(coil).canReplace(new ItemPlacementContext(new ItemUsageContext(playerIn, hand, hitResult)))
if (worldIn.getBlockState(coil).canReplace(new ItemPlacementContext(new ItemUsageContext(playerIn, hand, hitResult)))
&& worldIn.getBlockState(pos).getBlock() != TRContent.Machine.FUSION_COIL.block) {
worldIn.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
if(!playerIn.isCreative()){
if (!playerIn.isCreative()) {
playerIn.getStackInHand(hand).decrement(1);
}
placed = true;
}
}
if(placed){
if (placed) {
return ActionResult.SUCCESS;
}

View file

@ -55,7 +55,7 @@ public class BlockSolarPanel extends BlockMachineBase {
@Override
public IMachineGuiHandler getGui() {
if(this.panelType == SolarPanels.CREATIVE){
if (this.panelType == SolarPanels.CREATIVE) {
return null;
}
return GuiType.SOLAR_PANEL;

View file

@ -56,8 +56,8 @@ public class BlockLamp extends BaseBlockEntityProvider {
public static BooleanProperty ACTIVE;
protected final VoxelShape[] shape;
private int cost;
private static int brightness = 15;
private final int cost;
private static final int brightness = 15;
public BlockLamp(int cost, double depth, double width) {
super(FabricBlockSettings.of(Material.REDSTONE_LAMP).strength(2f, 2f).lightLevel(brightness));
@ -68,7 +68,7 @@ public class BlockLamp extends BaseBlockEntityProvider {
}
private VoxelShape[] genCuboidShapes(double depth, double width) {
double culling = (16.0D - width) / 2 ;
double culling = (16.0D - width) / 2;
return new VoxelShape[]{
createCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
createCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
@ -97,7 +97,7 @@ public class BlockLamp extends BaseBlockEntityProvider {
}
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);
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);
}
Direction facing = (Direction) stateIn.get(FACING);
Direction facing = stateIn.get(FACING);
Direction.Axis facing$Axis = facing.getAxis();
double double_5 = rand.nextDouble() * 0.6D - 0.3D;
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);
}
Direction facing = (Direction) stateIn.get(FACING);
Direction facing = stateIn.get(FACING);
Direction.Axis facing$Axis = facing.getAxis();
double double_5 = rand.nextDouble() * 0.6D - 0.3D;
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 PlayerDetectorType(String name) {
PlayerDetectorType(String name) {
this.name = name;
}

View file

@ -67,7 +67,7 @@ public class BlockAlarm extends BaseBlockEntityProvider {
}
private VoxelShape[] GenCuboidShapes(double depth, double width) {
double culling = (16.0D - width) / 2 ;
double culling = (16.0D - width) / 2;
VoxelShape[] shapes = {
Block.createCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.createCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
@ -84,7 +84,7 @@ public class BlockAlarm extends BaseBlockEntityProvider {
}
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) {

View file

@ -63,8 +63,7 @@ public class BlockComputerCube extends BlockMachineBase {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
return ActionResult.SUCCESS;
}
else {
} else {
rotate(worldIn.getBlockState(pos), BlockRotation.CLOCKWISE_90);
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) {
if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (float) pos.getX() + 0.5F,
pos.getY(), (float) pos.getZ() + 0.5F, igniter);
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);
}
}
@ -67,8 +67,8 @@ public class BlockNuke extends BaseBlock {
@Override
public void onDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getCausingEntity());
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (float) pos.getX() + 0.5F,
pos.getY(), (float) pos.getZ() + 0.5F, explosionIn.getCausingEntity());
entitynukeprimed.setFuse(worldIn.random.nextInt(TechRebornConfig.nukeFuseTime / 4) + TechRebornConfig.nukeFuseTime / 8);
worldIn.spawnEntity(entitynukeprimed);
}

View file

@ -134,7 +134,9 @@ public class BlockRubberLog extends PillarBlock {
if (Energy.valid(stack)) {
Energy.of(stack).use(20);
} 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())) {
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide()));

View file

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

View file

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

View file

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

View file

@ -29,7 +29,6 @@ import techreborn.utils.InitUtils;
/**
* @author drcrazy
*
*/
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.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolItem;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@ -41,12 +39,10 @@ import net.minecraft.world.World;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.RebornBucketItem;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.util.Tank;
import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.client.GuiType;
import techreborn.init.TRContent;
@ -76,17 +72,17 @@ public class TankUnitBlock extends BlockMachineBase {
// Assuming ItemFluidInfo is 1 BUCKET, for now only allow exact amount or less
if (tankUnitEntity != null && itemInHand instanceof ItemFluidInfo) {
ItemFluidInfo itemFluid = (ItemFluidInfo)itemInHand;
ItemFluidInfo itemFluid = (ItemFluidInfo) itemInHand;
Fluid fluid = itemFluid.getFluid(stackInHand);
int amount = stackInHand.getCount();
FluidValue fluidValue = FluidValue.BUCKET.multiply(amount);
Tank tankInstance = tankUnitEntity.getTank();
if(tankInstance.canFit(fluid, fluidValue)){
if(tankInstance.getFluidInstance().isEmptyFluid()){
if (tankInstance.canFit(fluid, fluidValue)) {
if (tankInstance.getFluidInstance().isEmptyFluid()) {
tankInstance.setFluidInstance(new FluidInstance(fluid, fluidValue));
}else{
} else {
tankInstance.getFluidInstance().addAmount(fluidValue);
}

View file

@ -38,7 +38,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.api.items.InventoryBase;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.RebornInventory;
import reborncore.common.util.WorldUtils;
@ -90,7 +89,7 @@ public class StorageUnitBlock extends BlockMachineBase {
public void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) {
super.onBlockBreakStart(state, world, pos, player);
if(world.isClient) return;
if (world.isClient) return;
final StorageUnitBaseBlockEntity storageEntity = (StorageUnitBaseBlockEntity) world.getBlockEntity(pos);
ItemStack stackInHand = player.getStackInHand(Hand.MAIN_HAND);
@ -100,10 +99,10 @@ public class StorageUnitBlock extends BlockMachineBase {
ItemStack out = inventory.getStack(StorageUnitBaseBlockEntity.OUTPUT_SLOT);
// Drop stack if sneaking
if(player.isSneaking()){
if (player.isSneaking()) {
WorldUtils.dropItem(new ItemStack(out.getItem()), world, player.getBlockPos());
out.decrement(1);
}else {
} else {
WorldUtils.dropItem(out, world, player.getBlockPos());
out.setCount(0);
}
@ -114,7 +113,6 @@ public class StorageUnitBlock extends BlockMachineBase {
}
@Override
public IMachineGuiHandler getGui() {
return GuiType.STORAGE_UNIT;

View file

@ -24,7 +24,6 @@
package techreborn.client;
import io.netty.buffer.Unpooled;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
@ -172,7 +171,7 @@ public final class GuiType<T extends BlockEntity> implements IMachineGuiHandler
@Override
public void open(PlayerEntity player, BlockPos pos, World world) {
if(!world.isClient){
if (!world.isClient) {
//This is awful
player.openHandledScreen(new ExtendedScreenHandlerFactory() {
@Override

View file

@ -73,7 +73,7 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))
@ -89,7 +89,7 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(int amount){
public void onClick(int amount) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(amount, Screen.hasShiftDown(), Screen.hasControlDown(), blockEntity));
}
}

View file

@ -57,7 +57,7 @@ public class GuiBatbox extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 5);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))

View file

@ -69,7 +69,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
drawCentredText(matrixStack, text, 25, 4210752, layer);
}
public void onClick(int amount){
public void onClick(int amount) {
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity, ClientChunkManager.hasChunksForLoader(blockEntity.getPos())));
}
}

View file

@ -77,7 +77,7 @@ public class GuiDistillationTower extends GuiBase<BuiltScreenHandler> {
}
public void onClick(GuiButtonExtended button, Double x, Double y){
public void onClick(GuiButtonExtended button, Double x, Double y) {
blockEntity.renderMultiblock ^= !hideGuiElements();
}
}

View file

@ -53,7 +53,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
this.blockEntity = furnace;
}
public void onClick(){
public void onClick() {
NetworkManager.sendToServer(ServerboundPackets.createPacketExperience(blockEntity));
}
@ -87,7 +87,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
++levels;
}
message = message + "+" + String.valueOf(levels) + "L";
message = message + "+" + levels + "L";
}
}

View file

@ -57,7 +57,7 @@ public class GuiMFE extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);

View file

@ -59,9 +59,9 @@ public class GuiManual extends Screen {
@Override
public void init() {
int y = (height / 2) - guiHeight / 2;
y+= 40;
y += 40;
addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, new TranslatableText("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
if(t){
if (t) {
Util.getOperatingSystem().open("http://wiki.techreborn.ovh");
this.client.openScreen(this);
} else {
@ -69,14 +69,14 @@ public class GuiManual extends Screen {
}
}, "http://wiki.techreborn.ovh", false))));
addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, new TranslatableText("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
if(t){
if (t) {
Util.getOperatingSystem().open("https://discord.gg/teamreborn");
this.client.openScreen(this);
}else {
} else {
this.client.openScreen(this);
}
}, "https://discord.gg/teamreborn", false))));
if(TechRebornConfig.allowManualRefund){
if (TechRebornConfig.allowManualRefund) {
addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, new TranslatableText("techreborn.manual.refundbtn"), var1 -> {
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
this.client.openScreen(null);

View file

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

View file

@ -62,7 +62,7 @@ public class GuiRollingMachine extends GuiBase<BuiltScreenHandler> {
drawOutputSlot(matrixStack, 124, gridYPos + 18, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
builder.drawLockButton(matrixStack, this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked);
builder.drawLockButton(matrixStack, this, 130, 4, mouseX, mouseY, layer, rollingMachine.locked);
}
@Override
@ -76,7 +76,7 @@ public class GuiRollingMachine extends GuiBase<BuiltScreenHandler> {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if(isPointInRect(130, 4, 20, 12, mouseX, mouseY)){
if (isPointInRect(130, 4, 20, 12, mouseX, mouseY)) {
NetworkManager.sendToServer(ServerboundPackets.createPacketRollingMachineLock(rollingMachine, !rollingMachine.locked));
return true;
}

View file

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

View file

@ -58,8 +58,8 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
public void render(EntityNukePrimed entity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
matrixStack.push();
matrixStack.translate(0.0D, 0.5D, 0.0D);
if ((float)entity.getFuseTimer() - g + 1.0F < 10.0F) {
float h = 1.0F - ((float)entity.getFuseTimer() - g + 1.0F) / 10.0F;
if ((float) entity.getFuseTimer() - g + 1.0F < 10.0F) {
float h = 1.0F - ((float) entity.getFuseTimer() - g + 1.0F) / 10.0F;
h = MathHelper.clamp(h, 0.0F, 1.0F);
h *= h;
h *= h;

View file

@ -24,34 +24,20 @@
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.font.TextRenderer;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
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.texture.NativeImage;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
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 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.
*/
@ -96,22 +82,22 @@ public class StorageUnitRenderer extends BlockEntityRenderer<StorageUnitBaseBloc
TextRenderer textRenderer = this.dispatcher.getTextRenderer();
switch (storage.getFacing()){
switch (storage.getFacing()) {
case NORTH:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().getOpposite().asRotation()));
matrices.translate(0.5f,0.5,-0.001f);
matrices.translate(0.5f, 0.5, -0.001f);
break;
case SOUTH:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().getOpposite().asRotation()));
matrices.translate(-0.5f,0.5,-1.001f);
matrices.translate(-0.5f, 0.5, -1.001f);
break;
case EAST:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().asRotation()));
matrices.translate(0.5f,0.5,-1.001f);
matrices.translate(0.5f, 0.5, -1.001f);
break;
case WEST:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().asRotation()));
matrices.translate(-0.5f,0.5,-0.001f);
matrices.translate(-0.5f, 0.5, -0.001f);
break;
}
@ -121,12 +107,12 @@ public class StorageUnitRenderer extends BlockEntityRenderer<StorageUnitBaseBloc
// Render item count
String count = String.valueOf(storage.storedAmount);
xPosition = (float)(-textRenderer.getWidth(count) / 2);
xPosition = (float) (-textRenderer.getWidth(count) / 2);
textRenderer.draw(count, xPosition, -4f + 40, 0, false, matrices.peek().getModel(), vertexConsumers, false, 0, light);
// Render name
String item = stack.getName().asTruncatedString(18);
xPosition = (float)(-textRenderer.getWidth(item) / 2);
xPosition = (float) (-textRenderer.getWidth(item) / 2);
textRenderer.draw(item, xPosition, -4f - 40, 0, false, matrices.peek().getModel(), vertexConsumers, false, 0, light);
matrices.pop();

View file

@ -34,8 +34,8 @@ import techreborn.init.TRContent;
public class DestructoPackScreenHandler extends ScreenHandler {
private PlayerEntity player;
private RebornInventory<?> inv;
private final PlayerEntity player;
private final RebornInventory<?> inv;
public DestructoPackScreenHandler(int syncID, PlayerEntity player) {
super(null, syncID);
@ -51,7 +51,7 @@ public class DestructoPackScreenHandler extends ScreenHandler {
private void buildContainer() {
this.addSlot(
new SlotFilteredVoid(inv, 0, 80, 36, new ItemStack[] { TRContent.Parts.MACHINE_PARTS.getStack() }));
new SlotFilteredVoid(inv, 0, 80, 36, new ItemStack[]{TRContent.Parts.MACHINE_PARTS.getStack()}));
int i;
for (i = 0; i < 3; ++i) {

View file

@ -37,19 +37,16 @@ public class FurnaceFuelSlot extends BaseSlot {
}
@Override
public boolean canInsert(ItemStack stack)
{
public boolean canInsert(ItemStack stack) {
return AbstractFurnaceBlockEntity.canUseAsFuel(stack) || isBucket(stack);
}
@Override
public int getMaxStackAmount(ItemStack stack)
{
public int getMaxStackAmount(ItemStack 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;
}
}

View file

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

View file

@ -62,7 +62,7 @@ import java.util.concurrent.Executor;
public class TRTweaker implements Tweaker {
public static final TRTweaker INSTANCE = new TRTweaker();
private RecipeTweaker tweaker = RecipeTweaker.INSTANCE;
private final RecipeTweaker tweaker = RecipeTweaker.INSTANCE;
private JsonObject debug;
List<FluidGeneratorRecipe> added = new ArrayList<>();
@ -102,7 +102,7 @@ public class TRTweaker implements Tweaker {
@Override
public String getApplyMessage() {
int recipeCount = added.size();
return recipeCount + " TechReborn fluid generator " + (recipeCount == 1? "recipe" : "recipes");
return recipeCount + " TechReborn fluid generator " + (recipeCount == 1 ? "recipe" : "recipes");
}
@Override
@ -112,6 +112,7 @@ public class TRTweaker implements Tweaker {
/**
* Create a fluid ingredient
*
* @param fluid The fluid required.
* @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.
@ -136,6 +137,7 @@ public class TRTweaker implements Tweaker {
/**
* Register a generic TechReborn recipe.
*
* @param type The type of RebornRecipe to add.
* @param inputs The input ingredients for 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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param output The outputs of the recipe.
* @param power How much power the recipe consumes per tick.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param power How much power the recipe consumes per tick.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs the 2D array (array of arrays) of inputs to use.
* @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.
*
* @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 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.
*
* @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 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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @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.
*
* @param inputs The input ingredients for the recipe.
* @param outputs The outputs of the recipe.
* @param power How much power the recipe consumes per tick.
@ -565,13 +592,14 @@ public class TRTweaker implements Tweaker {
/**
* Register a fluid to process in a fluid generator.
*
* @param generator The type of generator: thermal, gas, diesel, semifluid, or plasma.
* @param fluid The fluid to add a recipe for.
* @param euPerMB How much EU should be generated per millibucket of fluid.
*/
public void addFluidGenerator(String generator, String fluid, int euPerMB) {
EFluidGenerator type;
switch(generator.toLowerCase()) {
switch (generator.toLowerCase()) {
case "thermal":
case "techreborn.thermalgenerator":
type = EFluidGenerator.THERMAL;

View file

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

View file

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

View file

@ -230,7 +230,7 @@ public class ReiPlugin implements REIPluginV0 {
}
if (height > 0) {
int width = 20;
return Collections.singletonList(new Rectangle(guiBase.getGuiLeft() - width, guiBase.getGuiTop() + 8, width , height));
return Collections.singletonList(new Rectangle(guiBase.getGuiLeft() - width, guiBase.getGuiTop() + 8, width, height));
}
}
return Collections.emptyList();

View file

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

View file

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

View file

@ -41,9 +41,9 @@ import java.util.List;
public class FluidReplicatorRecipeDisplay implements RecipeDisplay {
private final FluidReplicatorRecipe recipe;
private List<List<EntryStack>> inputs;
private List<EntryStack> output;
private FluidInstance fluidInstance;
private final List<List<EntryStack>> inputs;
private final List<EntryStack> output;
private final FluidInstance fluidInstance;
private int energy = 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.MovementType;
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.util.math.Vec3d;
import net.minecraft.world.World;
import reborncore.common.explosion.RebornExplosion;
import team.reborn.energy.EnergyTier;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
/**
* Created by Mark on 13/03/2016.

Some files were not shown because too many files have changed in this diff Show more