From 38cd84208e0a2953cc4e420587ff6cf7c207a62d Mon Sep 17 00:00:00 2001 From: Nicolas BARBOTIN Date: Sat, 3 Feb 2018 03:33:27 +0100 Subject: [PATCH] + Today's work: Recipes & advancements, mainly --- src/main/java/net/montoyo/wd/SharedProxy.java | 14 +++ src/main/java/net/montoyo/wd/WebDisplays.java | 48 +++++++++- .../net/montoyo/wd/block/BlockScreen.java | 2 + .../net/montoyo/wd/client/ClientProxy.java | 89 +++++++++++++++--- .../net/montoyo/wd/core/AdvancementIcon.java | 24 +++++ .../net/montoyo/wd/core/CraftComponent.java | 14 ++- .../net/montoyo/wd/core/DefaultUpgrade.java | 3 +- .../net/montoyo/wd/core/HasAdvancement.java | 13 +++ .../montoyo/wd/entity/TileEntityKeyboard.java | 6 ++ .../montoyo/wd/item/ItemCraftComponent.java | 43 +++------ .../java/net/montoyo/wd/item/ItemLinker.java | 8 +- .../net/montoyo/wd/item/ItemMinePad2.java | 15 ++- .../java/net/montoyo/wd/item/ItemMulti.java | 54 +++++++++++ .../java/net/montoyo/wd/item/ItemUpgrade.java | 33 +------ .../webdisplays/keyboard_cat.json | 13 +++ .../advancements/webdisplays/laser.json | 16 ++++ .../webdisplays/link_peripheral.json | 13 +++ .../advancements/webdisplays/minepad.json | 7 +- .../advancements/webdisplays/minepad2.json | 16 ++++ .../advancements/webdisplays/pad_break.json | 14 ++- .../advancements/webdisplays/root.json | 2 +- .../advancements/webdisplays/screen.json | 8 +- .../advancements/webdisplays/upgrade.json | 13 +++ .../assets/webdisplays/lang/en_us.lang | 20 +++- .../models/item/advicon_brokenpad.json | 6 ++ .../models/item/advicon_pigeon.json | 6 ++ .../webdisplays/models/item/advicon_wd.json | 6 ++ .../models/item/craftcomp_badextcard.json | 6 ++ .../models/item/craftcomp_extcard.json | 6 ++ .../assets/webdisplays/recipes/backlight.json | 3 +- .../webdisplays/recipes/ccinterface.json | 21 ----- .../assets/webdisplays/recipes/extcard.json | 31 ++++++ .../assets/webdisplays/recipes/keyboard.json | 10 +- .../assets/webdisplays/recipes/linker.json | 3 +- .../assets/webdisplays/recipes/minepad.json | 3 +- .../assets/webdisplays/recipes/minepad2.json | 3 +- .../webdisplays/recipes/peripheral.json | 22 +++++ .../assets/webdisplays/recipes/rctrl.json | 7 +- .../assets/webdisplays/recipes/redctrl1.json | 7 +- .../assets/webdisplays/recipes/upgrade.json | 11 ++- .../textures/items/advicon_brokenpad.png | Bin 0 -> 373 bytes .../items/{pigeon.png => advicon_pigeon.png} | Bin .../webdisplays/textures/items/advicon_wd.png | Bin 0 -> 299 bytes .../webdisplays/textures/items/badextcard.png | Bin 0 -> 382 bytes .../webdisplays/textures/items/extcard.png | Bin 0 -> 276 bytes 45 files changed, 506 insertions(+), 133 deletions(-) create mode 100644 src/main/java/net/montoyo/wd/core/AdvancementIcon.java create mode 100644 src/main/java/net/montoyo/wd/core/HasAdvancement.java create mode 100644 src/main/java/net/montoyo/wd/item/ItemMulti.java create mode 100644 src/main/resources/assets/webdisplays/advancements/webdisplays/keyboard_cat.json create mode 100644 src/main/resources/assets/webdisplays/advancements/webdisplays/laser.json create mode 100644 src/main/resources/assets/webdisplays/advancements/webdisplays/link_peripheral.json create mode 100644 src/main/resources/assets/webdisplays/advancements/webdisplays/minepad2.json create mode 100644 src/main/resources/assets/webdisplays/advancements/webdisplays/upgrade.json create mode 100644 src/main/resources/assets/webdisplays/models/item/advicon_brokenpad.json create mode 100644 src/main/resources/assets/webdisplays/models/item/advicon_pigeon.json create mode 100644 src/main/resources/assets/webdisplays/models/item/advicon_wd.json create mode 100644 src/main/resources/assets/webdisplays/models/item/craftcomp_badextcard.json create mode 100644 src/main/resources/assets/webdisplays/models/item/craftcomp_extcard.json delete mode 100644 src/main/resources/assets/webdisplays/recipes/ccinterface.json create mode 100644 src/main/resources/assets/webdisplays/recipes/extcard.json create mode 100644 src/main/resources/assets/webdisplays/recipes/peripheral.json create mode 100644 src/main/resources/assets/webdisplays/textures/items/advicon_brokenpad.png rename src/main/resources/assets/webdisplays/textures/items/{pigeon.png => advicon_pigeon.png} (100%) create mode 100644 src/main/resources/assets/webdisplays/textures/items/advicon_wd.png create mode 100644 src/main/resources/assets/webdisplays/textures/items/badextcard.png create mode 100644 src/main/resources/assets/webdisplays/textures/items/extcard.png diff --git a/src/main/java/net/montoyo/wd/SharedProxy.java b/src/main/java/net/montoyo/wd/SharedProxy.java index bd4b9c8..cb93c5f 100644 --- a/src/main/java/net/montoyo/wd/SharedProxy.java +++ b/src/main/java/net/montoyo/wd/SharedProxy.java @@ -5,10 +5,13 @@ package net.montoyo.wd; import com.mojang.authlib.GameProfile; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.server.FMLServerHandler; import net.montoyo.mcef.utilities.Log; +import net.montoyo.wd.core.HasAdvancement; import net.montoyo.wd.core.JSServerRequest; import net.montoyo.wd.data.GuiData; import net.montoyo.wd.entity.TileEntityScreen; @@ -17,6 +20,8 @@ import net.montoyo.wd.utilities.NameUUIDPair; import net.montoyo.wd.utilities.Vector2i; import net.montoyo.wd.utilities.Vector3i; +import javax.annotation.Nonnull; + public class SharedProxy { public static final int CURRENT_DIMENSION = Integer.MAX_VALUE; @@ -74,4 +79,13 @@ public class SharedProxy { Log.error("Called SharedProxy.handleJSResponseError() on server side..."); } + @Nonnull + public HasAdvancement hasClientPlayerAdvancement(@Nonnull ResourceLocation rl) { + return HasAdvancement.DONT_KNOW; + } + + public MinecraftServer getServer() { + return FMLServerHandler.instance().getServer(); + } + } diff --git a/src/main/java/net/montoyo/wd/WebDisplays.java b/src/main/java/net/montoyo/wd/WebDisplays.java index 35d6eac..88ec00c 100644 --- a/src/main/java/net/montoyo/wd/WebDisplays.java +++ b/src/main/java/net/montoyo/wd/WebDisplays.java @@ -4,12 +4,17 @@ package net.montoyo.wd; +import net.minecraft.advancements.Advancement; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; @@ -21,15 +26,14 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.PlayerEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.common.registry.GameRegistry; import net.montoyo.wd.block.BlockKeyboardRight; import net.montoyo.wd.block.BlockPeripheral; import net.montoyo.wd.block.BlockScreen; -import net.montoyo.wd.core.Criterion; -import net.montoyo.wd.core.DefaultPeripheral; -import net.montoyo.wd.core.WDCreativeTab; +import net.montoyo.wd.core.*; import net.montoyo.wd.entity.TileEntityScreen; import net.montoyo.wd.item.*; import net.montoyo.wd.net.Messages; @@ -56,6 +60,7 @@ public class WebDisplays { public static SimpleNetworkWrapper NET_HANDLER; public static WDCreativeTab CREATIVE_TAB; + public static final ResourceLocation ADV_PAD_BREAK = new ResourceLocation("webdisplays", "webdisplays/pad_break"); //Blocks public BlockScreen blockScreen; @@ -70,6 +75,7 @@ public class WebDisplays { public ItemUpgrade itemUpgrade; public ItemLaserPointer itemLaserPointer; public ItemCraftComponent itemCraftComp; + public ItemMulti itemAdvIcon; //Sounds public SoundEvent soundTyping; @@ -79,6 +85,9 @@ public class WebDisplays { //Criterions public Criterion criterionPadBreak; + public Criterion criterionUpgradeScreen; + public Criterion criterionLinkPeripheral; + public Criterion criterionKeyboardCat; //Config public static final double PAD_RATIO = 59.0 / 30.0; @@ -86,6 +95,7 @@ public class WebDisplays { public double padResX; public double padResY; private int lastPadId = 0; + public boolean doHardRecipe = true; @Mod.EventHandler public void onPreInit(FMLPreInitializationEvent ev) { @@ -93,7 +103,10 @@ public class WebDisplays { //Criterions criterionPadBreak = new Criterion("pad_break"); - registerTrigger(criterionPadBreak); + criterionUpgradeScreen = new Criterion("upgrade_screen"); + criterionLinkPeripheral = new Criterion("link_peripheral"); + criterionKeyboardCat = new Criterion("keyboard_cat"); + registerTrigger(criterionPadBreak, criterionUpgradeScreen, criterionLinkPeripheral, criterionKeyboardCat); //Read configuration TODO final int padHeight = 480; @@ -118,6 +131,10 @@ public class WebDisplays { itemLaserPointer = new ItemLaserPointer(); itemCraftComp = new ItemCraftComponent(); + itemAdvIcon = new ItemMulti(AdvancementIcon.class); + itemAdvIcon.setUnlocalizedName("webdisplays.advicon"); + itemAdvIcon.setRegistryName("advicon"); + PROXY.preInit(); MinecraftForge.EVENT_BUS.register(this); } @@ -150,7 +167,7 @@ public class WebDisplays { @SubscribeEvent public void onRegisterItems(RegistryEvent.Register ev) { ev.getRegistry().registerAll(blockScreen.getItem(), blockPeripheral.getItem()); - ev.getRegistry().registerAll(itemScreenCfg, itemOwnerThief, itemLinker, itemMinePad, itemUpgrade, itemLaserPointer, itemCraftComp); + ev.getRegistry().registerAll(itemScreenCfg, itemOwnerThief, itemLinker, itemMinePad, itemUpgrade, itemLaserPointer, itemCraftComp, itemAdvIcon); } @SubscribeEvent @@ -225,6 +242,27 @@ public class WebDisplays { } } + @SubscribeEvent + public void onPlayerCraft(PlayerEvent.ItemCraftedEvent ev) { + if(doHardRecipe && ev.crafting.getItem() == itemCraftComp && ev.crafting.getMetadata() == CraftComponent.EXTENSION_CARD.ordinal()) { + if((ev.player instanceof EntityPlayerMP && !hasPlayerAdvancement((EntityPlayerMP) ev.player, ADV_PAD_BREAK)) || PROXY.hasClientPlayerAdvancement(ADV_PAD_BREAK) != HasAdvancement.YES) { + ev.crafting.setItemDamage(CraftComponent.BAD_EXTENSION_CARD.ordinal()); + + if(!ev.player.world.isRemote) + ev.player.world.playSound(null, ev.player.posX, ev.player.posY, ev.player.posZ, SoundEvents.ENTITY_ITEM_BREAK, SoundCategory.MASTER, 1.0f, 1.0f); + } + } + } + + private boolean hasPlayerAdvancement(EntityPlayerMP ply, ResourceLocation rl) { + MinecraftServer server = PROXY.getServer(); + if(server == null) + return false; + + Advancement adv = server.getAdvancementManager().getAdvancement(rl); + return adv != null && ply.getAdvancements().getProgress(adv).isDone(); + } + public static int getNextAvailablePadID() { return INSTANCE.lastPadId++; } diff --git a/src/main/java/net/montoyo/wd/block/BlockScreen.java b/src/main/java/net/montoyo/wd/block/BlockScreen.java index fdc47ac..f0bda7a 100644 --- a/src/main/java/net/montoyo/wd/block/BlockScreen.java +++ b/src/main/java/net/montoyo/wd/block/BlockScreen.java @@ -151,6 +151,8 @@ public class BlockScreen extends WDBlockContainer { heldItem.shrink(1); Util.toast(player, TextFormatting.AQUA, "upgradeOk"); + if(player instanceof EntityPlayerMP) + WebDisplays.INSTANCE.criterionUpgradeScreen.trigger(((EntityPlayerMP) player).getAdvancements()); } else Util.toast(player, "upgradeError"); diff --git a/src/main/java/net/montoyo/wd/client/ClientProxy.java b/src/main/java/net/montoyo/wd/client/ClientProxy.java index 19e3d61..96c8a19 100644 --- a/src/main/java/net/montoyo/wd/client/ClientProxy.java +++ b/src/main/java/net/montoyo/wd/client/ClientProxy.java @@ -5,9 +5,12 @@ package net.montoyo.wd.client; import com.mojang.authlib.GameProfile; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementProgress; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.multiplayer.ClientAdvancementManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.IResourceManager; @@ -17,9 +20,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHandSide; import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; @@ -41,17 +46,19 @@ import net.montoyo.wd.client.gui.GuiSetURL2; import net.montoyo.wd.client.gui.WDScreen; import net.montoyo.wd.client.gui.loading.GuiLoader; import net.montoyo.wd.client.renderers.*; -import net.montoyo.wd.core.CraftComponent; import net.montoyo.wd.core.DefaultUpgrade; +import net.montoyo.wd.core.HasAdvancement; import net.montoyo.wd.core.JSServerRequest; import net.montoyo.wd.data.GuiData; import net.montoyo.wd.entity.TileEntityScreen; +import net.montoyo.wd.item.ItemMulti; import net.montoyo.wd.net.SMessagePadCtrl; import net.montoyo.wd.net.SMessageScreenCtrl; import net.montoyo.wd.utilities.*; -import java.util.ArrayList; -import java.util.HashMap; +import javax.annotation.Nonnull; +import java.lang.reflect.Field; +import java.util.*; public class ClientProxy extends SharedProxy implements IResourceManagerReloadListener, IDisplayHandler, IJSQueryHandler { @@ -77,6 +84,7 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi private MinePadRenderer minePadRenderer; private JSQueryDispatcher jsDispatcher; private LaserPointerRenderer laserPointerRenderer; + private Field advancementToProgress; //Laser pointer private TileEntityScreen pointedScreen; @@ -121,6 +129,7 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi mcef.registerDisplayHandler(this); mcef.registerJSQueryHandler(this); + findAdvancementToProgressField(); } @Override @@ -202,6 +211,46 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi mc.displayGuiScreen(new GuiMinePad(pd)); } + @Override + @Nonnull + public HasAdvancement hasClientPlayerAdvancement(@Nonnull ResourceLocation rl) { + if(advancementToProgress != null && mc.player != null && mc.player.connection != null) { + ClientAdvancementManager cam = mc.player.connection.getAdvancementManager(); + Advancement adv = cam.getAdvancementList().getAdvancement(rl); + Map map; + + if(adv == null) + return HasAdvancement.DONT_KNOW; + + try { + map = (Map) advancementToProgress.get(cam); + } catch(Throwable t) { + t.printStackTrace(); + advancementToProgress = null; + return HasAdvancement.DONT_KNOW; + } + + Object progress = map.get(adv); + if(progress == null) + return HasAdvancement.NO; + + if(!(progress instanceof AdvancementProgress)) { + Log.warning("The ClientAdvancementManager.advancementToProgress map does not contain AdvancementProgress instances"); + advancementToProgress = null; //It's wrong + return HasAdvancement.DONT_KNOW; + } + + return ((AdvancementProgress) progress).isDone() ? HasAdvancement.YES : HasAdvancement.NO; + } + + return HasAdvancement.DONT_KNOW; + } + + @Override + public MinecraftServer getServer() { + return mc.getIntegratedServer(); + } + @Override public void handleJSResponseSuccess(int reqId, JSServerRequest type, byte[] data) { JSQueryDispatcher.ServerQuery q = jsDispatcher.fulfillQuery(reqId); @@ -341,14 +390,9 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi registerItemModel(wd.itemMinePad, 0, "normal"); registerItemModel(wd.itemMinePad, 1, "normal"); registerItemModel(wd.itemLaserPointer, 0, "normal"); - - DefaultUpgrade[] upgrades = DefaultUpgrade.values(); - for(int i = 0; i < upgrades.length; i++) - ModelLoader.setCustomModelResourceLocation(wd.itemUpgrade, i, new ModelResourceLocation("webdisplays:upgrade_" + upgrades[i].getName(), "normal")); - - CraftComponent[] components = CraftComponent.values(); - for(int i = 0; i < components.length; i++) - ModelLoader.setCustomModelResourceLocation(wd.itemCraftComp, i, new ModelResourceLocation("webdisplays:craftcomp_" + components[i].getName(), "normal")); + registerItemMultiModels(wd.itemUpgrade); + registerItemMultiModels(wd.itemCraftComp); + registerItemMultiModels(wd.itemAdvIcon); } @SubscribeEvent @@ -535,6 +579,13 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), variant)); } + private void registerItemMultiModels(ItemMulti item) { + Enum[] values = item.getEnumValues(); + + for(int i = 0; i < values.length; i++) + ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName().toString() + '_' + values[i], "normal")); + } + private void updatePad(int id, NBTTagCompound tag, boolean isSelected) { PadData pd = padMap.get(id); @@ -582,4 +633,20 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi return false; } + private void findAdvancementToProgressField() { + Field[] fields = ClientAdvancementManager.class.getDeclaredFields(); + + Arrays.stream(fields).filter(f -> f.getType() == Map.class).findAny().ifPresent(f -> { + try { + f.setAccessible(true); + advancementToProgress = f; + } catch(Throwable t) { + t.printStackTrace(); + } + }); + + if(advancementToProgress == null) + Log.warning("ClientAdvancementManager.advancementToProgress field could not be found"); + } + } diff --git a/src/main/java/net/montoyo/wd/core/AdvancementIcon.java b/src/main/java/net/montoyo/wd/core/AdvancementIcon.java new file mode 100644 index 0000000..b81790f --- /dev/null +++ b/src/main/java/net/montoyo/wd/core/AdvancementIcon.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.core; + +public enum AdvancementIcon { + + WEB_DISPLAYS("wd"), + BROKEN_PAD("brokenpad"), + PIGEON("pigeon"); + + private final String name; + + AdvancementIcon(String n) { + name = n; + } + + @Override + public String toString() { + return name; + } + +} diff --git a/src/main/java/net/montoyo/wd/core/CraftComponent.java b/src/main/java/net/montoyo/wd/core/CraftComponent.java index a73b171..56c1754 100644 --- a/src/main/java/net/montoyo/wd/core/CraftComponent.java +++ b/src/main/java/net/montoyo/wd/core/CraftComponent.java @@ -4,6 +4,9 @@ package net.montoyo.wd.core; +import net.minecraft.item.ItemStack; +import net.montoyo.wd.WebDisplays; + public enum CraftComponent { STONE_KEY("stonekey"), @@ -12,7 +15,9 @@ public enum CraftComponent { BATTERY_CELL("batcell"), BATTERY_PACK("batpack"), LASER_DIODE("laserdiode"), - BACKLIGHT("backlight"); + BACKLIGHT("backlight"), + EXTENSION_CARD("extcard"), + BAD_EXTENSION_CARD("badextcard"); private final String name; @@ -20,8 +25,13 @@ public enum CraftComponent { name = n; } - public String getName() { + @Override + public String toString() { return name; } + public ItemStack makeItemStack() { + return new ItemStack(WebDisplays.INSTANCE.itemCraftComp, 1, ordinal()); + } + } diff --git a/src/main/java/net/montoyo/wd/core/DefaultUpgrade.java b/src/main/java/net/montoyo/wd/core/DefaultUpgrade.java index 62f0f9a..56c2cdd 100644 --- a/src/main/java/net/montoyo/wd/core/DefaultUpgrade.java +++ b/src/main/java/net/montoyo/wd/core/DefaultUpgrade.java @@ -20,7 +20,8 @@ public enum DefaultUpgrade { name = n; } - public String getName() { + @Override + public String toString() { return name; } diff --git a/src/main/java/net/montoyo/wd/core/HasAdvancement.java b/src/main/java/net/montoyo/wd/core/HasAdvancement.java new file mode 100644 index 0000000..1e458e2 --- /dev/null +++ b/src/main/java/net/montoyo/wd/core/HasAdvancement.java @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.core; + +public enum HasAdvancement { + + DONT_KNOW, + YES, + NO + +} diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java b/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java index 898694e..b15a263 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java @@ -5,9 +5,11 @@ package net.montoyo.wd.entity; import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.EnumHand; +import net.montoyo.wd.WebDisplays; import net.montoyo.wd.core.ScreenRights; import net.montoyo.wd.data.KeyboardData; import net.montoyo.wd.utilities.BlockSide; @@ -59,6 +61,10 @@ public class TileEntityKeyboard extends TileEntityPeripheralBase { if(ok) { char rnd = RANDOM_CHARS.charAt((int) (Math.random() * ((double) RANDOM_CHARS.length()))); tes.type(screenSide, "t" + rnd, pos); + + EntityPlayer owner = world.getPlayerEntityByUUID(scr.owner.uuid); + if(owner != null && owner instanceof EntityPlayerMP && ent instanceof EntityOcelot) + WebDisplays.INSTANCE.criterionKeyboardCat.trigger(((EntityPlayerMP) owner).getAdvancements()); } } } diff --git a/src/main/java/net/montoyo/wd/item/ItemCraftComponent.java b/src/main/java/net/montoyo/wd/item/ItemCraftComponent.java index 84fe697..f2fc0b5 100644 --- a/src/main/java/net/montoyo/wd/item/ItemCraftComponent.java +++ b/src/main/java/net/montoyo/wd/item/ItemCraftComponent.java @@ -7,54 +7,37 @@ package net.montoyo.wd.item; import com.mojang.realmsclient.gui.ChatFormatting; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.montoyo.wd.WebDisplays; import net.montoyo.wd.core.CraftComponent; +import net.montoyo.wd.core.HasAdvancement; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; -public class ItemCraftComponent extends Item { +public class ItemCraftComponent extends ItemMulti { public ItemCraftComponent() { + super(CraftComponent.class); setUnlocalizedName("webdisplays.craftcomp"); setRegistryName("craftcomp"); - setHasSubtypes(true); - setMaxDamage(0); setCreativeTab(WebDisplays.CREATIVE_TAB); - } - @Override - @Nonnull - public String getUnlocalizedName(ItemStack stack) { - int meta = stack.getMetadata(); - CraftComponent[] names = CraftComponent.values(); - String ret = getUnlocalizedName(); - - if(meta >= 0 && meta < names.length) - return ret + '.' + names[meta].getName(); - else - return ret; - } - - @Override - public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { - if(isInCreativeTab(tab)) { - int cnt = CraftComponent.values().length; - - for(int i = 0; i < cnt; i++) - items.add(new ItemStack(this, 1, i)); - } + //Hide the bad extension card from the creative tab + creativeTabItems.clear(CraftComponent.BAD_EXTENSION_CARD.ordinal()); } @Override public void addInformation(ItemStack is, @Nullable World world, List tt, ITooltipFlag ttFlags) { - tt.add("" + ChatFormatting.ITALIC + I18n.format("item.webdisplays.craftcomp.name")); + if(WebDisplays.INSTANCE.doHardRecipe && is.getMetadata() == CraftComponent.EXTENSION_CARD.ordinal() && WebDisplays.PROXY.hasClientPlayerAdvancement(WebDisplays.ADV_PAD_BREAK) != HasAdvancement.YES) { + tt.add("" + ChatFormatting.RED + I18n.format("webdisplays.extcard.cantcraft1")); + tt.add("" + ChatFormatting.RED + I18n.format("webdisplays.extcard.cantcraft2")); + } else if(is.getMetadata() == CraftComponent.BAD_EXTENSION_CARD.ordinal()) + tt.add("" + ChatFormatting.RED + I18n.format("webdisplays.extcard.bad")); + else + tt.add("" + ChatFormatting.ITALIC + I18n.format("item.webdisplays.craftcomp.name")); } } diff --git a/src/main/java/net/montoyo/wd/item/ItemLinker.java b/src/main/java/net/montoyo/wd/item/ItemLinker.java index e6cb280..a5c3507 100644 --- a/src/main/java/net/montoyo/wd/item/ItemLinker.java +++ b/src/main/java/net/montoyo/wd/item/ItemLinker.java @@ -8,6 +8,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -73,9 +74,12 @@ public class ItemLinker extends Item { Vector3i tePos = new Vector3i(tag.getInteger("ScreenX"), tag.getInteger("ScreenY"), tag.getInteger("ScreenZ")); BlockSide scrSide = BlockSide.values()[tag.getByte("ScreenSide")]; - if(target.connect(world, pos_, state, tePos, scrSide)) + if(target.connect(world, pos_, state, tePos, scrSide)) { Util.toast(player, TextFormatting.AQUA, "linked"); - else + + if(player instanceof EntityPlayerMP) + WebDisplays.INSTANCE.criterionLinkPeripheral.trigger(((EntityPlayerMP) player).getAdvancements()); + } else Util.toast(player, "linkError"); stack.setTagCompound(null); diff --git a/src/main/java/net/montoyo/wd/item/ItemMinePad2.java b/src/main/java/net/montoyo/wd/item/ItemMinePad2.java index d80c109..2aa3b55 100644 --- a/src/main/java/net/montoyo/wd/item/ItemMinePad2.java +++ b/src/main/java/net/montoyo/wd/item/ItemMinePad2.java @@ -20,8 +20,9 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.montoyo.wd.WebDisplays; -import net.montoyo.wd.utilities.Log; +import net.montoyo.wd.core.CraftComponent; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; import java.util.UUID; @@ -45,7 +46,8 @@ public class ItemMinePad2 extends Item { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer ply, EnumHand hand) { + @Nonnull + public ActionResult onItemRightClick(World world, EntityPlayer ply, @Nonnull EnumHand hand) { ItemStack is = ply.getHeldItem(hand); if(world.isRemote) { @@ -60,8 +62,11 @@ public class ItemMinePad2 extends Item { @Override public void addInformation(ItemStack is, @Nullable World world, List tt, ITooltipFlag ttFlags) { - if(is == null || is.getTagCompound() == null || !is.getTagCompound().hasKey("PadID")) + if(is.getTagCompound() == null || !is.getTagCompound().hasKey("PadID")) tt.add("" + ChatFormatting.ITALIC + ChatFormatting.GRAY + I18n.format("webdisplays.minepad.turnon")); + + if(is.getMetadata() > 0) + tt.add("" + ChatFormatting.RED + I18n.format("webdisplays.minepad2.info")); } @Override @@ -86,11 +91,10 @@ public class ItemMinePad2 extends Item { if(thrower != null && height - ent.posY >= 20.0) { ent.world.playSound(null, ent.posX, ent.posY, ent.posZ, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.BLOCKS, 4.0f, 1.0f); + ent.world.spawnEntity(new EntityItem(ent.world, ent.posX, ent.posY, ent.posZ, CraftComponent.EXTENSION_CARD.makeItemStack())); ent.setDead(); - //TODO: Drop an extension card EntityPlayer ply = ent.world.getPlayerEntityByUUID(thrower); - if(ply != null && ply instanceof EntityPlayerMP) WebDisplays.INSTANCE.criterionPadBreak.trigger(((EntityPlayerMP) ply).getAdvancements()); } @@ -101,6 +105,7 @@ public class ItemMinePad2 extends Item { } @Override + @Nonnull public String getUnlocalizedName(ItemStack stack) { String ret = getUnlocalizedName(); if(stack.getMetadata() > 0) diff --git a/src/main/java/net/montoyo/wd/item/ItemMulti.java b/src/main/java/net/montoyo/wd/item/ItemMulti.java new file mode 100644 index 0000000..54eb8b7 --- /dev/null +++ b/src/main/java/net/montoyo/wd/item/ItemMulti.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; + +import javax.annotation.Nonnull; +import java.util.BitSet; + +public class ItemMulti extends Item { + + protected final Enum[] values; + protected final BitSet creativeTabItems; + + public ItemMulti(Class cls) { + values = cls.getEnumConstants(); + creativeTabItems = new BitSet(values.length); + creativeTabItems.set(0, values.length); + setHasSubtypes(true); + setMaxDamage(0); + } + + @Override + @Nonnull + public String getUnlocalizedName(ItemStack stack) { + int meta = stack.getMetadata(); + String ret = getUnlocalizedName(); + + if(meta >= 0 && meta < values.length) + return ret + '.' + values[meta]; + else + return ret; + } + + @Override + public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { + if(isInCreativeTab(tab)) { + for(int i = 0; i < values.length; i++) { + if(creativeTabItems.get(i)) + items.add(new ItemStack(this, 1, i)); + } + } + } + + public Enum[] getEnumValues() { + return values; + } + +} diff --git a/src/main/java/net/montoyo/wd/item/ItemUpgrade.java b/src/main/java/net/montoyo/wd/item/ItemUpgrade.java index 94c0c05..7074deb 100644 --- a/src/main/java/net/montoyo/wd/item/ItemUpgrade.java +++ b/src/main/java/net/montoyo/wd/item/ItemUpgrade.java @@ -7,11 +7,8 @@ package net.montoyo.wd.item; import com.mojang.realmsclient.gui.ChatFormatting; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.montoyo.wd.WebDisplays; import net.montoyo.wd.core.DefaultUpgrade; @@ -23,13 +20,12 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; -public class ItemUpgrade extends Item implements IUpgrade { +public class ItemUpgrade extends ItemMulti implements IUpgrade { public ItemUpgrade() { + super(DefaultUpgrade.class); setUnlocalizedName("webdisplays.upgrade"); setRegistryName("upgrade"); - setHasSubtypes(true); - setMaxDamage(0); setCreativeTab(WebDisplays.CREATIVE_TAB); } @@ -50,34 +46,11 @@ public class ItemUpgrade extends Item implements IUpgrade { return otherStack.getItem() == this && otherStack.getMetadata() == myStack.getMetadata(); } - @Override - @Nonnull - public String getUnlocalizedName(ItemStack stack) { - int meta = stack.getMetadata(); - DefaultUpgrade[] names = DefaultUpgrade.values(); - String ret = getUnlocalizedName(); - - if(meta >= 0 && meta < names.length) - return ret + '.' + names[meta].getName(); - else - return ret; - } - @Override public void addInformation(ItemStack is, @Nullable World world, List tt, ITooltipFlag ttFlags) { tt.add("" + ChatFormatting.ITALIC + I18n.format("item.webdisplays.upgrade.name")); } - @Override - public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList items) { - if(isInCreativeTab(tab)) { - int cnt = DefaultUpgrade.values().length; - - for(int i = 0; i < cnt; i++) - items.add(new ItemStack(this, 1, i)); - } - } - @Override public String getJSName(@Nonnull ItemStack is) { int meta = is.getMetadata(); @@ -86,7 +59,7 @@ public class ItemUpgrade extends Item implements IUpgrade { if(meta < 0 || meta >= upgrades.length) return "webdisplays:wtf"; else - return "webdisplays:" + upgrades[meta].getName(); + return "webdisplays:" + upgrades[meta]; } } diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/keyboard_cat.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/keyboard_cat.json new file mode 100644 index 0000000..08d2421 --- /dev/null +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/keyboard_cat.json @@ -0,0 +1,13 @@ +{ + "display": { + "icon": { "item": "minecraft:skull", "data": 3, "nbt": "{SkullOwner:\"MHF_Ocelot\"}" }, + "title": { "translate": "advancements.webdisplays.keyboardcat.title" }, + "description": { "translate": "advancements.webdisplays.keyboardcat.description" } + }, + "parent": "webdisplays:webdisplays/link_peripheral", + "criteria": { + "keyboard_cat": { + "trigger": "webdisplays:keyboard_cat" + } + } +} diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/laser.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/laser.json new file mode 100644 index 0000000..145aff7 --- /dev/null +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/laser.json @@ -0,0 +1,16 @@ +{ + "display": { + "icon": { "item": "webdisplays:laserpointer" }, + "title": { "translate": "advancements.webdisplays.laser.title" }, + "description": { "translate": "advancements.webdisplays.laser.description" } + }, + "parent": "webdisplays:webdisplays/pad_break", + "criteria": { + "has_laser": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ { "item": "webdisplays:laserpointer" } ] + } + } + } +} diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/link_peripheral.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/link_peripheral.json new file mode 100644 index 0000000..c5deb06 --- /dev/null +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/link_peripheral.json @@ -0,0 +1,13 @@ +{ + "display": { + "icon": { "item": "webdisplays:linker" }, + "title": { "translate": "advancements.webdisplays.linkperipheral.title" }, + "description": { "translate": "advancements.webdisplays.linkperipheral.description" } + }, + "parent": "webdisplays:webdisplays/screen", + "criteria": { + "link_peripheral": { + "trigger": "webdisplays:link_peripheral" + } + } +} diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/minepad.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/minepad.json index 3640498..4b5001a 100644 --- a/src/main/resources/assets/webdisplays/advancements/webdisplays/minepad.json +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/minepad.json @@ -9,8 +9,13 @@ "has_glass_pane": { "trigger": "minecraft:inventory_changed", "conditions": { - "items": [ { "item": "webdisplays:minepad" } ] + "items": [ { "item": "webdisplays:minepad", "data": 0 } ] } } + }, + "rewards": { + "recipes": [ + "webdisplays:minepad2" + ] } } diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/minepad2.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/minepad2.json new file mode 100644 index 0000000..99d69a7 --- /dev/null +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/minepad2.json @@ -0,0 +1,16 @@ +{ + "display": { + "icon": { "item": "webdisplays:advicon", "data": 2 }, + "title": { "translate": "advancements.webdisplays.minepad2.title" }, + "description": { "translate": "advancements.webdisplays.minepad2.description" } + }, + "parent": "webdisplays:webdisplays/minepad", + "criteria": { + "has_minepad2": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ { "item": "webdisplays:minepad", "data": 1 } ] + } + } + } +} diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/pad_break.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/pad_break.json index e828fe6..f7f1b09 100644 --- a/src/main/resources/assets/webdisplays/advancements/webdisplays/pad_break.json +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/pad_break.json @@ -1,6 +1,6 @@ { "display": { - "icon": { "item": "webdisplays:minepad" }, + "icon": { "item": "webdisplays:advicon", "data": 1 }, "title": { "translate": "advancements.webdisplays.padbreak.title" }, "description": { "translate": "advancements.webdisplays.padbreak.description" } }, @@ -9,5 +9,17 @@ "pad_break": { "trigger": "webdisplays:pad_break" } + }, + "rewards": { + "recipes": [ + "webdisplays:extcard", + "webdisplays:upgrade", + "webdisplays:laserdiode", + "webdisplays:laserpointer", + "webdisplays:upgrade_gps", + "webdisplays:upgrade_laser", + "webdisplays:upgrade_redin", + "webdisplays:upgrade_redout" + ] } } diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/root.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/root.json index af0fd9c..03d5191 100644 --- a/src/main/resources/assets/webdisplays/advancements/webdisplays/root.json +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/root.json @@ -1,6 +1,6 @@ { "display": { - "icon": { "item": "webdisplays:screen" }, + "icon": { "item": "webdisplays:advicon", "data": 0 }, "title": { "translate": "advancements.webdisplays.root.title" }, "description": { "translate": "advancements.webdisplays.root.description" }, "background": "minecraft:textures/gui/advancements/backgrounds/stone.png", diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/screen.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/screen.json index 75608e9..a9969ea 100644 --- a/src/main/resources/assets/webdisplays/advancements/webdisplays/screen.json +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/screen.json @@ -6,7 +6,7 @@ }, "parent": "webdisplays:webdisplays/root", "criteria": { - "has_glass_pane": { + "has_screen": { "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { "item": "webdisplays:screen" } ] @@ -17,11 +17,13 @@ "recipes": [ "webdisplays:linker", "webdisplays:screencfg", + "webdisplays:peripheral", "webdisplays:rctrl", - "webdisplays:ccinterface", "webdisplays:ocinterface", "webdisplays:redctrl1", - "webdisplays:redctrl2" + "webdisplays:redctrl2", + "webdisplays:stonekey", + "webdisplays:keyboard" ] } } diff --git a/src/main/resources/assets/webdisplays/advancements/webdisplays/upgrade.json b/src/main/resources/assets/webdisplays/advancements/webdisplays/upgrade.json new file mode 100644 index 0000000..a1eb239 --- /dev/null +++ b/src/main/resources/assets/webdisplays/advancements/webdisplays/upgrade.json @@ -0,0 +1,13 @@ +{ + "display": { + "icon": { "item": "webdisplays:craftcomp", "data": 1 }, + "title": { "translate": "advancements.webdisplays.upgrade.title" }, + "description": { "translate": "advancements.webdisplays.upgrade.description" } + }, + "parent": "webdisplays:webdisplays/pad_break", + "criteria": { + "upgrade_screen": { + "trigger": "webdisplays:upgrade_screen" + } + } +} diff --git a/src/main/resources/assets/webdisplays/lang/en_us.lang b/src/main/resources/assets/webdisplays/lang/en_us.lang index edb9c12..b008a66 100644 --- a/src/main/resources/assets/webdisplays/lang/en_us.lang +++ b/src/main/resources/assets/webdisplays/lang/en_us.lang @@ -17,6 +17,8 @@ item.webdisplays.craftcomp.batcell.name=Battery Cell item.webdisplays.craftcomp.batpack.name=Battery Pack item.webdisplays.craftcomp.laserdiode.name=650nm Laser Diode item.webdisplays.craftcomp.backlight.name=Backlight +item.webdisplays.craftcomp.extcard.name=Extension Card +item.webdisplays.craftcomp.badextcard.name=Bad Extension Card item.webdisplays.minepad.name=minePad item.webdisplays.minepad2.name=minePad 2 item.webdisplays.upgrade.name=Screen Upgrade @@ -25,6 +27,10 @@ item.webdisplays.upgrade.redinput.name=Redstone Input Port item.webdisplays.upgrade.redoutput.name=Redstone Output Port item.webdisplays.upgrade.gps.name=GPS Module item.webdisplays.laserpointer.name=Laser Pointer +item.webdisplays.advicon.name=Advancement Icon +item.webdisplays.advicon.wd.name=WebDisplays +item.webdisplays.advicon.brokenpad.name=Broken minePad +item.webdisplays.advicon.pigeon.name=Pigeon webdisplays.message.tooSmall=Too small! Minimum size is 2x2. webdisplays.message.invalid=Structure is invalid; look at %s. webdisplays.message.turnOn=You need to turn the screen on first! @@ -42,7 +48,7 @@ webdisplays.message.missingCC=ComputerCraft is not available. webdisplays.message.missingOC=OpenComputers is not available. webdisplays.message.upgradeError=Upgrade error :( Check logs... webdisplays.message.upgradeOk=Upgrade installed! -webdisplays.gui.screencfg.owner=Screen owner: +webdisplays.gui.screencfg.owner=Screen owner: webdisplays.gui.screencfg.friends=Friends: webdisplays.gui.screencfg.permissions=Permissions: webdisplays.gui.screencfg.seturl=Change URL @@ -64,6 +70,10 @@ webdisplays.gui.seturl.ok=OK webdisplays.gui.seturl.cancel=Cancel webdisplays.gui.seturl.shutdown=Shut down webdisplays.minepad.turnon=Sneak and right-click to turn on +webdisplays.minepad2.info=NO REFUNDS! +webdisplays.extcard.cantcraft1=You don't know enough yet. +webdisplays.extcard.cantcraft2=You WILL FAIL at crafting this item. +webdisplays.extcard.bad=Someone failed at crafting an extension card webdisplays.gui.keyboard.hooked=Keyboard hooked. Press escape to leave. webdisplays.gui.keyboard.warning1=WARNING! Typed data are sent in PLAIN TEXT to the server. webdisplays.gui.keyboard.warning2=This means anyone can know what you're up to. @@ -79,3 +89,11 @@ advancements.webdisplays.padbreak.title=Reverse Engineering advancements.webdisplays.padbreak.description=These things are fragile! Don't drop a minePad from high place to unlock the upgrade recipes advancements.webdisplays.minepad2.title=Pigeon advancements.webdisplays.minepad2.description=Craft a minePad 2. Look, I know it's expensive, but that means it's better than anything else, right? ...right? +advancements.webdisplays.linkperipheral.title=It's wireless! +advancements.webdisplays.linkperipheral.description=Link a peripheral to a screen +advancements.webdisplays.keyboardcat.title=DAMN CATS +advancements.webdisplays.keyboardcat.description=Have an ocelot walk on your keyboard +advancements.webdisplays.upgrade.title=More than a screen +advancements.webdisplays.upgrade.description=Install your first upgrade +advancements.webdisplays.laser.title=Don't aim the eyes +advancements.webdisplays.laser.description=Craft a laser pointer! diff --git a/src/main/resources/assets/webdisplays/models/item/advicon_brokenpad.json b/src/main/resources/assets/webdisplays/models/item/advicon_brokenpad.json new file mode 100644 index 0000000..fdb78e7 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/advicon_brokenpad.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/advicon_brokenpad" + } +} diff --git a/src/main/resources/assets/webdisplays/models/item/advicon_pigeon.json b/src/main/resources/assets/webdisplays/models/item/advicon_pigeon.json new file mode 100644 index 0000000..fcdf562 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/advicon_pigeon.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/advicon_pigeon" + } +} diff --git a/src/main/resources/assets/webdisplays/models/item/advicon_wd.json b/src/main/resources/assets/webdisplays/models/item/advicon_wd.json new file mode 100644 index 0000000..01dbab3 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/advicon_wd.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/advicon_wd" + } +} diff --git a/src/main/resources/assets/webdisplays/models/item/craftcomp_badextcard.json b/src/main/resources/assets/webdisplays/models/item/craftcomp_badextcard.json new file mode 100644 index 0000000..b983a3c --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/craftcomp_badextcard.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/badextcard" + } +} diff --git a/src/main/resources/assets/webdisplays/models/item/craftcomp_extcard.json b/src/main/resources/assets/webdisplays/models/item/craftcomp_extcard.json new file mode 100644 index 0000000..2327737 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/craftcomp_extcard.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/extcard" + } +} diff --git a/src/main/resources/assets/webdisplays/recipes/backlight.json b/src/main/resources/assets/webdisplays/recipes/backlight.json index 78d33a6..8db28d9 100644 --- a/src/main/resources/assets/webdisplays/recipes/backlight.json +++ b/src/main/resources/assets/webdisplays/recipes/backlight.json @@ -14,6 +14,7 @@ }, "result": { "item": "webdisplays:craftcomp", - "data": 6 + "data": 6, + "count": 1 } } diff --git a/src/main/resources/assets/webdisplays/recipes/ccinterface.json b/src/main/resources/assets/webdisplays/recipes/ccinterface.json deleted file mode 100644 index 9fda532..0000000 --- a/src/main/resources/assets/webdisplays/recipes/ccinterface.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern": [ - "CCC", - "CSC", - "CCC" - ], - "key": { - "C": { - "item": "minecraft:dye", - "data": 6 - }, - "S": { - "item": "webdisplays:screen" - } - }, - "result": { - "item": "webdisplays:peripheral", - "data": 1 - } -} diff --git a/src/main/resources/assets/webdisplays/recipes/extcard.json b/src/main/resources/assets/webdisplays/recipes/extcard.json new file mode 100644 index 0000000..290b0f8 --- /dev/null +++ b/src/main/resources/assets/webdisplays/recipes/extcard.json @@ -0,0 +1,31 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "CTR", + "IGD" + ], + "key": { + "C": { + "item": "minecraft:comparator" + }, + "T": { + "item": "minecraft:redstone_torch" + }, + "R": { + "item": "minecraft:repeater" + }, + "I": { + "item": "minecraft:iron_ingot" + }, + "G": { + "item": "minecraft:gold_ingot" + }, + "D": { + "item": "minecraft:redstone" + } + }, + "result": { + "item": "webdisplays:craftcomp", + "data": 7 + } +} diff --git a/src/main/resources/assets/webdisplays/recipes/keyboard.json b/src/main/resources/assets/webdisplays/recipes/keyboard.json index 675944b..30bc9b0 100644 --- a/src/main/resources/assets/webdisplays/recipes/keyboard.json +++ b/src/main/resources/assets/webdisplays/recipes/keyboard.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "pattern": [ "KKK", - "KRK", + "KPK", "KKK" ], "key": { @@ -10,12 +10,14 @@ "item": "webdisplays:craftcomp", "data": 0 }, - "R": { - "item": "minecraft:redstone" + "P": { + "item": "webdisplays:craftcomp", + "data": 2 } }, "result": { "item": "webdisplays:peripheral", - "data": 0 + "data": 0, + "count": 1 } } diff --git a/src/main/resources/assets/webdisplays/recipes/linker.json b/src/main/resources/assets/webdisplays/recipes/linker.json index ea8a391..cc0ca85 100644 --- a/src/main/resources/assets/webdisplays/recipes/linker.json +++ b/src/main/resources/assets/webdisplays/recipes/linker.json @@ -20,6 +20,7 @@ } }, "result": { - "item": "webdisplays:linker" + "item": "webdisplays:linker", + "count": 1 } } diff --git a/src/main/resources/assets/webdisplays/recipes/minepad.json b/src/main/resources/assets/webdisplays/recipes/minepad.json index 7842490..1d8aff5 100644 --- a/src/main/resources/assets/webdisplays/recipes/minepad.json +++ b/src/main/resources/assets/webdisplays/recipes/minepad.json @@ -31,6 +31,7 @@ }, "result": { "item": "webdisplays:minepad", - "data": 0 + "data": 0, + "count": 1 } } diff --git a/src/main/resources/assets/webdisplays/recipes/minepad2.json b/src/main/resources/assets/webdisplays/recipes/minepad2.json index af5ac84..d949339 100644 --- a/src/main/resources/assets/webdisplays/recipes/minepad2.json +++ b/src/main/resources/assets/webdisplays/recipes/minepad2.json @@ -16,6 +16,7 @@ }, "result": { "item": "webdisplays:minepad", - "data": 1 + "data": 1, + "count": 1 } } diff --git a/src/main/resources/assets/webdisplays/recipes/peripheral.json b/src/main/resources/assets/webdisplays/recipes/peripheral.json new file mode 100644 index 0000000..91681ec --- /dev/null +++ b/src/main/resources/assets/webdisplays/recipes/peripheral.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "SSS", + "STS", + "SSS" + ], + "key": { + "S": { + "item": "minecraft:wooden_slab", + "data": 0 + }, + "T": { + "item": "minecraft:redstone_torch" + } + }, + "result": { + "item": "webdisplays:craftcomp", + "data": 2, + "count": 1 + } +} diff --git a/src/main/resources/assets/webdisplays/recipes/rctrl.json b/src/main/resources/assets/webdisplays/recipes/rctrl.json index 9c11cd0..fa4d1ab 100644 --- a/src/main/resources/assets/webdisplays/recipes/rctrl.json +++ b/src/main/resources/assets/webdisplays/recipes/rctrl.json @@ -1,12 +1,13 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - " E ", + " P ", "BBB" ], "key": { - "E": { - "item": "minecraft:ender_pearl" + "P": { + "item": "webdisplays:craftcomp", + "data": 2 }, "B": { "item": "minecraft:wooden_button" diff --git a/src/main/resources/assets/webdisplays/recipes/redctrl1.json b/src/main/resources/assets/webdisplays/recipes/redctrl1.json index 253aa38..a8914ae 100644 --- a/src/main/resources/assets/webdisplays/recipes/redctrl1.json +++ b/src/main/resources/assets/webdisplays/recipes/redctrl1.json @@ -2,15 +2,16 @@ "type": "minecraft:crafting_shaped", "pattern": [ "RRR", - "RER", + "RPR", "BBB" ], "key": { "R": { "item": "minecraft:redstone" }, - "E": { - "item": "minecraft:ender_pearl" + "P": { + "item": "webdisplays:craftcomp", + "data": 2 }, "B": { "item": "minecraft:wooden_button" diff --git a/src/main/resources/assets/webdisplays/recipes/upgrade.json b/src/main/resources/assets/webdisplays/recipes/upgrade.json index 7c0e02f..5b804e9 100644 --- a/src/main/resources/assets/webdisplays/recipes/upgrade.json +++ b/src/main/resources/assets/webdisplays/recipes/upgrade.json @@ -1,16 +1,17 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - "QIQ", - "I I", - "QIQ" + " Q ", + "QEQ", + " Q " ], "key": { "Q": { "item": "minecraft:quartz" }, - "I": { - "item": "minecraft:iron_nugget" + "E": { + "item": "webdisplays:craftcomp", + "data": 7 } }, "result": { diff --git a/src/main/resources/assets/webdisplays/textures/items/advicon_brokenpad.png b/src/main/resources/assets/webdisplays/textures/items/advicon_brokenpad.png new file mode 100644 index 0000000000000000000000000000000000000000..a260b2ebed5040ce83077a35544a9dd412724485 GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPd6B9q1@ltoLe4vnQW=KSdbAE1aYF-JD%fR4Vl$uzQ znxasiS(2gP?&%wlqL<1J6u;@|;uvCa`f9KtSBnFWOuqP)Q@5-X#LB*L*B$8pp(?L9 z?UwEj_P}kz+|tpm)AqhPa!6Dse^z6Pk)jIYKRLh4CIMc#QQ6=96qdFK9GVy;rFcX# zz2~jVlftD}++5bJb-w?-W6_Hz+%Ze9eA`(1Pm#wt+b{cV-Mp^XyWFOwo|}9u>%nik zM;30gmc7_@ZjYJABo+n(U*T(|uJfM1=Q*{>B~XO#xy-Q{-<8jN=3!W|>J*D(f_XyE z+w#uG78kbZ9xFUj`aj&@Sec*8y}OFKr<)Qb{Pt<9DZT$+&l!JnLd=b1Vg9cm-+Q|H KxvXYp>vCU=@Qld)BP`3yuWO~!_Xk1Jg2zg@Rj^m*$InHpH3BC&UeHqLlH2Mmd4IluvgIAK_8_zA#d6xL z`m;r*=5