diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverKey.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverKey.java index 447079c36..f13eacf67 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverKey.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverKey.java @@ -10,9 +10,9 @@ record NetworkReceiverKey(GlobalPos pos) { int getDistance(final BlockPos from) { return (int) Math.sqrt( - Math.pow(from.getX() - pos.pos().getX(), 2) - + Math.pow(from.getY() - pos.pos().getY(), 2) - + Math.pow(from.getZ() - pos.pos().getZ(), 2) + Math.pow(from.getX() - (double) pos.pos().getX(), 2) + + Math.pow(from.getY() - (double) pos.pos().getY(), 2) + + Math.pow(from.getZ() - (double) pos.pos().getZ(), 2) ); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterScreen.java index b3790ec10..56b42cc98 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterScreen.java @@ -30,11 +30,6 @@ protected void init() { addSideButton(new RedstoneModeSideButtonWidget(getMenu().getProperty(PropertyTypes.REDSTONE_MODE))); } - @Override - protected ResourceLocation getTexture() { - return TEXTURE; - } - @Override protected void renderLabels(final GuiGraphics graphics, final int mouseX, final int mouseY) { super.renderLabels(graphics, mouseX, mouseY); @@ -45,4 +40,9 @@ protected void renderLabels(final GuiGraphics graphics, final int mouseX, final } graphics.drawString(font, status.message(), displayTextX + (status.error() ? (10 + 4) : 0), 25, 4210752, false); } + + @Override + protected ResourceLocation getTexture() { + return TEXTURE; + } } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProvider.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProvider.java index 5357e1fdc..c30c37371 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProvider.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProvider.java @@ -12,6 +12,11 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; public class BlockModelProvider extends net.minecraftforge.client.model.generators.BlockModelProvider { + private static final ResourceLocation EMISSIVE_ALL_CUTOUT = createIdentifier("block/emissive_all_cutout"); + private static final ResourceLocation EMISSIVE_NORTH_CUTOUT = createIdentifier("block/emissive_north_cutout"); + private static final ResourceLocation NORTH_CUTOUT = createIdentifier("block/north_cutout"); + private static final ResourceLocation ALL_CUTOUT = createIdentifier("block/all_cutout"); + public BlockModelProvider(final PackOutput output, final ExistingFileHelper existingFileHelper) { super(output, MOD_ID, existingFileHelper); } @@ -43,12 +48,11 @@ private void registerCables() { } private void registerControllers() { - final ResourceLocation base = createIdentifier("block/emissive_all_cutout"); final ResourceLocation off = createIdentifier("block/controller/off"); final ResourceLocation on = createIdentifier("block/controller/on"); Blocks.INSTANCE.getController().forEach((color, id, controller) -> { final ResourceLocation cutout = createIdentifier("block/controller/cutouts/" + color.getName()); - withExistingParent("block/controller/" + color.getName(), base) + withExistingParent("block/controller/" + color.getName(), EMISSIVE_ALL_CUTOUT) .texture("particle", off) .texture("all", on) .texture("cutout", cutout); @@ -61,7 +65,7 @@ private void registerGrids(final BlockColorMap> b registerEmissiveGrids(name, color.getName(), cutout); }); final ResourceLocation inactiveCutout = createIdentifier("block/" + name + "/cutouts/inactive"); - registerGrids(name, "inactive", inactiveCutout, createIdentifier("block/north_cutout")); + registerGrids(name, "inactive", inactiveCutout, NORTH_CUTOUT); } private void registerGrids(final String name, @@ -86,7 +90,7 @@ private void registerGrids(final String name, } private void registerEmissiveGrids(final String name, final String variantName, final ResourceLocation cutout) { - registerGrids(name, variantName, cutout, createIdentifier("block/emissive_north_cutout")); + registerGrids(name, variantName, cutout, EMISSIVE_NORTH_CUTOUT); } private void registerDetectors() { @@ -114,36 +118,34 @@ private void registerWirelessTransmitters() { } private void registerNetworkReceivers() { - final ResourceLocation emissiveBase = createIdentifier("block/emissive_all_cutout"); final ResourceLocation baseTexture = createIdentifier("block/network_receiver/base"); Blocks.INSTANCE.getNetworkReceiver().forEach((color, id, receiver) -> { final ResourceLocation cutout = createIdentifier("block/network_receiver/cutouts/" + color.getName()); - withExistingParent("block/network_receiver/" + color.getName(), emissiveBase) + withExistingParent("block/network_receiver/" + color.getName(), EMISSIVE_ALL_CUTOUT) .texture("particle", baseTexture) .texture("all", baseTexture) .texture("cutout", cutout); }); - withExistingParent("block/network_receiver/inactive", createIdentifier("block/all_cutout")) + withExistingParent("block/network_receiver/inactive", ALL_CUTOUT) .texture("particle", baseTexture) .texture("all", baseTexture) .texture("cutout", createIdentifier("block/network_receiver/cutouts/inactive")); } private void registerNetworkTransmitters() { - final ResourceLocation emissiveBase = createIdentifier("block/emissive_all_cutout"); final ResourceLocation baseTexture = createIdentifier("block/network_transmitter/base"); Blocks.INSTANCE.getNetworkTransmitter().forEach((color, id, receiver) -> { final ResourceLocation cutout = createIdentifier("block/network_transmitter/cutouts/" + color.getName()); - withExistingParent("block/network_transmitter/" + color.getName(), emissiveBase) + withExistingParent("block/network_transmitter/" + color.getName(), EMISSIVE_ALL_CUTOUT) .texture("particle", baseTexture) .texture("all", baseTexture) .texture("cutout", cutout); }); - withExistingParent("block/network_transmitter/inactive", createIdentifier("block/all_cutout")) + withExistingParent("block/network_transmitter/inactive", ALL_CUTOUT) .texture("particle", baseTexture) .texture("all", baseTexture) .texture("cutout", createIdentifier("block/network_transmitter/cutouts/inactive")); - withExistingParent("block/network_transmitter/error", emissiveBase) + withExistingParent("block/network_transmitter/error", EMISSIVE_ALL_CUTOUT) .texture("particle", baseTexture) .texture("all", baseTexture) .texture("cutout", createIdentifier("block/network_transmitter/cutouts/error")); diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProvider.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProvider.java index da762c9a6..c7b4af6f0 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProvider.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProvider.java @@ -26,6 +26,9 @@ import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; public class ItemModelProvider extends net.minecraftforge.client.model.generators.ItemModelProvider { + private static final String CUTOUT_TEXTURE_KEY = "cutout"; + private static final String CABLE_TEXTURE_KEY = "cable"; + public ItemModelProvider(final PackOutput output, final ExistingFileHelper existingFileHelper) { super(output, MOD_ID, existingFileHelper); } @@ -54,7 +57,7 @@ private void registerCables() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cable", + CABLE_TEXTURE_KEY, createIdentifier("block/cable/" + color.getName())) ); } @@ -65,7 +68,7 @@ private void registerExporters() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cable", + CABLE_TEXTURE_KEY, createIdentifier("block/cable/" + color.getName()) )); } @@ -76,7 +79,7 @@ private void registerImporters() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cable", + CABLE_TEXTURE_KEY, createIdentifier("block/cable/" + color.getName()) )); } @@ -87,7 +90,7 @@ private void registerExternalStorages() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cable", + CABLE_TEXTURE_KEY, createIdentifier("block/cable/" + color.getName()) )); } @@ -158,7 +161,7 @@ private void registerConstructors() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cable", + CABLE_TEXTURE_KEY, createIdentifier("block/cable/" + color.getName()) )); } @@ -169,7 +172,7 @@ private void registerDestructors() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cable", + CABLE_TEXTURE_KEY, createIdentifier("block/cable/" + color.getName()) )); } @@ -180,7 +183,7 @@ private void registerWirelessTransmitters() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cutout", + CUTOUT_TEXTURE_KEY, createIdentifier("block/wireless_transmitter/cutouts/" + color.getName()) )); } @@ -191,7 +194,7 @@ private void registerNetworkReceivers() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cutout", + CUTOUT_TEXTURE_KEY, createIdentifier("block/network_receiver/cutouts/" + color.getName()) )); } @@ -202,7 +205,7 @@ private void registerNetworkTransmitters() { blocks.forEach((color, id, block) -> singleTexture( id.getPath(), base, - "cutout", + CUTOUT_TEXTURE_KEY, createIdentifier("block/network_transmitter/cutouts/" + color.getName()) )); }