Minor cleanup.

This commit is contained in:
Florian Nücke
2022-01-13 10:36:16 +01:00
parent 1320d16f01
commit 6322290f03
6 changed files with 13 additions and 12 deletions

View File

@@ -21,8 +21,8 @@ public final class RobotTerminalScreen extends AbstractMachineTerminalScreen<Rob
///////////////////////////////////////////////////////////////////
public RobotTerminalScreen(final RobotTerminalContainer container, final Inventory playerInventory, final Component title) {
super(container, playerInventory, title);
public RobotTerminalScreen(final RobotTerminalContainer container, final Inventory inventory, final Component title) {
super(container, inventory, title);
}
@Override

View File

@@ -2,7 +2,6 @@ package li.cil.oc2.common.blockentity;
import li.cil.oc2.api.capabilities.NetworkInterface;
import li.cil.oc2.client.renderer.NetworkCableRenderer;
import li.cil.oc2.common.Constants;
import li.cil.oc2.common.block.NetworkConnectorBlock;
import li.cil.oc2.common.capabilities.Capabilities;
import li.cil.oc2.common.item.Items;
@@ -53,7 +52,7 @@ public final class NetworkConnectorBlockEntity extends ModBlockEntity {
private static final int MAX_CONNECTION_COUNT = 2;
private static final int MAX_CONNECTION_DISTANCE = 16;
private static final int INITIAL_PACKET_TIME_TO_LIVE = 12;
private static final int BYTES_PER_TICK = 64 * 1024 / Constants.SECONDS_TO_TICKS; // bytes / sec -> bytes / tick
private static final int BYTES_PER_TICK = 64 * 1024 / TickUtils.toTicks(Duration.ofSeconds(1)); // bytes / sec -> bytes / tick
private static final int MIN_ETHERNET_FRAME_SIZE = 42;
private static final int TTL_COST = 1;
@@ -193,13 +192,13 @@ public final class NetworkConnectorBlockEntity extends ModBlockEntity {
}
}
final NetworkInterface src = adjacentInterface.orElse(NullNetworkInterface.INSTANCE);
final NetworkInterface source = adjacentInterface.orElse(NullNetworkInterface.INSTANCE);
int byteBudget = BYTES_PER_TICK;
byte[] frame;
while ((frame = src.readEthernetFrame()) != null && byteBudget > 0) {
while ((frame = source.readEthernetFrame()) != null && byteBudget > 0) {
byteBudget -= Math.max(frame.length, MIN_ETHERNET_FRAME_SIZE); // Avoid bogus packets messing with us.
networkInterface.writeEthernetFrame(src, frame, INITIAL_PACKET_TIME_TO_LIVE);
networkInterface.writeEthernetFrame(source, frame, INITIAL_PACKET_TIME_TO_LIVE);
}
}

View File

@@ -51,7 +51,7 @@ public final class WrenchRecipe extends ShapelessRecipe {
@Nullable
@Override
public WrenchRecipe fromNetwork(final ResourceLocation location, final FriendlyByteBuf buffer) {
ShapelessRecipe recipe = SHAPELESS_RECIPE.fromNetwork(location, buffer);
final ShapelessRecipe recipe = SHAPELESS_RECIPE.fromNetwork(location, buffer);
if (recipe == null) {
return null;
}

View File

@@ -5,6 +5,8 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.Tags;
import static net.minecraft.tags.ItemTags.createOptional;
public final class ItemTags {
public static final Tags.IOptionalNamedTag<Item> DEVICES = tag("devices");
public static final Tags.IOptionalNamedTag<Item> DEVICES_MEMORY = tag("devices/memory");
@@ -26,6 +28,6 @@ public final class ItemTags {
///////////////////////////////////////////////////////////////////
private static Tags.IOptionalNamedTag<Item> tag(final String name) {
return net.minecraft.tags.ItemTags.createOptional(new ResourceLocation(API.MOD_ID, name));
return createOptional(new ResourceLocation(API.MOD_ID, name));
}
}

View File

@@ -37,8 +37,8 @@ public final class ModLootTableProvider extends LootTableProvider {
}
@Override
protected void validate(final Map<ResourceLocation, LootTable> map, final ValidationContext validationtracker) {
map.forEach((location, table) -> LootTables.validate(validationtracker, location, table));
protected void validate(final Map<ResourceLocation, LootTable> map, final ValidationContext context) {
map.forEach((location, table) -> LootTables.validate(context, location, table));
}
@Override

View File

@@ -19,7 +19,7 @@ public final class ModRecipesProvider extends RecipeProvider {
}
@Override
protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer) {
protected void buildCraftingRecipes(final Consumer<FinishedRecipe> consumer) {
ShapedRecipeBuilder
.shaped(Items.COMPUTER.get())
.pattern("ICI")