From 0c9aa168c8d0fe22cb443321790d8f916eb56c6f Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 1 Aug 2018 22:32:41 +0200 Subject: [PATCH] Updated ship scanner rendering to 1.12 --- .../block/TileEntityAbstractBase.java | 7 ----- .../block/building/BlockShipScanner.java | 27 ++++++++++++++++++- .../block/building/TileEntityShipScanner.java | 7 +++-- ...canner.json => ship_scanner.advanced.json} | 6 ++++- .../blockstates/ship_scanner.basic.json | 20 ++++++++++++++ .../blockstates/ship_scanner.superior.json | 20 ++++++++++++++ .../assets/warpdrive/lang/de_de.lang | 4 ++- .../assets/warpdrive/lang/en_us.lang | 4 ++- .../assets/warpdrive/lang/fr_fr.lang | 4 ++- .../assets/warpdrive/lang/nl_nl.lang | 4 ++- .../assets/warpdrive/lang/ru_ru.lang | 4 ++- .../assets/warpdrive/lang/zh_cn.lang | 4 ++- .../assets/warpdrive/lang/zh_tw.lang | 4 ++- 13 files changed, 95 insertions(+), 20 deletions(-) rename src/main/resources/assets/warpdrive/blockstates/{ship_scanner.json => ship_scanner.advanced.json} (83%) create mode 100644 src/main/resources/assets/warpdrive/blockstates/ship_scanner.basic.json create mode 100644 src/main/resources/assets/warpdrive/blockstates/ship_scanner.superior.json diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java index a30df154..e0c577a1 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java @@ -151,13 +151,6 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc } } - @Deprecated - protected void updateMetadata(final int metadata) { - if (getBlockMetadata() != metadata) { - world.setBlockState(pos, getBlockType().getStateFromMeta(metadata), 2); - } - } - @Override public void markDirty() { if ( hasWorld() diff --git a/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java b/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java index f3b624d3..b9194383 100644 --- a/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java +++ b/src/main/java/cr0s/warpdrive/block/building/BlockShipScanner.java @@ -3,6 +3,7 @@ package cr0s.warpdrive.block.building; import cr0s.warpdrive.Commons; import net.minecraft.block.material.Material; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -13,6 +14,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import cr0s.warpdrive.block.BlockAbstractContainer; +import cr0s.warpdrive.data.BlockProperties; import cr0s.warpdrive.data.EnumTier; import javax.annotation.Nonnull; @@ -22,7 +24,30 @@ public class BlockShipScanner extends BlockAbstractContainer { public BlockShipScanner(final String registryName, final EnumTier enumTier) { super(registryName, enumTier, Material.IRON); - setTranslationKey("warpdrive.building.ship_scanner"); + setTranslationKey("warpdrive.building.ship_scanner." + enumTier.getName()); + + setDefaultState(getDefaultState() + .withProperty(BlockProperties.ACTIVE, false) + ); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, BlockProperties.ACTIVE); + } + + @SuppressWarnings("deprecation") + @Nonnull + @Override + public IBlockState getStateFromMeta(final int metadata) { + return getDefaultState() + .withProperty(BlockProperties.ACTIVE, (metadata & 0x8) != 0); + } + + @Override + public int getMetaFromState(final IBlockState blockState) { + return blockState.getValue(BlockProperties.ACTIVE) ? 0x8 : 0; } /* @TODO camouflage diff --git a/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java b/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java index 3033a45d..d889652b 100644 --- a/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java +++ b/src/main/java/cr0s/warpdrive/block/building/TileEntityShipScanner.java @@ -9,6 +9,7 @@ import cr0s.warpdrive.block.movement.BlockShipCore; import cr0s.warpdrive.block.movement.TileEntityShipCore; import cr0s.warpdrive.config.Dictionary; import cr0s.warpdrive.config.WarpDriveConfig; +import cr0s.warpdrive.data.BlockProperties; import cr0s.warpdrive.data.EnumShipScannerState; import cr0s.warpdrive.data.JumpBlock; import cr0s.warpdrive.data.JumpShip; @@ -215,12 +216,10 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements } enumShipScannerState = newState; if (blockCamouflage == null) { - if (getBlockMetadata() == newState.getMetadata()) { - updateMetadata(newState.getMetadata()); - } + updateBlockState(null, BlockProperties.ACTIVE, newState != EnumShipScannerState.IDLE); } else { if (getBlockMetadata() != metadataCamouflage) { - updateMetadata(metadataCamouflage); + world.setBlockState(pos, getBlockType().getStateFromMeta(metadataCamouflage), 2); } } } diff --git a/src/main/resources/assets/warpdrive/blockstates/ship_scanner.json b/src/main/resources/assets/warpdrive/blockstates/ship_scanner.advanced.json similarity index 83% rename from src/main/resources/assets/warpdrive/blockstates/ship_scanner.json rename to src/main/resources/assets/warpdrive/blockstates/ship_scanner.advanced.json index 6fe3c06a..c3f6a57e 100644 --- a/src/main/resources/assets/warpdrive/blockstates/ship_scanner.json +++ b/src/main/resources/assets/warpdrive/blockstates/ship_scanner.advanced.json @@ -11,6 +11,10 @@ }, "variants": { "normal": [{}], - "inventory": [{}] + "inventory": [{}], + "active": { + "false": {}, + "true": {} + } } } \ No newline at end of file diff --git a/src/main/resources/assets/warpdrive/blockstates/ship_scanner.basic.json b/src/main/resources/assets/warpdrive/blockstates/ship_scanner.basic.json new file mode 100644 index 00000000..c3f6a57e --- /dev/null +++ b/src/main/resources/assets/warpdrive/blockstates/ship_scanner.basic.json @@ -0,0 +1,20 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube_bottom_top", + "textures": { + "side" : "warpdrive:blocks/building/ship_scanner-side", + "bottom": "warpdrive:blocks/building/ship_scanner-bottom", + "top" : "warpdrive:blocks/building/ship_scanner-top" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}], + "active": { + "false": {}, + "true": {} + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/warpdrive/blockstates/ship_scanner.superior.json b/src/main/resources/assets/warpdrive/blockstates/ship_scanner.superior.json new file mode 100644 index 00000000..c3f6a57e --- /dev/null +++ b/src/main/resources/assets/warpdrive/blockstates/ship_scanner.superior.json @@ -0,0 +1,20 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube_bottom_top", + "textures": { + "side" : "warpdrive:blocks/building/ship_scanner-side", + "bottom": "warpdrive:blocks/building/ship_scanner-bottom", + "top" : "warpdrive:blocks/building/ship_scanner-top" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}], + "active": { + "false": {}, + "true": {} + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/warpdrive/lang/de_de.lang b/src/main/resources/assets/warpdrive/lang/de_de.lang index 34bea6be..d699deb7 100644 --- a/src/main/resources/assets/warpdrive/lang/de_de.lang +++ b/src/main/resources/assets/warpdrive/lang/de_de.lang @@ -247,7 +247,9 @@ tile.warpdrive.breathing.air_generator.advanced.name=Weiterentwickeltes Luftgene tile.warpdrive.breathing.air_generator.superior.name=Überlegenes Luftgenerator tile.warpdrive.breathing.air_shield.name=Energie-Luftschild -tile.warpdrive.building.ship_scanner.name=Raumschiff Scanner +tile.warpdrive.building.ship_scanner.basic.name=Shuttle Raumschiff Scanner +tile.warpdrive.building.ship_scanner.advanced.name=Corvette Raumschiff Scanner +tile.warpdrive.building.ship_scanner.superior.name=Frigate Raumschiff Scanner tile.warpdrive.collection.laser_tree_farm.name=Laser Baumfarm tile.warpdrive.collection.mining_laser.name=Bergbau Laser diff --git a/src/main/resources/assets/warpdrive/lang/en_us.lang b/src/main/resources/assets/warpdrive/lang/en_us.lang index c41c183a..71ef67a0 100644 --- a/src/main/resources/assets/warpdrive/lang/en_us.lang +++ b/src/main/resources/assets/warpdrive/lang/en_us.lang @@ -244,7 +244,9 @@ tile.warpdrive.breathing.air_generator.advanced.name=Advanced Air Generator tile.warpdrive.breathing.air_generator.superior.name=Superior Air Generator tile.warpdrive.breathing.air_shield.name=Energy Air Shield -tile.warpdrive.building.ship_scanner.name=Ship Scanner +tile.warpdrive.building.ship_scanner.basic.name=Shuttle Ship Scanner +tile.warpdrive.building.ship_scanner.advanced.name=Corvette Ship Scanner +tile.warpdrive.building.ship_scanner.superior.name=Frigate Ship Scanner tile.warpdrive.collection.laser_tree_farm.name=Laser Tree Farm tile.warpdrive.collection.mining_laser.name=Mining Laser diff --git a/src/main/resources/assets/warpdrive/lang/fr_fr.lang b/src/main/resources/assets/warpdrive/lang/fr_fr.lang index 15655b1a..4501fa20 100644 --- a/src/main/resources/assets/warpdrive/lang/fr_fr.lang +++ b/src/main/resources/assets/warpdrive/lang/fr_fr.lang @@ -245,7 +245,9 @@ tile.warpdrive.breathing.air_generator.advanced.name=Générateur d'air avancé tile.warpdrive.breathing.air_generator.superior.name=Générateur d'air supérieur tile.warpdrive.breathing.air_shield.name=Bouclier d'air d'énergie -tile.warpdrive.building.ship_scanner.name=Scanneur de vaisseau +tile.warpdrive.building.ship_scanner.basic.name=Scanneur de vaisseau navette +tile.warpdrive.building.ship_scanner.advanced.name=Scanneur de vaisseau corvette +tile.warpdrive.building.ship_scanner.superior.name=Scanneur de vaisseau frégate tile.warpdrive.collection.laser_tree_farm.name=Laser de plantation arboricole tile.warpdrive.collection.mining_laser.name=Laser d'exploitation minière diff --git a/src/main/resources/assets/warpdrive/lang/nl_nl.lang b/src/main/resources/assets/warpdrive/lang/nl_nl.lang index 38be6e70..7d478ba8 100644 --- a/src/main/resources/assets/warpdrive/lang/nl_nl.lang +++ b/src/main/resources/assets/warpdrive/lang/nl_nl.lang @@ -245,7 +245,9 @@ tile.warpdrive.breathing.air_generator.advanced.name=Geavanceerde zuurstofgenera tile.warpdrive.breathing.air_generator.superior.name=Superieure zuurstof tile.warpdrive.breathing.air_shield.name=Energie-gebaseerd Luchtschild -tile.warpdrive.building.ship_scanner.name=Schip Scanner +tile.warpdrive.building.ship_scanner.basic.name=Shuttle Schip Scanner +tile.warpdrive.building.ship_scanner.advanced.name=Corvette Schip Scanner +tile.warpdrive.building.ship_scanner.superior.name=Frigate Schip Scanner tile.warpdrive.collection.laser_tree_farm.name=Laser-boomboerderij tile.warpdrive.collection.mining_laser.name=Mijnlaser diff --git a/src/main/resources/assets/warpdrive/lang/ru_ru.lang b/src/main/resources/assets/warpdrive/lang/ru_ru.lang index 639618da..fa787193 100644 --- a/src/main/resources/assets/warpdrive/lang/ru_ru.lang +++ b/src/main/resources/assets/warpdrive/lang/ru_ru.lang @@ -245,7 +245,9 @@ tile.warpdrive.breathing.air_generator.advanced.name=Advanced Генератор tile.warpdrive.breathing.air_generator.superior.name=Superior Генератор воздуха tile.warpdrive.breathing.air_shield.name=Energy Air Shield -tile.warpdrive.building.ship_scanner.name=Сканер кораблей +tile.warpdrive.building.ship_scanner.basic.name=Shuttle Сканер кораблей +tile.warpdrive.building.ship_scanner.advanced.name=Corvette Сканер кораблей +tile.warpdrive.building.ship_scanner.superior.name=Frigate Сканер кораблей tile.warpdrive.collection.laser_tree_farm.name=Лазерная ферма деревьев tile.warpdrive.collection.mining_laser.name=Лазерная буровая установка diff --git a/src/main/resources/assets/warpdrive/lang/zh_cn.lang b/src/main/resources/assets/warpdrive/lang/zh_cn.lang index 4c3eefd8..9aa96eb5 100644 --- a/src/main/resources/assets/warpdrive/lang/zh_cn.lang +++ b/src/main/resources/assets/warpdrive/lang/zh_cn.lang @@ -245,7 +245,9 @@ tile.warpdrive.breathing.air_generator.advanced.name=先进空气供给机 tile.warpdrive.breathing.air_generator.superior.name=卓越空气供给机 tile.warpdrive.breathing.air_shield.name=能量空气护罩 -tile.warpdrive.building.ship_scanner.name=船体扫描仪 +tile.warpdrive.building.ship_scanner.basic.name=Shuttle 船体扫描仪 +tile.warpdrive.building.ship_scanner.advanced.name=Corvette 船体扫描仪 +tile.warpdrive.building.ship_scanner.superior.name=Frigate 船体扫描仪 tile.warpdrive.collection.laser_tree_farm.name=激光林场 tile.warpdrive.collection.mining_laser.name=采掘激光 diff --git a/src/main/resources/assets/warpdrive/lang/zh_tw.lang b/src/main/resources/assets/warpdrive/lang/zh_tw.lang index cf61c351..b1871d79 100644 --- a/src/main/resources/assets/warpdrive/lang/zh_tw.lang +++ b/src/main/resources/assets/warpdrive/lang/zh_tw.lang @@ -245,7 +245,9 @@ tile.warpdrive.breathing.air_generator.advanced.name=Advanced Air Generator / tile.warpdrive.breathing.air_generator.superior.name=Superior Air Generator / 空氣發生器 tile.warpdrive.breathing.air_shield.name=Energy Air Shield -tile.warpdrive.building.ship_scanner.name=船隻掃描儀 +tile.warpdrive.building.ship_scanner.basic.name=Shuttle 船隻掃描儀 +tile.warpdrive.building.ship_scanner.advanced.name=Corvette 船隻掃描儀 +tile.warpdrive.building.ship_scanner.superior.name=Frigate 船隻掃描儀 tile.warpdrive.collection.laser_tree_farm.name=激光樹農場 tile.warpdrive.collection.mining_laser.name=采礦鐳射