Skip to content

Commit

Permalink
Simplified the use of ResourceLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Edivad99 committed Sep 25, 2023
1 parent 8178df6 commit a350f91
Show file tree
Hide file tree
Showing 106 changed files with 195 additions and 232 deletions.
5 changes: 5 additions & 0 deletions src/main/java/mods/railcraft/Railcraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import mods.railcraft.world.level.material.RailcraftFluids;
import mods.railcraft.world.signal.TokenRingManager;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.SimpleContainer;
Expand Down Expand Up @@ -105,6 +106,10 @@ public class Railcraft {
}
}

public static ResourceLocation rl(String path) {
return new ResourceLocation(ID, path);
}

private final CrowbarHandler crowbarHandler = new CrowbarHandler();
private final MinecartHandler minecartHandler = new MinecartHandler();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class BedCartSleepTrigger extends SimpleCriterionTrigger<BedCartSleepTrigger.Instance> {

private static final ResourceLocation ID = new ResourceLocation(Railcraft.ID, "bed_cart_sleep");
private static final ResourceLocation ID = Railcraft.rl("bed_cart_sleep");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class CartLinkingTrigger extends SimpleCriterionTrigger<CartLinkingTrigger.Instance> {

private static final ResourceLocation ID = new ResourceLocation(Railcraft.ID, "cart_linking");
private static final ResourceLocation ID = Railcraft.rl("cart_linking");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
public class CartRidingTrigger extends SimpleCriterionTrigger<CartRidingTrigger.Instance> {

private static final ResourceLocation ID = new ResourceLocation(Railcraft.ID, "cart_riding");
private static final ResourceLocation ID = Railcraft.rl("cart_riding");
// private static final int FREQUENCY = 20;

// private final Map<ServerPlayerEntity, AbstractMinecartEntity> mounting =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
public class JukeboxCartPlayMusicTrigger
extends SimpleCriterionTrigger<JukeboxCartPlayMusicTrigger.Instance> {

private static final ResourceLocation ID =
new ResourceLocation(Railcraft.ID + ":jukebox_cart_play_music");
private static final ResourceLocation ID = Railcraft.rl("jukebox_cart_play_music");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
public class KilledByLocomotiveTrigger
extends SimpleCriterionTrigger<KilledByLocomotiveTrigger.Instance> {

private static final ResourceLocation ID =
new ResourceLocation(Railcraft.ID, "killed_by_locomotive");
private static final ResourceLocation ID = Railcraft.rl("killed_by_locomotive");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
public class MultiBlockFormedTrigger extends
SimpleCriterionTrigger<MultiBlockFormedTrigger.Instance> {

private static final ResourceLocation ID =
new ResourceLocation(Railcraft.ID, "multiblock_formed");
private static final ResourceLocation ID = Railcraft.rl("multiblock_formed");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class SetSeasonTrigger extends SimpleCriterionTrigger<SetSeasonTrigger.Instance> {

private static final ResourceLocation ID = new ResourceLocation(Railcraft.ID, "set_season");
private static final ResourceLocation ID = Railcraft.rl("set_season");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public class SpikeMaulUseTrigger extends SimpleCriterionTrigger<SpikeMaulUseTrigger.Instance> {

private static final ResourceLocation ID = new ResourceLocation(Railcraft.ID, "spike_maul_use");
private static final ResourceLocation ID = Railcraft.rl("spike_maul_use");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class SurpriseTrigger extends SimpleCriterionTrigger<SurpriseTrigger.Instance> {

private static final ResourceLocation ID = new ResourceLocation(Railcraft.ID, "surprise");
private static final ResourceLocation ID = Railcraft.rl("surprise");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public class UseTrackKitTrigger extends SimpleCriterionTrigger<UseTrackKitTrigger.Instance> {

private static final ResourceLocation ID = new ResourceLocation(Railcraft.ID, "use_track_kit");
private static final ResourceLocation ID = Railcraft.rl("use_track_kit");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class GoldenTicketScreen extends IngameWindowScreen {

private static final ResourceLocation TICKET_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/item/golden_ticket.png");
Railcraft.rl("textures/gui/item/golden_ticket.png");
private static final int IMAGE_WIDTH = 256;
private static final int IMAGE_HEIGHT = 136;
private static final String PREFIX = "Dest=";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
public class IngameWindowScreen extends Screen {

public static final ResourceLocation WIDGETS_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/widgets.png");
Railcraft.rl("textures/gui/widgets.png");
public static final ResourceLocation LARGE_WINDOW_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/large_window.png");
Railcraft.rl("textures/gui/large_window.png");

public static final int TEXT_COLOR = 0xFF404040;
public static final int DEFAULT_WINDOW_WIDTH = 176;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
public class RoutingTableBookScreen extends Screen {

public static final ResourceLocation BOOK_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/item/routing_table_book.png");
Railcraft.rl("textures/gui/item/routing_table_book.png");
private static final int TEXT_WIDTH = 220;
private static final int TEXT_HEIGHT = 128;
private static final int IMAGE_WIDTH = 256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class BlastFurnaceScreen extends RailcraftMenuScreen<BlastFurnaceMenu> {

private static final ResourceLocation WIDGETS_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/blast_furnace.png");
Railcraft.rl("textures/gui/container/blast_furnace.png");

public BlastFurnaceScreen(BlastFurnaceMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class CartDispenserScreen extends RailcraftMenuScreen<CartDispenserMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/cart_slots.png");
Railcraft.rl("textures/gui/container/cart_slots.png");

public CartDispenserScreen(CartDispenserMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class CokeOvenScreen extends RailcraftMenuScreen<CokeOvenMenu> {

private static final ResourceLocation WIDGETS_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/coke_oven.png");
Railcraft.rl("textures/gui/container/coke_oven.png");

public CokeOvenScreen(CokeOvenMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CreativeLocomotiveScreen
extends LocomotiveScreen<LocomotiveMenu<CreativeLocomotive>> {

private static final ResourceLocation TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/creative_locomotive.png");
Railcraft.rl("textures/gui/container/creative_locomotive.png");

public CreativeLocomotiveScreen(LocomotiveMenu<CreativeLocomotive> menu,
Inventory inventory, Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class CrusherScreen extends RailcraftMenuScreen<CrusherMenu> {

private static final ResourceLocation WIDGETS_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/crusher.png");
Railcraft.rl("textures/gui/container/crusher.png");

public CrusherScreen(CrusherMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class DumpingTrackScreen extends RailcraftMenuScreen<DumpingTrackMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/dumping_track.png");
Railcraft.rl("textures/gui/container/dumping_track.png");

private static final Component FILTERS =
Component.translatable(Translations.Screen.ITEM_MANIPULATOR_FILTERS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class ElectricLocomotiveScreen extends LocomotiveScreen<ElectricLocomotiveMenu> {

private static final ResourceLocation TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/electric_locomotive.png");
Railcraft.rl("textures/gui/container/electric_locomotive.png");

public ElectricLocomotiveScreen(ElectricLocomotiveMenu menu, Inventory inventory,
Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class FeedStationScreen extends AbstractContainerScreen<FeedStationMenu> {

private static final ResourceLocation BACKGROUND_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/single_slot.png");
Railcraft.rl("textures/gui/container/single_slot.png");

public FeedStationScreen(FeedStationMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class FluidFueledSteamBoilerScreen extends RailcraftMenuScreen<FluidFueledSteamBoilerMenu> {

private static final ResourceLocation WIDGETS_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/fluid_fueled_steam_boiler.png");
Railcraft.rl("textures/gui/container/fluid_fueled_steam_boiler.png");

public FluidFueledSteamBoilerScreen(FluidFueledSteamBoilerMenu menu, Inventory inventory,
Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class FluidManipulatorScreen extends ManipulatorScreen<FluidManipulatorMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/fluid_manipulator.png");
Railcraft.rl("textures/gui/container/fluid_manipulator.png");

public FluidManipulatorScreen(FluidManipulatorMenu menu, Inventory inventory,
Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class ItemManipulatorScreen extends ManipulatorScreen<ItemManipulatorMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/item_manipulator.png");
Railcraft.rl("textures/gui/container/item_manipulator.png");

private final static Component FILTERS_TEXT =
Component.translatable(Translations.Screen.ITEM_MANIPULATOR_FILTERS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class LogBookScreen extends Screen {

private static final int TEXT_WIDTH = 220;
private static final ResourceLocation BOOK_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/block/logbook.png");
Railcraft.rl("textures/gui/block/logbook.png");
private static final int IMAGE_WIDTH = 256;
private static final int IMAGE_HEIGHT = 181;
private final List<String> pages = Lists.newArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class ManualRollingMachineScreen extends RailcraftMenuScreen<ManualRollingMachineMenu> {

private static final ResourceLocation BACKGROUND_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/manual_rolling_machine.png");
Railcraft.rl("textures/gui/container/manual_rolling_machine.png");

public ManualRollingMachineScreen(ManualRollingMachineMenu menu, Inventory inventory,
Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class PoweredRollingMachineScreen extends RailcraftMenuScreen<PoweredRollingMachineMenu> {

private static final ResourceLocation BACKGROUND_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/powered_rolling_machine.png");
Railcraft.rl("textures/gui/container/powered_rolling_machine.png");

public PoweredRollingMachineScreen(PoweredRollingMachineMenu menu, Inventory inventory,
Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class RoutingTrackScreen extends RailcraftMenuScreen<RoutingTrackMenu> {

private static final int REFRESH_INTERVAL_TICKS = 20;
private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/routing_track.png");
Railcraft.rl("textures/gui/container/routing_track.png");
private final RoutingTrackBlockEntity routingBlockEntity;
private MultiButton<LockableSwitchTrackActuatorBlockEntity.Lock> lockButton;
private int refreshTimer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class SolidFueledSteamBoilerScreen extends RailcraftMenuScreen<SolidFueledSteamBoilerMenu> {

private static final ResourceLocation WIDGETS_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/solid_fueled_steam_boiler.png");
Railcraft.rl("textures/gui/container/solid_fueled_steam_boiler.png");

public SolidFueledSteamBoilerScreen(SolidFueledSteamBoilerMenu menu, Inventory inventory,
Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class SteamLocomotiveScreen extends LocomotiveScreen<SteamLocomotiveMenu> {

private static final ResourceLocation TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/steam_locomotive.png");
Railcraft.rl("textures/gui/container/steam_locomotive.png");

public SteamLocomotiveScreen(SteamLocomotiveMenu menu, Inventory inv, Component title) {
super(menu, inv, title, "steam");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class SteamOvenScreen extends RailcraftMenuScreen<SteamOvenMenu> {

private static final ResourceLocation WIDGETS_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/steam_oven.png");
Railcraft.rl("textures/gui/container/steam_oven.png");
private final SteamOvenModule steamOvenModule;

public SteamOvenScreen(SteamOvenMenu menu, Inventory inventory, Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class SteamTurbineScreen extends RailcraftMenuScreen<SteamTurbineMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/steam_turbine.png");
Railcraft.rl("textures/gui/container/steam_turbine.png");

public SteamTurbineScreen(SteamTurbineMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class SwitchTrackRouterScreen extends RailcraftMenuScreen<SwitchTrackRouterMenu> {

private static final ResourceLocation BACKGROUND_TEXTURE =
new ResourceLocation(Railcraft.ID, "textures/gui/container/routing.png");
Railcraft.rl("textures/gui/container/routing.png");
private static final Component ROUTING_TABLE =
Component.translatable(Translations.Screen.ROUTING_TABLE_BOOK);
private static final int REFRESH_INTERVAL_TICKS = 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class TankMinecartScreen extends RailcraftMenuScreen<TankMinecartMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/tank_minecart.png");
Railcraft.rl("textures/gui/container/tank_minecart.png");

public TankMinecartScreen(TankMinecartMenu menu, Inventory inventory,
Component title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class TankScreen extends RailcraftMenuScreen<TankMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/tank.png");
Railcraft.rl("textures/gui/container/tank.png");

public TankScreen(TankMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class TrackLayerScreen extends MaintenanceMinecartScreen<TrackLayerMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/track_layer.png");
Railcraft.rl("textures/gui/container/track_layer.png");

public TrackLayerScreen(TrackLayerMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title, menu.getTrackLayer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class TrackRelayerScreen extends MaintenanceMinecartScreen<TrackRelayerMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/track_relayer.png");
Railcraft.rl("textures/gui/container/track_relayer.png");

public TrackRelayerScreen(TrackRelayerMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title, menu.getTrackRelayer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class TrackUndercutterScreen extends MaintenanceMinecartScreen<TrackUndercutterMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/track_undercutter.png");
Railcraft.rl("textures/gui/container/track_undercutter.png");

private static final Component UNDER = Component.translatable(Translations.Screen.UNDER);
private static final Component SIDES = Component.translatable(Translations.Screen.SIDES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class TrainDispenserScreen extends RailcraftMenuScreen<TrainDispenserMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/train_dispenser.png");
Railcraft.rl("textures/gui/container/train_dispenser.png");

private final static Component PATTERN =
Component.translatable(Translations.Screen.PATTERN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class TunnelBoreScreen extends RailcraftMenuScreen<TunnelBoreMenu> {

private static final ResourceLocation WIDGETS_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/tunnel_bore.png");
Railcraft.rl("textures/gui/container/tunnel_bore.png");

private static final Component HEAD =
Component.translatable(Translations.Screen.TUNNEL_BORE_HEAD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class WaterTankSidingScreen extends RailcraftMenuScreen<WaterTankSidingMenu> {

private static final ResourceLocation WIDGETS_TEXTURE_LOCATION =
new ResourceLocation(Railcraft.ID, "textures/gui/container/tank.png");
Railcraft.rl("textures/gui/container/tank.png");

public WaterTankSidingScreen(WaterTankSidingMenu menu, Inventory inventory, Component title) {
super(menu, inventory, title);
Expand Down

0 comments on commit a350f91

Please sign in to comment.