From 99c733e96a0a48141f67b9b9c4da466f0e718769 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Tue, 27 Jul 2021 00:49:42 -0400 Subject: [PATCH] - Restore concealment key - Restore void icon to front of drawer --- gradle.properties | 2 +- .../storagedrawers/block/BlockController.java | 10 ++-- .../client/model/BasicDrawerModel.java | 49 +++++++++++++++--- .../storagedrawers/core/ModItems.java | 4 +- .../storagedrawers/item/ItemShroudKey.java | 12 ++--- .../models/block/full_drawers_shroud.json | 13 +++++ .../models/block/full_drawers_void.json | 13 +++++ .../models/block/half_drawers_shroud.json | 13 +++++ .../models/block/half_drawers_void.json | 13 +++++ .../textures/blocks/indicator/shroud_icon.png | Bin 0 -> 676 bytes 10 files changed, 107 insertions(+), 22 deletions(-) create mode 100644 src/main/resources/assets/storagedrawers/models/block/full_drawers_shroud.json create mode 100644 src/main/resources/assets/storagedrawers/models/block/full_drawers_void.json create mode 100644 src/main/resources/assets/storagedrawers/models/block/half_drawers_shroud.json create mode 100644 src/main/resources/assets/storagedrawers/models/block/half_drawers_void.json create mode 100644 src/main/resources/assets/storagedrawers/textures/blocks/indicator/shroud_icon.png diff --git a/gradle.properties b/gradle.properties index 640cbda04..8a42b918c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ minecraft_version=1.16.3 forge_version=34.1.22 forge_mappings=20200916-1.16.2 loader_version=34 -mod_version=8.2.2 +mod_version=8.3.0 # Mod dependency versions jei_version=7.3.2.36 diff --git a/src/main/java/com/jaquadro/minecraft/storagedrawers/block/BlockController.java b/src/main/java/com/jaquadro/minecraft/storagedrawers/block/BlockController.java index 0b58058e2..b4d921887 100644 --- a/src/main/java/com/jaquadro/minecraft/storagedrawers/block/BlockController.java +++ b/src/main/java/com/jaquadro/minecraft/storagedrawers/block/BlockController.java @@ -71,8 +71,8 @@ public boolean toggle (World world, BlockPos pos, PlayerEntity player, Item item if (item == ModItems.DRAWER_KEY) toggle(world, pos, player, EnumKeyType.DRAWER); - //else if (item == ModItems.shroudKey) - // toggle(world, pos, player, EnumKeyType.CONCEALMENT); + else if (item == ModItems.SHROUD_KEY) + toggle(world, pos, player, EnumKeyType.CONCEALMENT); else if (item == ModItems.QUANTIFY_KEY) toggle(world, pos, player, EnumKeyType.QUANTIFY); //else if (item == ModItems.personalKey) @@ -95,9 +95,9 @@ public void toggle (World world, BlockPos pos, PlayerEntity player, EnumKeyType case DRAWER: te.toggleLock(EnumSet.allOf(LockAttribute.class), LockAttribute.LOCK_POPULATED, player.getGameProfile()); break; - //case CONCEALMENT: - // te.toggleShroud(player.getGameProfile()); - // break; + case CONCEALMENT: + te.toggleShroud(player.getGameProfile()); + break; case QUANTIFY: te.toggleQuantified(player.getGameProfile()); break; diff --git a/src/main/java/com/jaquadro/minecraft/storagedrawers/client/model/BasicDrawerModel.java b/src/main/java/com/jaquadro/minecraft/storagedrawers/client/model/BasicDrawerModel.java index 58e3d450f..a0e8e4d0d 100644 --- a/src/main/java/com/jaquadro/minecraft/storagedrawers/client/model/BasicDrawerModel.java +++ b/src/main/java/com/jaquadro/minecraft/storagedrawers/client/model/BasicDrawerModel.java @@ -46,6 +46,10 @@ public final class BasicDrawerModel { private static final Map lockOverlaysFull = new HashMap<>(); private static final Map lockOverlaysHalf = new HashMap<>(); + private static final Map voidOverlaysFull = new HashMap<>(); + private static final Map voidOverlaysHalf = new HashMap<>(); + private static final Map shroudOverlaysFull = new HashMap<>(); + private static final Map shroudOverlaysHalf = new HashMap<>(); private static boolean geometryDataLoaded = false; @@ -62,17 +66,22 @@ public static void registerTextures (TextureStitchEvent.Pre event) { return; } - BlockModel unbakedModel = getBlockModel(new ResourceLocation(StorageDrawers.MOD_ID, "models/block/full_drawers_lock.json")); + loadUnbakedModel(event, new ResourceLocation(StorageDrawers.MOD_ID, "models/block/full_drawers_lock.json")); + loadUnbakedModel(event, new ResourceLocation(StorageDrawers.MOD_ID, "models/block/full_drawers_void.json")); + loadUnbakedModel(event, new ResourceLocation(StorageDrawers.MOD_ID, "models/block/full_drawers_shroud.json")); + + loadGeometryData(); + } + + private static void loadUnbakedModel(TextureStitchEvent.Pre event, ResourceLocation resource) { + BlockModel unbakedModel = getBlockModel(resource); for (Either x : unbakedModel.textures.values()) { x.ifLeft((value) -> { if (value.getAtlasLocation().equals(event.getMap().getTextureLocation())) event.addSprite(value.getTextureLocation()); }); - // x.ifRight((value) -> event.addSprite(new ResourceLocation(value))); } - - loadGeometryData(); } private static void loadGeometryData () { @@ -181,6 +190,24 @@ public static void registerModels (ModelBakeEvent event) { lockOverlaysHalf.put(Direction.SOUTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_lock"), ModelRotation.X0_Y180, ModelLoader.defaultTextureGetter())); lockOverlaysHalf.put(Direction.WEST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_lock"), ModelRotation.X0_Y270, ModelLoader.defaultTextureGetter())); + voidOverlaysFull.put(Direction.NORTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_void"), ModelRotation.X0_Y0, ModelLoader.defaultTextureGetter())); + voidOverlaysFull.put(Direction.EAST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_void"), ModelRotation.X0_Y90, ModelLoader.defaultTextureGetter())); + voidOverlaysFull.put(Direction.SOUTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_void"), ModelRotation.X0_Y180, ModelLoader.defaultTextureGetter())); + voidOverlaysFull.put(Direction.WEST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_void"), ModelRotation.X0_Y270, ModelLoader.defaultTextureGetter())); + voidOverlaysHalf.put(Direction.NORTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_void"), ModelRotation.X0_Y0, ModelLoader.defaultTextureGetter())); + voidOverlaysHalf.put(Direction.EAST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_void"), ModelRotation.X0_Y90, ModelLoader.defaultTextureGetter())); + voidOverlaysHalf.put(Direction.SOUTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_void"), ModelRotation.X0_Y180, ModelLoader.defaultTextureGetter())); + voidOverlaysHalf.put(Direction.WEST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_void"), ModelRotation.X0_Y270, ModelLoader.defaultTextureGetter())); + + shroudOverlaysFull.put(Direction.NORTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_shroud"), ModelRotation.X0_Y0, ModelLoader.defaultTextureGetter())); + shroudOverlaysFull.put(Direction.EAST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_shroud"), ModelRotation.X0_Y90, ModelLoader.defaultTextureGetter())); + shroudOverlaysFull.put(Direction.SOUTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_shroud"), ModelRotation.X0_Y180, ModelLoader.defaultTextureGetter())); + shroudOverlaysFull.put(Direction.WEST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/full_drawers_shroud"), ModelRotation.X0_Y270, ModelLoader.defaultTextureGetter())); + shroudOverlaysHalf.put(Direction.NORTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_shroud"), ModelRotation.X0_Y0, ModelLoader.defaultTextureGetter())); + shroudOverlaysHalf.put(Direction.EAST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_shroud"), ModelRotation.X0_Y90, ModelLoader.defaultTextureGetter())); + shroudOverlaysHalf.put(Direction.SOUTH, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_shroud"), ModelRotation.X0_Y180, ModelLoader.defaultTextureGetter())); + shroudOverlaysHalf.put(Direction.WEST, event.getModelLoader().getBakedModel(new ResourceLocation(StorageDrawers.MOD_ID, "block/half_drawers_shroud"), ModelRotation.X0_Y270, ModelLoader.defaultTextureGetter())); + if (ModBlocks.OAK_FULL_DRAWERS_1 == null) { StorageDrawers.log.warn("Block objects not set in ModelBakeEvent. Is your mod environment broken?"); return; @@ -340,22 +367,26 @@ public ItemOverrideList getOverrides () { public static abstract class Model2 implements IDynamicBakedModel { protected final IBakedModel mainModel; protected final Map lockOverlay; + protected final Map voidOverlay; + protected final Map shroudOverlay; public static class FullModel extends Model2 { FullModel(IBakedModel mainModel) { - super(mainModel, lockOverlaysFull); + super(mainModel, lockOverlaysFull, voidOverlaysFull, shroudOverlaysFull); } } public static class HalfModel extends Model2 { HalfModel(IBakedModel mainModel) { - super(mainModel, lockOverlaysHalf); + super(mainModel, lockOverlaysHalf, voidOverlaysHalf, shroudOverlaysHalf); } } - private Model2(IBakedModel mainModel, Map lockOverlay) { + private Model2(IBakedModel mainModel, Map lockOverlay, Map voidOverlay, Map shroudOverlay) { this.mainModel = mainModel; this.lockOverlay = lockOverlay; + this.voidOverlay = voidOverlay; + this.shroudOverlay = shroudOverlay; } @Override @@ -375,6 +406,10 @@ public List getQuads (@Nullable BlockState state, @Nullable Direction if (attr.isItemLocked(LockAttribute.LOCK_EMPTY) || attr.isItemLocked(LockAttribute.LOCK_POPULATED)) quads.addAll(lockOverlay.get(dir).getQuads(state, side, rand, extraData)); + if (attr.isVoid()) + quads.addAll(voidOverlay.get(dir).getQuads(state, side, rand, extraData)); + if (attr.isConcealed()) + quads.addAll(shroudOverlay.get(dir).getQuads(state, side, rand, extraData)); } return quads; diff --git a/src/main/java/com/jaquadro/minecraft/storagedrawers/core/ModItems.java b/src/main/java/com/jaquadro/minecraft/storagedrawers/core/ModItems.java index 0d643048f..01faf4775 100644 --- a/src/main/java/com/jaquadro/minecraft/storagedrawers/core/ModItems.java +++ b/src/main/java/com/jaquadro/minecraft/storagedrawers/core/ModItems.java @@ -29,7 +29,8 @@ public class ModItems ILLUMINATION_UPGRADE = null, UPGRADE_TEMPLATE = null, DRAWER_KEY = null, - QUANTIFY_KEY = null; + QUANTIFY_KEY = null, + SHROUD_KEY = null; /*@ObjectHolder(StorageDrawers.MOD_ID + ":upgrade_template") public static Item upgradeTemplate; @@ -80,6 +81,7 @@ public static void registerItems (RegistryEvent.Register event) { register(event, "upgrade_template", new Item(new Item.Properties().group(ModItemGroup.STORAGE_DRAWERS))); register(event, "drawer_key", new ItemDrawerKey(new Item.Properties().group(ModItemGroup.STORAGE_DRAWERS))); register(event, "quantify_key", new ItemQuantifyKey(new Item.Properties().group(ModItemGroup.STORAGE_DRAWERS))); + register(event, "shroud_key", new ItemShroudKey(new Item.Properties().group(ModItemGroup.STORAGE_DRAWERS))); //IForgeRegistry itemRegistry = event.getRegistry(); //ConfigManager config = StorageDrawers.config; diff --git a/src/main/java/com/jaquadro/minecraft/storagedrawers/item/ItemShroudKey.java b/src/main/java/com/jaquadro/minecraft/storagedrawers/item/ItemShroudKey.java index fd760a7bb..5bb3e3c87 100644 --- a/src/main/java/com/jaquadro/minecraft/storagedrawers/item/ItemShroudKey.java +++ b/src/main/java/com/jaquadro/minecraft/storagedrawers/item/ItemShroudKey.java @@ -1,15 +1,12 @@ -/*package com.jaquadro.minecraft.storagedrawers.item; +package com.jaquadro.minecraft.storagedrawers.item; import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerAttributesModifiable; -import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs; +import net.minecraft.item.Item; public class ItemShroudKey extends ItemKey { - public ItemShroudKey (String registryName, String unlocalizedName) { - setRegistryName(registryName); - setUnlocalizedName(unlocalizedName); - setCreativeTab(ModCreativeTabs.tabStorageDrawers); - setMaxDamage(0); + public ItemShroudKey (Item.Properties properties) { + super(properties); } @Override @@ -17,4 +14,3 @@ protected void handleDrawerAttributes (IDrawerAttributesModifiable attrs) { attrs.setIsConcealed(!attrs.isConcealed()); } } -*/ \ No newline at end of file diff --git a/src/main/resources/assets/storagedrawers/models/block/full_drawers_shroud.json b/src/main/resources/assets/storagedrawers/models/block/full_drawers_shroud.json new file mode 100644 index 000000000..2b74e9a25 --- /dev/null +++ b/src/main/resources/assets/storagedrawers/models/block/full_drawers_shroud.json @@ -0,0 +1,13 @@ +{ + "parent": "block/block", + "textures": { + "shroud": "storagedrawers:blocks/indicator/shroud_icon" + }, + "elements": [ { + "from": [ 1, 15, -0.02 ], + "to": [ 2, 16, 16], + "faces": { + "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#shroud", "cullface": "north" } + } + } ] +} \ No newline at end of file diff --git a/src/main/resources/assets/storagedrawers/models/block/full_drawers_void.json b/src/main/resources/assets/storagedrawers/models/block/full_drawers_void.json new file mode 100644 index 000000000..a94973623 --- /dev/null +++ b/src/main/resources/assets/storagedrawers/models/block/full_drawers_void.json @@ -0,0 +1,13 @@ +{ + "parent": "block/block", + "textures": { + "void": "storagedrawers:blocks/indicator/void_icon" + }, + "elements": [ { + "from": [ 0, 15, -0.02 ], + "to": [ 1, 16, 16], + "faces": { + "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#void", "cullface": "north" } + } + } ] +} \ No newline at end of file diff --git a/src/main/resources/assets/storagedrawers/models/block/half_drawers_shroud.json b/src/main/resources/assets/storagedrawers/models/block/half_drawers_shroud.json new file mode 100644 index 000000000..494d935c4 --- /dev/null +++ b/src/main/resources/assets/storagedrawers/models/block/half_drawers_shroud.json @@ -0,0 +1,13 @@ +{ + "parent": "block/block", + "textures": { + "shroud": "storagedrawers:blocks/indicator/shroud_icon" + }, + "elements": [ { + "from": [ 1, 15, 7.98 ], + "to": [ 2, 16, 16], + "faces": { + "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#shroud", "cullface": "north" } + } + } ] +} \ No newline at end of file diff --git a/src/main/resources/assets/storagedrawers/models/block/half_drawers_void.json b/src/main/resources/assets/storagedrawers/models/block/half_drawers_void.json new file mode 100644 index 000000000..015fe02c7 --- /dev/null +++ b/src/main/resources/assets/storagedrawers/models/block/half_drawers_void.json @@ -0,0 +1,13 @@ +{ + "parent": "block/block", + "textures": { + "void": "storagedrawers:blocks/indicator/void_icon" + }, + "elements": [ { + "from": [ 0, 15, 7.98 ], + "to": [ 1, 16, 16], + "faces": { + "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#void", "cullface": "north" } + } + } ] +} \ No newline at end of file diff --git a/src/main/resources/assets/storagedrawers/textures/blocks/indicator/shroud_icon.png b/src/main/resources/assets/storagedrawers/textures/blocks/indicator/shroud_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..6e7af6599f89da71efc191c9f3b510b2e4614699 GIT binary patch literal 676 zcmV;V0$crwP)WdKxlWgs#)AWC&?ATlsAF(5E7Ix;jmGB+SCFf}kReh$0F00007bV*G` z2jvGF1RNDJ#yxca000SaNLh0L01FZT01FZU(%pXi00004XF*Lt006O%3;baP0005| zNkl*+0;#;%l?9b3pegu zxDvsY=tjh?3n^HrAP8cyex(iFNDwtOp=gpxGn2H_m<&wl=-5rq>T=I{-gEBDJ#ffy z9h7WuS3A~Olm;DZJqLj!nQQ;t{Vn8if@4!T+-^4~FHUeY;-X&nkjl-{s5Q*|ei4ro zd^$UWG_XlPZs9$mqbNG@cml5&G^g4x;&y_Ee80IhH%}&!A;ch3KqZxK6Ca8&ekt7- zu?h4de0&tY-(X>Oj`xK%euxiv_Vf{>C&E<96|SVSXj%&;q4XKI)jc{f&E(}_pZ@_gd~aFdvSxA=`_lSpW(@@$=N0-RRsjY;N_RQNOBOZwuiC1$9AoS zAi9ucos~}o+8xn8ffdD#3aa)EQ3z1_TJOTUxVjY)MW(4~-DhZ=Ixo@Gu?zGZ{kgKp zRw2*1&zll4h@LRR!Va@vJMZ{r_%ZQ!@#tB8I80000< KMNUMnLSTYzlqK^3 literal 0 HcmV?d00001