mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-27 07:52:18 +00:00
Don't use ModelResourceLocation class on dedicated server.
Missed this during the merge.
This commit is contained in:
parent
a549400776
commit
ad0080ef32
@ -21,8 +21,10 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class TurtleCraftingTable extends AbstractTurtleUpgrade
|
||||
{
|
||||
private static final ModelResourceLocation leftModel = new ModelResourceLocation( "computercraft:turtle_crafting_table_left", "inventory" );
|
||||
private static final ModelResourceLocation rightModel = new ModelResourceLocation( "computercraft:turtle_crafting_table_right", "inventory" );
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation leftModel;
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation rightModel;
|
||||
|
||||
public TurtleCraftingTable( ResourceLocation id, ItemStack stack )
|
||||
{
|
||||
@ -40,6 +42,17 @@ public class TurtleCraftingTable extends AbstractTurtleUpgrade
|
||||
@Environment( EnvType.CLIENT )
|
||||
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
|
||||
{
|
||||
loadModelLocations();
|
||||
return TransformedModel.of( side == TurtleSide.LEFT ? leftModel : rightModel );
|
||||
}
|
||||
|
||||
@Environment( EnvType.CLIENT )
|
||||
private void loadModelLocations()
|
||||
{
|
||||
if( leftModel == null )
|
||||
{
|
||||
leftModel = new ModelResourceLocation( "computercraft:turtle_crafting_table_left", "inventory" );
|
||||
rightModel = new ModelResourceLocation( "computercraft:turtle_crafting_table_right", "inventory" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,30 +63,19 @@ public class TurtleModem extends AbstractTurtleUpgrade
|
||||
|
||||
private final boolean advanced;
|
||||
|
||||
private final ModelResourceLocation leftOffModel;
|
||||
private final ModelResourceLocation rightOffModel;
|
||||
private final ModelResourceLocation leftOnModel;
|
||||
private final ModelResourceLocation rightOnModel;
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation leftOffModel;
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation rightOffModel;
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation leftOnModel;
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation rightOnModel;
|
||||
|
||||
public TurtleModem( ResourceLocation id, ItemStack stack, boolean advanced )
|
||||
{
|
||||
super( id, TurtleUpgradeType.PERIPHERAL, advanced ? WirelessModemPeripheral.ADVANCED_ADJECTIVE : WirelessModemPeripheral.NORMAL_ADJECTIVE, stack );
|
||||
this.advanced = advanced;
|
||||
|
||||
if( advanced )
|
||||
{
|
||||
leftOffModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_off_left", "inventory" );
|
||||
rightOffModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_off_right", "inventory" );
|
||||
leftOnModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_on_left", "inventory" );
|
||||
rightOnModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_on_right", "inventory" );
|
||||
}
|
||||
else
|
||||
{
|
||||
leftOffModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_off_left", "inventory" );
|
||||
rightOffModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_off_right", "inventory" );
|
||||
leftOnModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_on_left", "inventory" );
|
||||
rightOnModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_on_right", "inventory" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -107,6 +96,8 @@ public class TurtleModem extends AbstractTurtleUpgrade
|
||||
@Environment( EnvType.CLIENT )
|
||||
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
|
||||
{
|
||||
loadModelLocations();
|
||||
|
||||
boolean active = false;
|
||||
if( turtle != null )
|
||||
{
|
||||
@ -119,6 +110,30 @@ public class TurtleModem extends AbstractTurtleUpgrade
|
||||
: TransformedModel.of( active ? rightOnModel : rightOffModel );
|
||||
}
|
||||
|
||||
// This exists separate from the constructor because we can't use the class ModelResourceLocation on the dedicated
|
||||
// server.
|
||||
@Environment( EnvType.CLIENT )
|
||||
private void loadModelLocations()
|
||||
{
|
||||
if( leftOffModel == null )
|
||||
{
|
||||
if( advanced )
|
||||
{
|
||||
leftOffModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_off_left", "inventory" );
|
||||
rightOffModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_off_right", "inventory" );
|
||||
leftOnModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_on_left", "inventory" );
|
||||
rightOnModel = new ModelResourceLocation( "computercraft:turtle_modem_advanced_on_right", "inventory" );
|
||||
}
|
||||
else
|
||||
{
|
||||
leftOffModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_off_left", "inventory" );
|
||||
rightOffModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_off_right", "inventory" );
|
||||
leftOnModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_on_left", "inventory" );
|
||||
rightOnModel = new ModelResourceLocation( "computercraft:turtle_modem_normal_on_right", "inventory" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side )
|
||||
{
|
||||
|
@ -25,8 +25,10 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class TurtleSpeaker extends AbstractTurtleUpgrade
|
||||
{
|
||||
private static final ModelResourceLocation leftModel = new ModelResourceLocation( "computercraft:turtle_speaker_upgrade_left", "inventory" );
|
||||
private static final ModelResourceLocation rightModel = new ModelResourceLocation( "computercraft:turtle_speaker_upgrade_right", "inventory" );
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation leftModel;
|
||||
@Environment( EnvType.CLIENT )
|
||||
private ModelResourceLocation rightModel;
|
||||
|
||||
private static class Peripheral extends UpgradeSpeakerPeripheral
|
||||
{
|
||||
@ -73,9 +75,20 @@ public class TurtleSpeaker extends AbstractTurtleUpgrade
|
||||
@Environment( EnvType.CLIENT )
|
||||
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
|
||||
{
|
||||
loadModelLocations();
|
||||
return TransformedModel.of( side == TurtleSide.LEFT ? leftModel : rightModel );
|
||||
}
|
||||
|
||||
@Environment( EnvType.CLIENT )
|
||||
private void loadModelLocations()
|
||||
{
|
||||
if( leftModel == null )
|
||||
{
|
||||
leftModel = new ModelResourceLocation( "computercraft:turtle_speaker_upgrade_left", "inventory" );
|
||||
rightModel = new ModelResourceLocation( "computercraft:turtle_speaker_upgrade_right", "inventory" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide turtleSide )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user