Skip to content

Commit

Permalink
- Restore concealment key
Browse files Browse the repository at this point in the history
- Restore void icon to front of drawer
  • Loading branch information
jaquadro committed Jul 27, 2021
1 parent 1a30a1d commit 99c733e
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 22 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public final class BasicDrawerModel
{
private static final Map<Direction, IBakedModel> lockOverlaysFull = new HashMap<>();
private static final Map<Direction, IBakedModel> lockOverlaysHalf = new HashMap<>();
private static final Map<Direction, IBakedModel> voidOverlaysFull = new HashMap<>();
private static final Map<Direction, IBakedModel> voidOverlaysHalf = new HashMap<>();
private static final Map<Direction, IBakedModel> shroudOverlaysFull = new HashMap<>();
private static final Map<Direction, IBakedModel> shroudOverlaysHalf = new HashMap<>();

private static boolean geometryDataLoaded = false;

Expand All @@ -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<RenderMaterial, String> 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 () {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -340,22 +367,26 @@ public ItemOverrideList getOverrides () {
public static abstract class Model2 implements IDynamicBakedModel {
protected final IBakedModel mainModel;
protected final Map<Direction, IBakedModel> lockOverlay;
protected final Map<Direction, IBakedModel> voidOverlay;
protected final Map<Direction, IBakedModel> 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<Direction, IBakedModel> lockOverlay) {
private Model2(IBakedModel mainModel, Map<Direction, IBakedModel> lockOverlay, Map<Direction, IBakedModel> voidOverlay, Map<Direction, IBakedModel> shroudOverlay) {
this.mainModel = mainModel;
this.lockOverlay = lockOverlay;
this.voidOverlay = voidOverlay;
this.shroudOverlay = shroudOverlay;
}

@Override
Expand All @@ -375,6 +406,10 @@ public List<BakedQuad> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -80,6 +81,7 @@ public static void registerItems (RegistryEvent.Register<Item> 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<Item> itemRegistry = event.getRegistry();
//ConfigManager config = StorageDrawers.config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
/*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
protected void handleDrawerAttributes (IDrawerAttributesModifiable attrs) {
attrs.setIsConcealed(!attrs.isConcealed());
}
}
*/
Original file line number Diff line number Diff line change
@@ -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" }
}
} ]
}
Original file line number Diff line number Diff line change
@@ -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" }
}
} ]
}
Original file line number Diff line number Diff line change
@@ -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" }
}
} ]
}
Original file line number Diff line number Diff line change
@@ -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" }
}
} ]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 99c733e

Please sign in to comment.