SonarQube addiction, pt 14

This commit is contained in:
raoulvdberge
2020-10-18 14:20:00 +02:00
parent 340897fc76
commit f87c1ffec4
11 changed files with 41 additions and 37 deletions

View File

@@ -75,27 +75,27 @@ public class CableBlock extends NetworkNodeBlock implements IWaterLoggable {
protected static VoxelShape getCableShape(BlockState state) {
VoxelShape shape = SHAPE_CORE;
if (state.get(NORTH)) {
if (Boolean.TRUE.equals(state.get(NORTH))) {
shape = VoxelShapes.or(shape, SHAPE_NORTH);
}
if (state.get(EAST)) {
if (Boolean.TRUE.equals(state.get(EAST))) {
shape = VoxelShapes.or(shape, SHAPE_EAST);
}
if (state.get(SOUTH)) {
if (Boolean.TRUE.equals(state.get(SOUTH))) {
shape = VoxelShapes.or(shape, SHAPE_SOUTH);
}
if (state.get(WEST)) {
if (Boolean.TRUE.equals(state.get(WEST))) {
shape = VoxelShapes.or(shape, SHAPE_WEST);
}
if (state.get(UP)) {
if (Boolean.TRUE.equals(state.get(UP))) {
shape = VoxelShapes.or(shape, SHAPE_UP);
}
if (state.get(DOWN)) {
if (Boolean.TRUE.equals(state.get(DOWN))) {
shape = VoxelShapes.or(shape, SHAPE_DOWN);
}
@@ -125,7 +125,7 @@ public class CableBlock extends NetworkNodeBlock implements IWaterLoggable {
@Override
@SuppressWarnings("deprecation")
public FluidState getFluidState(BlockState state) {
return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state);
return Boolean.TRUE.equals(state.get(WATERLOGGED)) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state);
}
@Override

View File

@@ -49,7 +49,7 @@ public class BlockModelGenerator extends BlockStateProvider {
String folderName = RSBlocks.WIRELESS_TRANSMITTER.get(ColorMap.DEFAULT_COLOR).getId().getPath();
models.wirelessTransmitterBlock(block, state -> {
if (!state.get(NetworkNodeBlock.CONNECTED)) {
if (Boolean.FALSE.equals(state.get(NetworkNodeBlock.CONNECTED))) {
return models.createWirelessTransmitterModel(
"block/" + folderName + "/disconnected",
resourceLocation(folderName, "cutouts/disconnected")
@@ -73,7 +73,7 @@ public class BlockModelGenerator extends BlockStateProvider {
String folderName = RSBlocks.DETECTOR.get(ColorMap.DEFAULT_COLOR).getId().getPath();
models.simpleBlockStateModel(block, state -> {
if (!state.get(DetectorBlock.POWERED)) {
if (Boolean.FALSE.equals(state.get(DetectorBlock.POWERED))) {
return models.createDetectorModel(
"block/" + folderName + "/off",
resourceLocation(folderName, "cutouts/off")
@@ -97,7 +97,7 @@ public class BlockModelGenerator extends BlockStateProvider {
String folderName = RSBlocks.SECURITY_MANAGER.get(ColorMap.DEFAULT_COLOR).getId().getPath();
models.horizontalRSBlock(block, state -> {
if (!state.get(NetworkNodeBlock.CONNECTED)) {
if (Boolean.FALSE.equals(state.get(NetworkNodeBlock.CONNECTED))) {
return models.createCubeCutoutModel(
"block/" + folderName + "/disconnected",
BOTTOM,
@@ -143,7 +143,7 @@ public class BlockModelGenerator extends BlockStateProvider {
String folderName = blockMap.get(ColorMap.DEFAULT_COLOR).getId().getPath();
models.simpleBlockStateModel(block, state -> {
if (!state.get(NetworkNodeBlock.CONNECTED)) {
if (Boolean.FALSE.equals(state.get(NetworkNodeBlock.CONNECTED))) {
return models.createCubeAllCutoutModel(
"block/" + folderName + "/disconnected",
resourceLocation(folderName, folderName),
@@ -171,7 +171,7 @@ public class BlockModelGenerator extends BlockStateProvider {
String folderName = RSBlocks.CRAFTER.get(ColorMap.DEFAULT_COLOR).getId().getPath();
models.anyDirectionalRSBlock(block, state -> {
if (!state.get(NetworkNodeBlock.CONNECTED)) {
if (Boolean.FALSE.equals(state.get(NetworkNodeBlock.CONNECTED))) {
return models.createCubeCutoutModel(
"block/" + folderName + "/disconnected",
BOTTOM,
@@ -261,7 +261,7 @@ public class BlockModelGenerator extends BlockStateProvider {
String folderName = blockMap.get(ColorMap.DEFAULT_COLOR).getId().getPath();
models.horizontalRSBlock(block, state -> {
if (!state.get(NetworkNodeBlock.CONNECTED)) {
if (Boolean.FALSE.equals(state.get(NetworkNodeBlock.CONNECTED))) {
return models.createCubeNorthCutoutModel(
"block/" + folderName + "/disconnected",
BOTTOM,

View File

@@ -100,11 +100,11 @@ public class BlockModels {
.texture("cutout_up", upCutout);
}
public BlockModelBuilder createControllerNearlyCutoutModel(String name, ResourceLocation particle, ResourceLocation all, ResourceLocation cutout_gray, ResourceLocation cutout) {
public BlockModelBuilder createControllerNearlyCutoutModel(String name, ResourceLocation particle, ResourceLocation all, ResourceLocation grayCutout, ResourceLocation cutout) {
return generator.models().withExistingParent(name, new ResourceLocation(RS.ID, "block/controller_nearly"))
.texture("particle", particle)
.texture("all", all)
.texture("cutout_gray", cutout_gray)
.texture("cutout_gray", grayCutout)
.texture("cutout", cutout);
}

View File

@@ -13,7 +13,7 @@ import javax.annotation.Nullable;
public class ControllerItemPropertyGetter implements IItemPropertyGetter {
@Override
public float call(ItemStack stack, @Nullable ClientWorld p_call_2_, @Nullable LivingEntity p_call_3_) {
public float call(ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY).orElse(null);
if (storage != null) {
return Network.getEnergyType(storage.getEnergyStored(), storage.getMaxEnergyStored()).ordinal();

View File

@@ -10,11 +10,11 @@ import net.minecraft.item.ItemStack;
public class PatternItemStackTileRenderer extends ItemStackTileEntityRenderer {
@Override
public void func_239207_a_(ItemStack stack, ItemCameraTransforms.TransformType transformType, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int p_239207_5_, int p_239207_6_) {
public void func_239207_a_(ItemStack stack, ItemCameraTransforms.TransformType transformType, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) {
ICraftingPattern pattern = PatternItem.fromCache(null, stack);
ItemStack outputStack = pattern.getOutputs().get(0);
outputStack.getItem().getItemStackTileEntityRenderer().func_239207_a_(outputStack, transformType, matrixStack, renderTypeBuffer, p_239207_5_, p_239207_6_);
outputStack.getItem().getItemStackTileEntityRenderer().func_239207_a_(outputStack, transformType, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay);
}
}

View File

@@ -153,12 +153,12 @@ public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> im
}
@Override
public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) {
if (searchField.charTyped(p_charTyped_1_, p_charTyped_2_)) {
public boolean charTyped(char unknown1, int unknown2) {
if (searchField.charTyped(unknown1, unknown2)) {
return true;
}
return super.charTyped(p_charTyped_1_, p_charTyped_2_);
return super.charTyped(unknown1, unknown2);
}
@Override

View File

@@ -6,7 +6,7 @@ import com.refinedmods.refinedstorage.tile.data.TileDataParameterClientListener;
public class CrafterTileDataParameterClientListener implements TileDataParameterClientListener<Boolean> {
@Override
public void onChanged(boolean initial, Boolean hasRoot) {
if (!hasRoot) {
if (Boolean.FALSE.equals(hasRoot)) {
BaseScreen.executeLater(CrafterScreen.class, gui -> gui.addSideButton(new CrafterModeSideButton(gui)));
}
}

View File

@@ -555,20 +555,24 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
}
@Override
public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) {
if (searchField.charTyped(p_charTyped_1_, p_charTyped_2_)) {
public boolean charTyped(char unknown1, int unknown2) {
if (searchField.charTyped(unknown1, unknown2)) {
return true;
}
return super.charTyped(p_charTyped_1_, p_charTyped_2_);
return super.charTyped(unknown1, unknown2);
}
@Override
public boolean keyReleased(int key, int p_223281_2_, int p_223281_3_) {
if (key == GLFW.GLFW_KEY_LEFT_SHIFT || key == GLFW.GLFW_KEY_RIGHT_SHIFT || key == GLFW.GLFW_KEY_LEFT_CONTROL || key == GLFW.GLFW_KEY_RIGHT_CONTROL) {
public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_LEFT_SHIFT ||
keyCode == GLFW.GLFW_KEY_RIGHT_SHIFT ||
keyCode == GLFW.GLFW_KEY_LEFT_CONTROL ||
keyCode == GLFW.GLFW_KEY_RIGHT_CONTROL) {
view.sort();
}
return super.keyReleased(key, p_223281_2_, p_223281_3_);
return super.keyReleased(keyCode, scanCode, modifiers);
}
@Override

View File

@@ -47,11 +47,11 @@ public class CheckboxWidget extends CheckboxButton {
}
@Override
public void renderButton(MatrixStack matrixStack, int p_230431_2_, int p_230431_3_, float p_230431_4_) {
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
Minecraft minecraft = Minecraft.getInstance();
minecraft.getTextureManager().bindTexture(TEXTURE);
RenderSystem.enableDepthTest();
FontRenderer fontrenderer = minecraft.fontRenderer;
FontRenderer fontRenderer = minecraft.fontRenderer;
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
@@ -65,7 +65,7 @@ public class CheckboxWidget extends CheckboxButton {
blit(matrixStack, this.x, this.y, textureX, textureY, width, height, 32, 32);
this.renderBg(matrixStack, minecraft, p_230431_2_, p_230431_3_);
this.renderBg(matrixStack, minecraft, mouseX, mouseY);
int color = 14737632;
@@ -76,9 +76,9 @@ public class CheckboxWidget extends CheckboxButton {
}
if (shadow) {
drawString(matrixStack, fontrenderer, this.getMessage(), this.x + 13, this.y + (this.height - 8) / 2, color);
drawString(matrixStack, fontRenderer, this.getMessage(), this.x + 13, this.y + (this.height - 8) / 2, color);
} else {
fontrenderer.drawString(matrixStack, this.getMessage().getString(), this.x + 13, this.y + (this.height - 8) / 2F, color);
fontRenderer.drawString(matrixStack, this.getMessage().getString(), (float) this.x + 13, this.y + (this.height - 8) / 2F, color);
}
}
}

View File

@@ -173,10 +173,10 @@ public class SearchWidget extends TextFieldWidget {
}
@Override
public void renderButton(MatrixStack p_230431_1_, int p_230431_2_, int p_230431_3_, float p_230431_4_) {
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (canSyncFromJEINow() && RSJeiPlugin.getRuntime().getIngredientListOverlay().hasKeyboardFocus()) {
setTextFromJEI();
}
super.renderButton(p_230431_1_, p_230431_2_, p_230431_3_, p_230431_4_);
super.renderButton(matrixStack, mouseX, mouseY, partialTicks);
}
}

View File

@@ -15,12 +15,12 @@ public class ConstructorDropSideButton extends SideButton {
@Override
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
screen.blit(matrixStack, x, y, 64 + (ConstructorTile.DROP.getValue() ? 16 : 0), 16, 16, 16);
screen.blit(matrixStack, x, y, 64 + (Boolean.TRUE.equals(ConstructorTile.DROP.getValue()) ? 16 : 0), 16, 16, 16);
}
@Override
public String getTooltip() {
return I18n.format("sidebutton.refinedstorage.constructor.drop") + "\n" + TextFormatting.GRAY + I18n.format(ConstructorTile.DROP.getValue() ? "gui.yes" : "gui.no");
return I18n.format("sidebutton.refinedstorage.constructor.drop") + "\n" + TextFormatting.GRAY + I18n.format(Boolean.TRUE.equals(ConstructorTile.DROP.getValue()) ? "gui.yes" : "gui.no");
}
@Override