Use modern java features where we can, optimise imports.

This commit is contained in:
modmuss50 2021-05-29 20:32:05 +01:00
parent 52e4767247
commit 31e7b357dc
135 changed files with 342 additions and 794 deletions

View file

@ -42,6 +42,7 @@ import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.RebornCore;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.client.screen.BuiltScreenHandlerProvider;
@ -73,7 +74,6 @@ import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.client.gui.*;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

View file

@ -24,7 +24,6 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;

View file

@ -24,7 +24,6 @@
package techreborn.client.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;

View file

@ -24,7 +24,6 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;

View file

@ -49,15 +49,9 @@ public class GuiSolar extends GuiBase<BuiltScreenHandler> {
builder.drawMultiEnergyBar(matrixStack, this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
switch (blockEntity.getSunState()) {
case SolarPanelBlockEntity.DAYGEN:
builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.daygen"), 10, 20, 15129632);
break;
case SolarPanelBlockEntity.NIGHTGEN:
builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.nightgen"), 10, 20, 7566195);
break;
case SolarPanelBlockEntity.ZEROGEN:
builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.zerogen"), 10, 20, 12066591);
break;
case SolarPanelBlockEntity.DAYGEN -> builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.daygen"), 10, 20, 15129632);
case SolarPanelBlockEntity.NIGHTGEN -> builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.nightgen"), 10, 20, 7566195);
case SolarPanelBlockEntity.ZEROGEN -> builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.zerogen"), 10, 20, 12066591);
}
builder.drawText(matrixStack, this, new LiteralText("Generating: " + blockEntity.getGenerationRate() + " E/t"), 10, 30, 0);

View file

@ -46,10 +46,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockRenderView;
import org.jetbrains.annotations.Nullable;
import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.common.util.Color;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@ -66,8 +66,7 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
@Override
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
Fluid fluid = Fluids.EMPTY;
if (stack.getItem() instanceof ItemFluidInfo) {
ItemFluidInfo fluidInfo = (ItemFluidInfo) stack.getItem();
if (stack.getItem() instanceof ItemFluidInfo fluidInfo) {
fluid = fluidInfo.getFluid(stack);
}

View file

@ -62,16 +62,9 @@ public class StorageUnitRenderer implements BlockEntityRenderer<StorageUnitBaseB
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion((direction.getHorizontal() - 2) * 90F));
matrices.scale(0.5F, 0.5F, 0.5F);
switch (direction) {
case NORTH:
case WEST:
matrices.translate(1, 1, 0);
break;
case SOUTH:
matrices.translate(-1, 1, -2);
break;
case EAST:
matrices.translate(-1, 1, 2);
break;
case NORTH, WEST -> matrices.translate(1, 1, 0);
case SOUTH -> matrices.translate(-1, 1, -2);
case EAST -> matrices.translate(-1, 1, 2);
}
int lightAbove = WorldRenderer.getLightmapCoordinates(storage.getWorld(), storage.getPos().offset(storage.getFacing()));
MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Mode.FIXED, lightAbove, OverlayTexture.DEFAULT_UV, matrices, vertexConsumers, 0);

View file

@ -80,12 +80,12 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
new ModelPart.Cuboid(0, 6, -1.0F, -1.0F, -2.0F, 2F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
};
base = new ModelPart(Arrays.asList(baseCuboids), new HashMap<String, ModelPart>() {
base = new ModelPart(Arrays.asList(baseCuboids), new HashMap<>() {
{
ModelPart.Cuboid[] blade1Cuboids = {
new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
};
ModelPart blade1 = new ModelPart(Arrays.asList(blade1Cuboids) , Collections.emptyMap());
ModelPart blade1 = new ModelPart(Arrays.asList(blade1Cuboids), Collections.emptyMap());
blade1.setPivot(0.0F, 0.0F, 0.0F);
setRotation(blade1, -0.5236F, 0.0F, 0.0F);
put("blade1", blade1);
@ -93,7 +93,7 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
ModelPart.Cuboid[] blade2Cuboids = {
new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
};
ModelPart blade2 = new ModelPart(Arrays.asList(blade2Cuboids) , Collections.emptyMap());
ModelPart blade2 = new ModelPart(Arrays.asList(blade2Cuboids), Collections.emptyMap());
blade2.setPivot(0.0F, 0.0F, 0.0F);
setRotation(blade2, -0.5236F, 0.0F, 2.0944F);
put("blade2", blade2);
@ -101,7 +101,7 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
ModelPart.Cuboid[] blade3Cuboids = {
new ModelPart.Cuboid(0, 9, -24.0F, -2.0F, -1.075F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
};
ModelPart blade3 = new ModelPart(Arrays.asList(blade3Cuboids) , Collections.emptyMap());
ModelPart blade3 = new ModelPart(Arrays.asList(blade3Cuboids), Collections.emptyMap());
blade3.setPivot(0.0F, 0.0F, 0.0F);
setRotation(blade3, -0.5236F, 0.0F, -2.0944F);
put("blade3", blade3);