diff --git a/src/main/java/appeng/core/api/definitions/ApiParts.java b/src/main/java/appeng/core/api/definitions/ApiParts.java index f6a2dbd7a..589f1fb57 100644 --- a/src/main/java/appeng/core/api/definitions/ApiParts.java +++ b/src/main/java/appeng/core/api/definitions/ApiParts.java @@ -114,7 +114,7 @@ public final class ApiParts implements IParts this.toggleBus = new DamagedItemDefinition( "part.toggle_bus", itemPart.createPart( PartType.TOGGLE_BUS ) ); this.invertedToggleBus = new DamagedItemDefinition( "part.toggle_bus.inverted", itemPart.createPart( PartType.INVERTED_TOGGLE_BUS ) ); this.storageBus = new DamagedItemDefinition( "part.bus.storage", itemPart.createPart( PartType.STORAGE_BUS ) ); - this.oreDictStorageBus = new DamagedItemDefinition( "part.bus.ore_dict_storage", itemPart.createPart( PartType.ORE_DICT_STORAGE_BUS ) ); + this.oreDictStorageBus = new DamagedItemDefinition( "part.bus.oredict_storage", itemPart.createPart( PartType.OREDICT_STORAGE_BUS ) ); this.importBus = new DamagedItemDefinition( "part.bus.import", itemPart.createPart( PartType.IMPORT_BUS ) ); this.exportBus = new DamagedItemDefinition( "part.bus.export", itemPart.createPart( PartType.EXPORT_BUS ) ); this.iface = new DamagedItemDefinition( "part.interface", itemPart.createPart( PartType.INTERFACE ) ); diff --git a/src/main/java/appeng/items/parts/PartType.java b/src/main/java/appeng/items/parts/PartType.java index 4ef2d17e0..9ad72f56d 100644 --- a/src/main/java/appeng/items/parts/PartType.java +++ b/src/main/java/appeng/items/parts/PartType.java @@ -187,7 +187,7 @@ public enum PartType STORAGE_BUS( 220, "storage_bus", EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ), FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidStorageBus.class ), - ORE_DICT_STORAGE_BUS( 222, "ore_dict_storage_bus", EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartOreDicStorageBus.class ), + OREDICT_STORAGE_BUS( 222, "oredict_storage_bus", EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartOreDicStorageBus.class ), IMPORT_BUS( 240, "import_bus", EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ), diff --git a/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java b/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java index 4726ec8fb..a528eedd3 100644 --- a/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java +++ b/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java @@ -5,14 +5,18 @@ import appeng.api.config.*; import appeng.api.networking.storage.IBaseMonitor; import appeng.api.networking.storage.IStorageGrid; import appeng.api.networking.ticking.ITickManager; +import appeng.api.parts.IPartModel; import appeng.api.storage.IMEInventory; import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.storage.data.IAEItemStack; +import appeng.core.AppEng; import appeng.core.sync.GuiBridge; +import appeng.items.parts.PartModels; import appeng.me.GridAccessException; import appeng.me.cache.GridStorageCache; import appeng.me.storage.ITickingMonitor; import appeng.me.storage.MEInventoryHandler; +import appeng.parts.PartModel; import appeng.util.ConfigManager; import appeng.util.Platform; import appeng.util.item.OreHelper; @@ -22,11 +26,21 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; public class PartOreDicStorageBus extends PartStorageBus { + public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/oredict_storage_bus_base" ); + @PartModels + public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_off" ) ); + @PartModels + public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_on" ) ); + @PartModels + public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_has_channel" ) ); + + public String oreMatch; OreDictPriorityList priorityList; @@ -35,6 +49,21 @@ public class PartOreDicStorageBus extends PartStorageBus super( is ); } + @Override + public void readFromNBT( NBTTagCompound data ) + { + super.readFromNBT( data ); + this.oreMatch = data.getString( "oreMatch" ); + this.priorityList = new OreDictPriorityList<>( OreHelper.INSTANCE.getMatchingOre( oreMatch ), oreMatch ); + } + + @Override + public void writeToNBT( NBTTagCompound data ) + { + super.writeToNBT( data ); + data.setString( "oreMatch", oreMatch ); + } + @Override public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos ) { @@ -167,17 +196,20 @@ public class PartOreDicStorageBus extends PartStorageBus } @Override - public void readFromNBT( NBTTagCompound data ) + public IPartModel getStaticModels() { - super.readFromNBT( data ); - this.oreMatch = data.getString( "oreMatch" ); - this.priorityList = new OreDictPriorityList<>( OreHelper.INSTANCE.getMatchingOre( oreMatch ), oreMatch ); + if( this.isActive() && this.isPowered() ) + { + return MODELS_HAS_CHANNEL; + } + else if( this.isPowered() ) + { + return MODELS_ON; + } + else + { + return MODELS_OFF; + } } - @Override - public void writeToNBT( NBTTagCompound data ) - { - super.writeToNBT( data ); - data.setString( "oreMatch", oreMatch ); - } } diff --git a/src/main/resources/assets/appliedenergistics2/lang/en_us.lang b/src/main/resources/assets/appliedenergistics2/lang/en_us.lang index f787ef652..eb4f02201 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/en_us.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/en_us.lang @@ -539,6 +539,7 @@ item.appliedenergistics2.multi_part.pattern_terminal.name=ME Pattern Terminal item.appliedenergistics2.multi_part.expanded_processing_pattern_terminal.name=ME Extended Processing Pattern Terminal item.appliedenergistics2.multi_part.quartz_fiber.name=Quartz Fiber item.appliedenergistics2.multi_part.storage_bus.name=ME Storage Bus +item.appliedenergistics2.multi_part.oredict_storage_bus.name=ME OreDict Storage Bus item.appliedenergistics2.multi_part.fluid_storage_bus.name=ME Fluid Storage Bus item.appliedenergistics2.multi_part.terminal.name=ME Terminal item.appliedenergistics2.multi_part.inverted_toggle_bus.name=ME Inverted Toggle Bus diff --git a/src/main/resources/assets/appliedenergistics2/models/item/part/oredict_storage_bus.json b/src/main/resources/assets/appliedenergistics2/models/item/part/oredict_storage_bus.json new file mode 100644 index 000000000..80d1dd036 --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/models/item/part/oredict_storage_bus.json @@ -0,0 +1,106 @@ +{ + "parent": "appliedenergistics2:item/part/part", + "textures": { + "sides": "appliedenergistics2:parts/storage_bus_sides", + "back": "appliedenergistics2:parts/storage_bus_back", + "front": "appliedenergistics2:items/part/oredict_storage_bus" + }, + "elements": [ + { + "from": [ + 3, + 3, + 6 + ], + "to": [ + 13, + 13, + 7 + ], + "faces": { + "north": { + "texture": "#front" + }, + "south": { + "texture": "#back" + }, + "east": { + "texture": "#sides" + }, + "west": { + "texture": "#sides" + }, + "up": { + "texture": "#sides" + }, + "down": { + "texture": "#sides" + } + } + }, + { + "from": [ + 2, + 2, + 7 + ], + "to": [ + 14, + 14, + 8 + ], + "faces": { + "north": { + "texture": "#front" + }, + "south": { + "texture": "#back" + }, + "east": { + "texture": "#sides" + }, + "west": { + "texture": "#sides" + }, + "up": { + "texture": "#sides" + }, + "down": { + "texture": "#sides" + } + } + }, + { + "from": [ + 5, + 5, + 8 + ], + "to": [ + 11, + 11, + 10 + ], + "faces": { + "north": { + "texture": "#front" + }, + "south": { + "texture": "#back" + }, + "east": { + "texture": "#sides" + }, + "west": { + "texture": "#sides" + }, + "up": { + "texture": "#sides" + }, + "down": { + "texture": "#sides" + } + } + } + ] +} diff --git a/src/main/resources/assets/appliedenergistics2/models/part/oredict_storage_bus_base.json b/src/main/resources/assets/appliedenergistics2/models/part/oredict_storage_bus_base.json new file mode 100644 index 000000000..d425de5fd --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/models/part/oredict_storage_bus_base.json @@ -0,0 +1,130 @@ +{ + "textures": { + "sides": "appliedenergistics2:parts/storage_bus_sides", + "sidesStatus": "appliedenergistics2:parts/monitor_sides_status", + "back": "appliedenergistics2:parts/storage_bus_back", + "front": "appliedenergistics2:items/part/oredict_storage_bus", + "particle": "appliedenergistics2:parts/storage_bus_back" + }, + "elements": [ + { + "from": [ + 3, + 3, + 0 + ], + "to": [ + 13, + 13, + 1 + ], + "faces": { + "down": { + "texture": "#sides" + }, + "up": { + "texture": "#sides" + }, + "south": { + "texture": "#back" + }, + "east": { + "texture": "#sides" + }, + "north": { + "texture": "#front" + }, + "west": { + "texture": "#sides" + } + } + }, + { + "from": [ + 2, + 2, + 1 + ], + "to": [ + 14, + 14, + 2 + ], + "faces": { + "down": { + "texture": "#sides" + }, + "up": { + "texture": "#sides" + }, + "south": { + "texture": "#back" + }, + "east": { + "texture": "#sides" + }, + "north": { + "texture": "#front" + }, + "west": { + "texture": "#sides" + } + } + }, + { + "from": [ + 5, + 5, + 3 + ], + "to": [ + 11, + 11, + 4 + ], + "faces": { + "down": { + "texture": "#sides" + }, + "up": { + "texture": "#sides" + }, + "south": { + "texture": "#back" + }, + "east": { + "texture": "#sides" + }, + "west": { + "texture": "#sides" + } + } + }, + { + "from": [ + 5, + 5, + 2 + ], + "to": [ + 11, + 11, + 3 + ], + "faces": { + "down": { + "texture": "#sides" + }, + "up": { + "texture": "#sides" + }, + "east": { + "texture": "#sides" + }, + "west": { + "texture": "#sides" + } + } + } + ] +} diff --git a/src/main/resources/assets/appliedenergistics2/textures/items/part/oredict_storage_bus.png b/src/main/resources/assets/appliedenergistics2/textures/items/part/oredict_storage_bus.png new file mode 100644 index 000000000..ba24c0448 Binary files /dev/null and b/src/main/resources/assets/appliedenergistics2/textures/items/part/oredict_storage_bus.png differ