Static imports for less clutter.
This commit is contained in:
@@ -9,7 +9,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import java.util.Objects;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
public final class ComputerContainerScreen extends ContainerScreen<ComputerContainer> {
|
||||
private static final ResourceLocation BACKGROUND = new ResourceLocation(API.MOD_ID, "textures/gui/container/computer.png");
|
||||
@@ -29,7 +29,7 @@ public final class ComputerContainerScreen extends ContainerScreen<ComputerConta
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) {
|
||||
RenderSystem.color4f(1f, 1f, 1f, 1f);
|
||||
Objects.requireNonNull(minecraft).getTextureManager().bindTexture(BACKGROUND);
|
||||
requireNonNull(minecraft).getTextureManager().bindTexture(BACKGROUND);
|
||||
blit(matrixStack, guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ import net.minecraft.util.text.ITextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Objects;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
public final class TerminalScreen extends Screen {
|
||||
private static final ResourceLocation BACKGROUND = new ResourceLocation(API.MOD_ID, "textures/gui/screen/terminal.png");
|
||||
@@ -47,11 +48,11 @@ public final class TerminalScreen extends Screen {
|
||||
|
||||
isMouseOverTerminal = isPointInRegion(TERMINAL_AREA_X, TERMINAL_AREA_Y, TERMINAL_AREA_WIDTH, TERMINAL_AREA_HEIGHT, mouseX, mouseY);
|
||||
RenderSystem.color4f(1f, 1f, 1f, 1f);
|
||||
Objects.requireNonNull(minecraft).getTextureManager().bindTexture(BACKGROUND);
|
||||
requireNonNull(minecraft).getTextureManager().bindTexture(BACKGROUND);
|
||||
blit(matrixStack, windowLeft, windowTop, 0, 0, windowWidth, windowHeight, TEXTURE_SIZE, TEXTURE_SIZE);
|
||||
|
||||
if (isMouseOverTerminal) {
|
||||
Objects.requireNonNull(minecraft).getTextureManager().bindTexture(BACKGROUND_TERMINAL_FOCUSED);
|
||||
requireNonNull(minecraft).getTextureManager().bindTexture(BACKGROUND_TERMINAL_FOCUSED);
|
||||
blit(matrixStack, windowLeft, windowTop, 0, 0, windowWidth, windowHeight, TEXTURE_SIZE, TEXTURE_SIZE);
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ public final class TerminalScreen extends Screen {
|
||||
}
|
||||
|
||||
if ((modifiers & GLFW.GLFW_MOD_CONTROL) != 0 && keyCode == GLFW.GLFW_KEY_V) {
|
||||
final String value = Objects.requireNonNull(minecraft).keyboardListener.getClipboardString();
|
||||
final String value = requireNonNull(minecraft).keyboardListener.getClipboardString();
|
||||
for (final char ch : value.toCharArray()) {
|
||||
terminal.putInput((byte) ch);
|
||||
}
|
||||
@@ -114,14 +115,14 @@ public final class TerminalScreen extends Screen {
|
||||
this.windowLeft = (this.width - this.windowWidth) / 2;
|
||||
this.windowTop = (this.height - this.windowHeight) / 2;
|
||||
|
||||
Objects.requireNonNull(minecraft).keyboardListener.enableRepeatEvents(true);
|
||||
requireNonNull(minecraft).keyboardListener.enableRepeatEvents(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
super.onClose();
|
||||
|
||||
Objects.requireNonNull(minecraft).keyboardListener.enableRepeatEvents(false);
|
||||
requireNonNull(minecraft).keyboardListener.enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
private boolean isPointInRegion(final int x, final int y, final int width, final int height, double mouseX, double mouseY) {
|
||||
|
||||
@@ -16,6 +16,8 @@ import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
public final class TileEntityDeviceBusElement extends AbstractDeviceBusElement {
|
||||
private static final int NEIGHBOR_COUNT = 6;
|
||||
|
||||
@@ -76,7 +78,7 @@ public final class TileEntityDeviceBusElement extends AbstractDeviceBusElement {
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
final World world = Objects.requireNonNull(tileEntity.getWorld());
|
||||
final World world = requireNonNull(tileEntity.getWorld());
|
||||
ServerScheduler.schedule(world, () -> {
|
||||
if (tileEntity.isRemoved()) {
|
||||
return;
|
||||
@@ -98,7 +100,7 @@ public final class TileEntityDeviceBusElement extends AbstractDeviceBusElement {
|
||||
}
|
||||
|
||||
private void scheduleBusScanInAdjacentBusElements() {
|
||||
final World world = Objects.requireNonNull(tileEntity.getWorld());
|
||||
final World world = requireNonNull(tileEntity.getWorld());
|
||||
final BlockPos pos = tileEntity.getPos();
|
||||
for (final Direction direction : Direction.values()) {
|
||||
final BlockPos neighborPos = pos.offset(direction);
|
||||
|
||||
@@ -44,6 +44,8 @@ import java.nio.ByteBuffer;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
public final class ComputerTileEntity extends AbstractTileEntity implements ITickableTileEntity {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -189,7 +191,7 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic
|
||||
protected void initializeServer() {
|
||||
super.initializeServer();
|
||||
|
||||
ServerScheduler.schedule(() -> chunk = Objects.requireNonNull(getWorld()).getChunkAt(getPos()));
|
||||
ServerScheduler.schedule(() -> chunk = requireNonNull(getWorld()).getChunkAt(getPos()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user