mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-12 11:10:29 +00:00
Derive upgrade adjectives from its ID
This is done in 1.13+ for items and blocks, so we might as well do it for upgrades now. Note we can't do it for ender pocket modems, as the upgrade ID is spelled incorrectly there.
This commit is contained in:
parent
61daab910e
commit
a838595e1e
@ -299,29 +299,29 @@ public final class Registry
|
|||||||
ComputerCraft.TurtleUpgrades.wirelessModem = new TurtleModem( false, new ResourceLocation( "computercraft", "wireless_modem" ), 1 );
|
ComputerCraft.TurtleUpgrades.wirelessModem = new TurtleModem( false, new ResourceLocation( "computercraft", "wireless_modem" ), 1 );
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.wirelessModem );
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.wirelessModem );
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.craftingTable = new TurtleCraftingTable( 2 );
|
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.craftingTable );
|
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.diamondSword = new TurtleSword( new ResourceLocation( "minecraft", "diamond_sword" ), 3, "upgrade.minecraft:diamond_sword.adjective", Items.DIAMOND_SWORD );
|
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondSword );
|
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.diamondShovel = new TurtleShovel( new ResourceLocation( "minecraft", "diamond_shovel" ), 4, "upgrade.minecraft:diamond_shovel.adjective", Items.DIAMOND_SHOVEL );
|
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondShovel );
|
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.diamondPickaxe = new TurtleTool( new ResourceLocation( "minecraft", "diamond_pickaxe" ), 5, "upgrade.minecraft:diamond_pickaxe.adjective", Items.DIAMOND_PICKAXE );
|
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondPickaxe );
|
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.diamondAxe = new TurtleAxe( new ResourceLocation( "minecraft", "diamond_axe" ), 6, "upgrade.minecraft:diamond_axe.adjective", Items.DIAMOND_AXE );
|
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondAxe );
|
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.diamondHoe = new TurtleHoe( new ResourceLocation( "minecraft", "diamond_hoe" ), 7, "upgrade.minecraft:diamond_hoe.adjective", Items.DIAMOND_HOE );
|
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondHoe );
|
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.advancedModem = new TurtleModem( true, new ResourceLocation( "computercraft", "advanced_modem" ), -1 );
|
ComputerCraft.TurtleUpgrades.advancedModem = new TurtleModem( true, new ResourceLocation( "computercraft", "advanced_modem" ), -1 );
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.advancedModem );
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.advancedModem );
|
||||||
|
|
||||||
ComputerCraft.TurtleUpgrades.speaker = new TurtleSpeaker( new ResourceLocation( "computercraft", "speaker" ), 8 );
|
ComputerCraft.TurtleUpgrades.speaker = new TurtleSpeaker( new ResourceLocation( "computercraft", "speaker" ), 8 );
|
||||||
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.speaker );
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.speaker );
|
||||||
|
|
||||||
|
ComputerCraft.TurtleUpgrades.craftingTable = new TurtleCraftingTable( new ResourceLocation( "minecraft", "crafting_table" ), 2 );
|
||||||
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.craftingTable );
|
||||||
|
|
||||||
|
ComputerCraft.TurtleUpgrades.diamondSword = new TurtleSword( new ResourceLocation( "minecraft", "diamond_sword" ), 3, Items.DIAMOND_SWORD );
|
||||||
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondSword );
|
||||||
|
|
||||||
|
ComputerCraft.TurtleUpgrades.diamondShovel = new TurtleShovel( new ResourceLocation( "minecraft", "diamond_shovel" ), 4, Items.DIAMOND_SHOVEL );
|
||||||
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondShovel );
|
||||||
|
|
||||||
|
ComputerCraft.TurtleUpgrades.diamondPickaxe = new TurtleTool( new ResourceLocation( "minecraft", "diamond_pickaxe" ), 5, Items.DIAMOND_PICKAXE );
|
||||||
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondPickaxe );
|
||||||
|
|
||||||
|
ComputerCraft.TurtleUpgrades.diamondAxe = new TurtleAxe( new ResourceLocation( "minecraft", "diamond_axe" ), 6, Items.DIAMOND_AXE );
|
||||||
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondAxe );
|
||||||
|
|
||||||
|
ComputerCraft.TurtleUpgrades.diamondHoe = new TurtleHoe( new ResourceLocation( "minecraft", "diamond_hoe" ), 7, Items.DIAMOND_HOE );
|
||||||
|
TurtleUpgrades.registerInternal( ComputerCraft.TurtleUpgrades.diamondHoe );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerPocketUpgrades()
|
public static void registerPocketUpgrades()
|
||||||
|
@ -25,6 +25,11 @@ public abstract class AbstractPocketUpgrade implements IPocketUpgrade
|
|||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected AbstractPocketUpgrade( ResourceLocation id, ItemStack stack )
|
||||||
|
{
|
||||||
|
this( id, "upgrade." + id + ".adjective", stack );
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public final ResourceLocation getUpgradeID()
|
public final ResourceLocation getUpgradeID()
|
||||||
|
@ -23,7 +23,6 @@ public class PocketSpeaker extends AbstractPocketUpgrade
|
|||||||
{
|
{
|
||||||
super(
|
super(
|
||||||
new ResourceLocation( "computercraft", "speaker" ),
|
new ResourceLocation( "computercraft", "speaker" ),
|
||||||
"upgrade.computercraft:speaker.adjective",
|
|
||||||
PeripheralItemFactory.create( PeripheralType.Speaker, null, 1 )
|
PeripheralItemFactory.create( PeripheralType.Speaker, null, 1 )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,10 @@ public abstract class ItemTurtleBase extends ItemComputerBase implements ITurtle
|
|||||||
if( !isInCreativeTab( tabs ) ) return;
|
if( !isInCreativeTab( tabs ) ) return;
|
||||||
|
|
||||||
ComputerFamily family = getFamily();
|
ComputerFamily family = getFamily();
|
||||||
|
|
||||||
|
ItemStack normalStack = TurtleItemFactory.create( -1, null, -1, family, null, null, 0, null );
|
||||||
|
if( !normalStack.isEmpty() && normalStack.getItem() == this ) list.add( normalStack );
|
||||||
|
|
||||||
for( ITurtleUpgrade upgrade : TurtleUpgrades.getVanillaUpgrades() )
|
for( ITurtleUpgrade upgrade : TurtleUpgrades.getVanillaUpgrades() )
|
||||||
{
|
{
|
||||||
if( !TurtleUpgrades.suitableForFamily( family, upgrade ) ) continue;
|
if( !TurtleUpgrades.suitableForFamily( family, upgrade ) ) continue;
|
||||||
|
@ -42,6 +42,21 @@ public abstract class AbstractTurtleUpgrade implements ITurtleUpgrade
|
|||||||
this( id, legacyId, type, adjective, new ItemStack( block ) );
|
this( id, legacyId, type, adjective, new ItemStack( block ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, ItemStack stack )
|
||||||
|
{
|
||||||
|
this( id, legacyId, type, "upgrade." + id + ".adjective", stack );
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, Item item )
|
||||||
|
{
|
||||||
|
this( id, legacyId, type, new ItemStack( item ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, Block block )
|
||||||
|
{
|
||||||
|
this( id, legacyId, type, new ItemStack( block ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public final ResourceLocation getUpgradeID()
|
public final ResourceLocation getUpgradeID()
|
||||||
|
@ -16,6 +16,11 @@ public class TurtleAxe extends TurtleTool
|
|||||||
super( id, legacyId, adjective, item );
|
super( id, legacyId, adjective, item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TurtleAxe( ResourceLocation id, int legacyId, Item item )
|
||||||
|
{
|
||||||
|
super( id, legacyId, item );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getDamageMultiplier()
|
protected float getDamageMultiplier()
|
||||||
{
|
{
|
||||||
|
@ -31,12 +31,9 @@ public class TurtleCraftingTable extends AbstractTurtleUpgrade
|
|||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
private ModelResourceLocation m_rightModel;
|
private ModelResourceLocation m_rightModel;
|
||||||
|
|
||||||
public TurtleCraftingTable( int legacyId )
|
public TurtleCraftingTable( ResourceLocation id, int legacyId )
|
||||||
{
|
{
|
||||||
super(
|
super( id, legacyId, TurtleUpgradeType.Peripheral, Blocks.CRAFTING_TABLE );
|
||||||
new ResourceLocation( "minecraft", "crafting_table" ), legacyId, TurtleUpgradeType.Peripheral,
|
|
||||||
"upgrade.minecraft:crafting_table.adjective", Blocks.CRAFTING_TABLE
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,6 +30,11 @@ public class TurtleHoe extends TurtleTool
|
|||||||
super( id, legacyId, adjective, item );
|
super( id, legacyId, adjective, item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TurtleHoe( ResourceLocation id, int legacyId, Item item )
|
||||||
|
{
|
||||||
|
super( id, legacyId, item );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canBreakBlock( IBlockState state, World world, BlockPos pos, TurtlePlayer player )
|
protected boolean canBreakBlock( IBlockState state, World world, BlockPos pos, TurtlePlayer player )
|
||||||
{
|
{
|
||||||
|
@ -85,9 +85,7 @@ public class TurtleModem extends AbstractTurtleUpgrade
|
|||||||
{
|
{
|
||||||
super(
|
super(
|
||||||
id, legacyId, TurtleUpgradeType.Peripheral,
|
id, legacyId, TurtleUpgradeType.Peripheral,
|
||||||
advanced ? "upgrade.computercraft:advanced_modem.adjective" : "upgrade.computercraft:wireless_modem.adjective",
|
|
||||||
advanced ? PeripheralItemFactory.create( PeripheralType.AdvancedModem, null, 1 ) : PeripheralItemFactory.create( PeripheralType.WirelessModem, null, 1 )
|
advanced ? PeripheralItemFactory.create( PeripheralType.AdvancedModem, null, 1 ) : PeripheralItemFactory.create( PeripheralType.WirelessModem, null, 1 )
|
||||||
|
|
||||||
);
|
);
|
||||||
this.advanced = advanced;
|
this.advanced = advanced;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,11 @@ public class TurtleShovel extends TurtleTool
|
|||||||
super( id, legacyId, adjective, item );
|
super( id, legacyId, adjective, item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TurtleShovel( ResourceLocation id, int legacyId, Item item )
|
||||||
|
{
|
||||||
|
super( id, legacyId, item );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canBreakBlock( IBlockState state, World world, BlockPos pos, TurtlePlayer player )
|
protected boolean canBreakBlock( IBlockState state, World world, BlockPos pos, TurtlePlayer player )
|
||||||
{
|
{
|
||||||
|
@ -69,8 +69,8 @@ public class TurtleSpeaker extends AbstractTurtleUpgrade
|
|||||||
|
|
||||||
public TurtleSpeaker( ResourceLocation id, int legacyId )
|
public TurtleSpeaker( ResourceLocation id, int legacyId )
|
||||||
{
|
{
|
||||||
super( id, legacyId, TurtleUpgradeType.Peripheral,
|
super(
|
||||||
"upgrade.computercraft:speaker.adjective",
|
id, legacyId, TurtleUpgradeType.Peripheral,
|
||||||
PeripheralItemFactory.create( PeripheralType.Speaker, null, 1 )
|
PeripheralItemFactory.create( PeripheralType.Speaker, null, 1 )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,11 @@ public class TurtleSword extends TurtleTool
|
|||||||
super( id, legacyId, adjective, item );
|
super( id, legacyId, adjective, item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TurtleSword( ResourceLocation id, int legacyId, Item item )
|
||||||
|
{
|
||||||
|
super( id, legacyId, item );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canBreakBlock( IBlockState state, World world, BlockPos pos, TurtlePlayer player )
|
protected boolean canBreakBlock( IBlockState state, World world, BlockPos pos, TurtlePlayer player )
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,12 @@ public class TurtleTool extends AbstractTurtleUpgrade
|
|||||||
m_item = new ItemStack( item, 1, 0 );
|
m_item = new ItemStack( item, 1, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TurtleTool( ResourceLocation id, int legacyID, Item item )
|
||||||
|
{
|
||||||
|
super( id, legacyID, TurtleUpgradeType.Tool, item );
|
||||||
|
m_item = new ItemStack( item, 1, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
|
Loading…
Reference in New Issue
Block a user