From 72d615e7b3bc67264cf97a28fc6cfa4c8c56a6a2 Mon Sep 17 00:00:00 2001 From: William Thompson Date: Sat, 15 Jul 2017 19:11:19 -0400 Subject: [PATCH] =?UTF-8?q?Updoot=20to=201.12=20=F0=9F=8E=BA=F0=9F=8E=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 59 +++++++-- project.gradle | 17 ++- .../elytradev/glasshearts/GlassHearts.java | 122 ++++++++++-------- .../glasshearts/block/BlockGlassHeart.java | 5 +- .../elytradev/glasshearts/block/BlockOre.java | 4 +- .../glasshearts/client/ClientProxy.java | 22 ++-- .../glasshearts/client/HeartRenderer.java | 4 +- .../glasshearts/client/RenderGlassHeart.java | 8 +- .../client/particle/ParticleAttune.java | 6 +- .../particle/ParticleRedstoneSeekEntity.java | 6 +- .../entity/EntityAICreeperSeekHeart.java | 5 - .../com/elytradev/glasshearts/gem/Gem.java | 40 +++--- .../integration/tcon/ModifierSapping.java | 61 --------- .../integration/tcon/TConIntegration.java | 14 -- .../elytradev/glasshearts/item/ItemGem.java | 4 +- .../glasshearts/world/GenerateGems.java | 2 +- .../world/GeneratePetrifiedTree.java | 8 +- .../world/GlassHeartWorldData.java | 2 +- 18 files changed, 185 insertions(+), 204 deletions(-) delete mode 100644 src/main/java/com/elytradev/glasshearts/integration/tcon/ModifierSapping.java delete mode 100644 src/main/java/com/elytradev/glasshearts/integration/tcon/TConIntegration.java diff --git a/build.gradle b/build.gradle index bcadf6a..db1d187 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,27 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2017 William Thompson (unascribed) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + buildscript { repositories { mavenCentral() @@ -15,8 +39,7 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' - classpath 'me.tatarka:gradle-retrolambda:3.2.0' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath 'net.sf.proguard:proguard-gradle:5.3.3' classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4' classpath 'gradle.plugin.net.minecrell:licenser:0.3' @@ -24,15 +47,33 @@ buildscript { } apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: 'me.tatarka.retrolambda' apply from: 'project.gradle' -println("Elytra Project Skeleton v1.0.1") +if (project.ext.useElytraVersionFormat) { + def branch; + if (System.env.BRANCH_NAME) { + // Jenkins support + branch = System.env.BRANCH_NAME; + branch = branch.substring(branch.lastIndexOf('/')+1); + } else { + branch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.trim(); + } + if (branch == "HEAD") { + branch = 'git rev-parse --short HEAD'.execute().in.text.trim(); + } + def commits = 'git rev-list --count HEAD'.execute().in.text.trim(); + def dirty = !'git diff-index HEAD'.execute().in.text.trim().isEmpty(); + version = branch+'-'+project.ext.version+'.'+commits+(dirty ? '-dirty' : ''); +} else { + version = project.ext.version; +} + +println("Elytra Project Skeleton v1.1.0") println("https://github.com/elytra/skel") println() println("Project Name: "+project.ext.projectName) -println("Version: "+project.ext.version) +println("Version: "+version) println() println("Package: "+project.ext.package) println() @@ -44,18 +85,12 @@ println("Mappings: "+project.ext.mappings) project.ext.priv = parseConfig(file('private.properties')) -group = "com.elytradev" +group = project.ext.group archivesBaseName = project.ext.projectName -version = project.ext.version sourceCompatibility = 1.8 targetCompatibility = 1.8 -retrolambda { - javaVersion JavaVersion.VERSION_1_6 - defaultMethods true -} - repositories { jcenter() mavenCentral() diff --git a/project.gradle b/project.gradle index ff2a4d8..9f9807d 100644 --- a/project.gradle +++ b/project.gradle @@ -1,13 +1,15 @@ +ext.group = 'com.elytradev' ext.package = 'com.elytradev.glasshearts' ext.projectName = 'GlassHearts' -ext.version = '1.11.2-1.0.1' +ext.version = '1.0' +ext.useElytraVersionFormat = true // 0.2.1 is the earliest Concrete version supported by the skeleton. -ext.concreteVersion = '0.2.1' +ext.concreteVersion = '0.3.2-SNAPSHOT' ext.concreteModules = [ 'common', 'network', 'reflect' ] -ext.forge = '1.11.2-13.20.0.2282' -ext.mappings = 'snapshot_20170205' +ext.forge = '1.12-14.21.1.2413' +ext.mappings = 'snapshot_20170715' ext.enforceLicenseHeaders = false @@ -22,11 +24,8 @@ repositories { } dependencies { - compile 'mezz.jei:jei_1.11.2:4.2.6.235:api' - runtime 'mezz.jei:jei_1.11.2:4.2.6.235' - - deobfCompile 'slimeknights.mantle:Mantle:1.11.2-1.2.0.27' - deobfCompile 'slimeknights:TConstruct:1.11.2-2.7.0.9' + compile 'mezz.jei:jei_1.12:4.7.2.76:api' + runtime 'mezz.jei:jei_1.12:4.7.2.76' } tasks.runServer.outputs.upToDateWhen { false } diff --git a/src/main/java/com/elytradev/glasshearts/GlassHearts.java b/src/main/java/com/elytradev/glasshearts/GlassHearts.java index 00f6984..c281961 100644 --- a/src/main/java/com/elytradev/glasshearts/GlassHearts.java +++ b/src/main/java/com/elytradev/glasshearts/GlassHearts.java @@ -6,6 +6,7 @@ import java.util.EnumSet; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; @@ -29,7 +30,6 @@ import com.elytradev.glasshearts.enums.EnumGemState; import com.elytradev.glasshearts.gem.Gem; import com.elytradev.glasshearts.init.Gems; -import com.elytradev.glasshearts.integration.tcon.TConIntegration; import com.elytradev.glasshearts.item.ItemBlockGlassHeart; import com.elytradev.glasshearts.item.ItemBlockOre; import com.elytradev.glasshearts.item.ItemGem; @@ -52,8 +52,11 @@ import com.google.common.base.Predicates; import com.google.common.collect.Lists; import com.google.common.collect.Sets; + +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -67,6 +70,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemGlassBottle; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -104,7 +108,6 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -195,11 +198,11 @@ public ItemStack getTabIconItem() { } }; - private Invoker rayTrace = Invokers.findMethod(Item.class, null, new String[] {"func_77621_a", "rayTrace", "a"}, World.class, EntityPlayer.class, boolean.class); - private Invoker applyArmorCalculations = Invokers.findMethod(EntityLivingBase.class, null, new String[] { "func_70655_b", "applyArmorCalculations", "b" }, DamageSource.class, float.class); - private Invoker applyPotionDamageCalculations = Invokers.findMethod(EntityLivingBase.class, null, new String[] { "func_70672_c", "applyPotionDamageCalculations", "c" }, DamageSource.class, float.class); + private Invoker rayTrace = Invokers.findMethod(Item.class, "rayTrace", "func_77621_a", World.class, EntityPlayer.class, boolean.class); + private Invoker applyArmorCalculations = Invokers.findMethod(EntityLivingBase.class, "applyArmorCalculations", "func_70655_b", DamageSource.class, float.class); + private Invoker applyPotionDamageCalculations = Invokers.findMethod(EntityLivingBase.class, "applyPotionDamageCalculations", "func_70672_c", DamageSource.class, float.class); - private Invoker explode = Invokers.findMethod(EntityCreeper.class, null, new String[] { "func_146077_cc", "explode", "dn" }); + private Invoker explode = Invokers.findMethod(EntityCreeper.class, "explode", "func_146077_cc"); private Map playerHandlers = new WeakHashMap<>(); @@ -293,85 +296,111 @@ public void onPreInit(FMLPreInitializationEvent e) { LIFEFORCE.setViscosity(750); FluidRegistry.registerFluid(LIFEFORCE); - LIFEFORCE_BLOCK = new BlockFluidLifeforce(LIFEFORCE, Material.WATER); - LIFEFORCE.setBlock(LIFEFORCE_BLOCK); - FluidRegistry.addBucketForFluid(LIFEFORCE); - LIFEFORCE_BLOCK.setRegistryName("lifeforce_block"); - GameRegistry.register(LIFEFORCE_BLOCK); + GameRegistry.registerWorldGenerator(new GenerateGems(), 2); + + + + GameRegistry.registerTileEntity(TileEntityGlassHeart.class, "glasshearts:glass_heart"); + + //if (Loader.isModLoaded("tconstruct")) { + // TConIntegration.init(); + //} + + proxy.onPreInit(); + } + + @SubscribeEvent + public void onRegisterEnchantments(RegistryEvent.Register e) { SAPPING = new EnchantmentSapping(); SAPPING.setRegistryName("sapping"); - GameRegistry.register(SAPPING); - + e.getRegistry().register(SAPPING); + } + + @SubscribeEvent + public void onRegisterItems(RegistryEvent.Register e) { LIFEFORCE_BOTTLE = new ItemLifeforceBottle(); LIFEFORCE_BOTTLE.setRegistryName("lifeforce_bottle"); LIFEFORCE_BOTTLE.setCreativeTab(CREATIVE_TAB); - GameRegistry.register(LIFEFORCE_BOTTLE); + e.getRegistry().register(LIFEFORCE_BOTTLE); GEM = new ItemGem(); GEM.setRegistryName("gem"); GEM.setCreativeTab(CREATIVE_TAB); - GameRegistry.register(GEM); - - for (int i = 0; i < EnumGemOre.VALUES.length; i++) { - EnumGemOre gem = EnumGemOre.VALUES[i]; - OreDictionary.registerOre("gem"+gem.name().charAt(0)+gem.getName().substring(1), new ItemStack(GEM, 1, i)); - } + e.getRegistry().register(GEM); STAFF = new ItemStaff(); STAFF.setRegistryName("staff"); STAFF.setCreativeTab(CREATIVE_TAB); - GameRegistry.register(STAFF); + e.getRegistry().register(STAFF); + + e.getRegistry().register(new ItemBlockGlassHeart(GLASS_HEART).setRegistryName("glass_heart")); + e.getRegistry().register(new ItemBlockOre(ORE).setRegistryName("ore")); + e.getRegistry().register(new ItemBlock(PETRIFIED_LOG).setRegistryName("petrified_log")); + for (int i = 0; i < EnumGemOre.VALUES.length; i++) { + EnumGemOre gem = EnumGemOre.VALUES[i]; + OreDictionary.registerOre("gem"+gem.name().charAt(0)+gem.getName().substring(1), new ItemStack(GEM, 1, i)); + } + } + + @SubscribeEvent + public void onRegisterBlocks(RegistryEvent.Register e) { GLASS_HEART = new BlockGlassHeart(); GLASS_HEART.setRegistryName("glass_heart"); GLASS_HEART.setCreativeTab(CREATIVE_TAB); GLASS_HEART.setUnlocalizedName("glasshearts.glass_heart"); - GameRegistry.register(GLASS_HEART); - GameRegistry.register(new ItemBlockGlassHeart(GLASS_HEART).setRegistryName("glass_heart")); + e.getRegistry().register(GLASS_HEART); ORE = new BlockOre(); ORE.setRegistryName("ore"); ORE.setCreativeTab(CREATIVE_TAB); ORE.setUnlocalizedName("glasshearts.ore"); - GameRegistry.register(ORE); - GameRegistry.register(new ItemBlockOre(ORE).setRegistryName("ore")); + e.getRegistry().register(ORE); PETRIFIED_LOG = new BlockPetrifiedLog(); PETRIFIED_LOG.setRegistryName("petrified_log"); PETRIFIED_LOG.setCreativeTab(CREATIVE_TAB); PETRIFIED_LOG.setUnlocalizedName("glasshearts.petrified_log"); - GameRegistry.register(PETRIFIED_LOG); - GameRegistry.register(new ItemBlock(PETRIFIED_LOG).setRegistryName("petrified_log")); + e.getRegistry().register(PETRIFIED_LOG); + + LIFEFORCE_BLOCK = new BlockFluidLifeforce(LIFEFORCE, Material.WATER); + LIFEFORCE.setBlock(LIFEFORCE_BLOCK); + LIFEFORCE_BLOCK.setRegistryName("lifeforce_block"); + e.getRegistry().register(LIFEFORCE_BLOCK); + } + + @SubscribeEvent + public void onRegisterSounds(RegistryEvent.Register e) { SAP = new SoundEvent(new ResourceLocation("glasshearts", "sap")); SAP.setRegistryName("sap"); - GameRegistry.register(SAP); + e.getRegistry().register(SAP); ATTUNE = new SoundEvent(new ResourceLocation("glasshearts", "attune")); ATTUNE.setRegistryName("attune"); - GameRegistry.register(ATTUNE); - - GameRegistry.registerWorldGenerator(new GenerateGems(), 2); - - - GameRegistry.addRecipe(new ShapedOreRecipe(STAFF, + e.getRegistry().register(ATTUNE); + } + + @SubscribeEvent + public void onRegisterRecipes(RegistryEvent.Register e) { + e.getRegistry().register(new ShapedOreRecipe(null, STAFF, " o", " //", "/ ", '/', Items.BLAZE_ROD, - 'o', "gemOpal")); + 'o', "gemOpal").setRegistryName("opal_staff")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(GLASS_HEART, 1, 0), + e.getRegistry().register(new ShapedOreRecipe(null, new ItemStack(GLASS_HEART, 1, 0), "g g", "ggg", " g ", - 'g', "blockGlassColorless")); + 'g', "blockGlassColorless").setRegistryName("glass_heart")); String[] dyes = { "Black", @@ -393,22 +422,13 @@ public void onPreInit(FMLPreInitializationEvent e) { }; for (int i = 0; i < dyes.length; i++) { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(GLASS_HEART, 1, 16-i), + e.getRegistry().register(new ShapedOreRecipe(null, new ItemStack(GLASS_HEART, 1, 16-i), "g g", "ggg", " g ", - 'g', "blockGlass"+dyes[i])); + 'g', "blockGlass"+dyes[i]).setRegistryName(dyes[i].toLowerCase(Locale.ROOT)+"_glass_heart")); } - - - GameRegistry.registerTileEntity(TileEntityGlassHeart.class, "glasshearts:glass_heart"); - - if (Loader.isModLoaded("tconstruct")) { - TConIntegration.init(); - } - - proxy.onPreInit(); } @EventHandler @@ -705,8 +725,8 @@ public void onJoinWorld(EntityJoinWorldEvent e) { public void onDeath(LivingDeathEvent e) { if (!e.getEntityLiving().world.isRemote) { DamageSource src = e.getSource(); - if (src.getEntity() instanceof EntityPlayer) { - EntityPlayer p = (EntityPlayer)src.getEntity(); + if (src.getTrueSource() instanceof EntityPlayer) { + EntityPlayer p = (EntityPlayer)src.getTrueSource(); ItemStack held = p.getHeldItemMainhand(); if (configLifeforceFromPlayerKillsOnly) { if (!(e.getEntityLiving() instanceof EntityPlayer)) return; @@ -806,7 +826,7 @@ public static void sendUpdatePacket(TileEntity te, NBTTagCompound nbt) { Chunk c = te.getWorld().getChunkFromBlockCoords(te.getPos()); SPacketUpdateTileEntity packet = new SPacketUpdateTileEntity(te.getPos(), te.getBlockMetadata(), nbt); for (EntityPlayerMP player : te.getWorld().getPlayers(EntityPlayerMP.class, Predicates.alwaysTrue())) { - if (ws.getPlayerChunkMap().isPlayerWatchingChunk(player, c.xPosition, c.zPosition)) { + if (ws.getPlayerChunkMap().isPlayerWatchingChunk(player, c.x, c.z)) { player.connection.sendPacket(packet); } } diff --git a/src/main/java/com/elytradev/glasshearts/block/BlockGlassHeart.java b/src/main/java/com/elytradev/glasshearts/block/BlockGlassHeart.java index 9f71fc3..a7d2d64 100644 --- a/src/main/java/com/elytradev/glasshearts/block/BlockGlassHeart.java +++ b/src/main/java/com/elytradev/glasshearts/block/BlockGlassHeart.java @@ -344,10 +344,11 @@ public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityGlassHeart(); } + @Override - public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { + public void getSubBlocks(CreativeTabs tab, NonNullList list) { for (int i = 0; i < 17; i++) { - list.add(new ItemStack(itemIn, 1, i)); + list.add(new ItemStack(this, 1, i)); } } diff --git a/src/main/java/com/elytradev/glasshearts/block/BlockOre.java b/src/main/java/com/elytradev/glasshearts/block/BlockOre.java index c905906..64fb3aa 100644 --- a/src/main/java/com/elytradev/glasshearts/block/BlockOre.java +++ b/src/main/java/com/elytradev/glasshearts/block/BlockOre.java @@ -47,9 +47,9 @@ public IBlockState getStateFromMeta(int meta) { } @Override - public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { + public void getSubBlocks(CreativeTabs tab, NonNullList list) { for (int i = 0; i < EnumGemOre.VALUES_WITHOUT_AMBER.length; i++) { - list.add(new ItemStack(itemIn, 1, i)); + list.add(new ItemStack(this, 1, i)); } } diff --git a/src/main/java/com/elytradev/glasshearts/client/ClientProxy.java b/src/main/java/com/elytradev/glasshearts/client/ClientProxy.java index 7efd026..e18fcba 100644 --- a/src/main/java/com/elytradev/glasshearts/client/ClientProxy.java +++ b/src/main/java/com/elytradev/glasshearts/client/ClientProxy.java @@ -27,6 +27,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; +import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.model.ModelLoader; @@ -46,6 +47,14 @@ public class ClientProxy extends CommonProxy { @Override public void onPreInit() { super.onPreInit(); + + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGlassHeart.class, new RenderGlassHeart()); + + MinecraftForge.EVENT_BUS.register(this); + } + + @SubscribeEvent + public void onModelRegister(ModelRegistryEvent e) { ModelLoader.setCustomModelResourceLocation(GlassHearts.inst.LIFEFORCE_BOTTLE, 0, new ModelResourceLocation("glasshearts:lifeforce_bottle#inventory")); ModelLoader.setCustomModelResourceLocation(GlassHearts.inst.STAFF, 0, new ModelResourceLocation("glasshearts:staff#inventory")); @@ -61,15 +70,12 @@ public void onPreInit() { } } ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GlassHearts.inst.PETRIFIED_LOG), 0, new ModelResourceLocation("glasshearts:petrified_log#axis=y")); - - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGlassHeart.class, new RenderGlassHeart()); - - MinecraftForge.EVENT_BUS.register(this); } @Override public void onPostInit() { super.onPostInit(); + Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() { @Override @@ -136,7 +142,7 @@ public void onTooltip(ItemTooltipEvent e) { Gem gem = Gem.fromItemStack(e.getItemStack()); if (gem != Gems.NONE) { String swp = null; - if (e.isShowAdvancedItemTooltips()) { + if (e.getFlags().isAdvanced()) { swp = e.getToolTip().remove(e.getToolTip().size()-1); } if (I18n.hasKey("tooltip.glasshearts.when_heart_adorned."+gem.getRegistryName().getResourcePath())) { @@ -153,7 +159,7 @@ public void onTooltip(ItemTooltipEvent e) { e.getToolTip().add(" \u00A79"+l); } } - if (e.isShowAdvancedItemTooltips() && swp != null) { + if (e.getFlags().isAdvanced() && swp != null) { e.getToolTip().add(swp); } } @@ -194,8 +200,8 @@ public void onTick(ClientTickEvent e) { Vec3d aPos = base.add(dir); Vec3d bPos = base.subtract(dir); - ParticleRedstone a = new ParticleRedstone(Minecraft.getMinecraft().world, aPos.xCoord, aPos.yCoord, aPos.zCoord, 1f, 1f, 1f, 1f) {}; - ParticleRedstone b = new ParticleRedstone(Minecraft.getMinecraft().world, bPos.xCoord, bPos.yCoord, bPos.zCoord, 1f, 1f, 1f, 1f) {}; + ParticleRedstone a = new ParticleRedstone(Minecraft.getMinecraft().world, aPos.x, aPos.y, aPos.z, 1f, 1f, 1f, 1f) {}; + ParticleRedstone b = new ParticleRedstone(Minecraft.getMinecraft().world, bPos.x, bPos.y, bPos.z, 1f, 1f, 1f, 1f) {}; int gemColor = tegh.getGem().getColor(); diff --git a/src/main/java/com/elytradev/glasshearts/client/HeartRenderer.java b/src/main/java/com/elytradev/glasshearts/client/HeartRenderer.java index 4a2979f..e7e30b5 100644 --- a/src/main/java/com/elytradev/glasshearts/client/HeartRenderer.java +++ b/src/main/java/com/elytradev/glasshearts/client/HeartRenderer.java @@ -16,9 +16,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.EntityPlayer; @@ -321,7 +321,7 @@ public static void drawModalRectWithCustomSizedTexture(float x, float y, float u public static void drawModalRect(float x, float y, float width, float height, float minU, float minV, float maxU, float maxV) { Tessellator tess = Tessellator.getInstance(); - VertexBuffer vb = tess.getBuffer(); + BufferBuilder vb = tess.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(x, y + height, 0).tex(minU, maxV).endVertex(); vb.pos(x + width, y + height, 0).tex(maxU, maxV).endVertex(); diff --git a/src/main/java/com/elytradev/glasshearts/client/RenderGlassHeart.java b/src/main/java/com/elytradev/glasshearts/client/RenderGlassHeart.java index b6165cd..150a6b5 100644 --- a/src/main/java/com/elytradev/glasshearts/client/RenderGlassHeart.java +++ b/src/main/java/com/elytradev/glasshearts/client/RenderGlassHeart.java @@ -13,9 +13,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockModelRenderer; import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.GlStateManager.DestFactor; import net.minecraft.client.renderer.GlStateManager.SourceFactor; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -35,8 +35,8 @@ public static float getAnimTime(TileEntityGlassHeart te, float partialTicks) { } @Override - public void renderTileEntityAt(TileEntityGlassHeart te, double x, double y, double z, float partialTicks, int destroyStage) { - super.renderTileEntityAt(te, x, y, z, partialTicks, destroyStage); + public void render(TileEntityGlassHeart te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { + super.render(te, x, y, z, partialTicks, destroyStage, alpha); BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher(); BlockModelRenderer bmr = brd.getBlockModelRenderer(); @@ -165,7 +165,7 @@ private void renderFill(float amt) { private void renderCube(int x, int y, int z, float w, float h, float d, TextureAtlasSprite tas, boolean renderTop, boolean renderBottom, boolean renderSides) { Tessellator tess = Tessellator.getInstance(); - VertexBuffer vb = tess.getBuffer(); + BufferBuilder vb = tess.getBuffer(); float minVX = tas.getInterpolatedV(x); float maxVX = tas.getInterpolatedV(x+w); diff --git a/src/main/java/com/elytradev/glasshearts/client/particle/ParticleAttune.java b/src/main/java/com/elytradev/glasshearts/client/particle/ParticleAttune.java index 9fa75c2..b5c52cd 100644 --- a/src/main/java/com/elytradev/glasshearts/client/particle/ParticleAttune.java +++ b/src/main/java/com/elytradev/glasshearts/client/particle/ParticleAttune.java @@ -22,9 +22,9 @@ public void onUpdate() { if (particleAge > 20) { Vec3d diff = seek.getPositionVector().addVector(0, seek.height/2, 0).subtract(posX, posY, posZ).normalize().scale(0.4); - motionX = diff.xCoord; - motionY = diff.yCoord; - motionZ = diff.zCoord; + motionX = diff.x; + motionY = diff.y; + motionZ = diff.z; if (seek.getDistanceSq(posX, posY-seek.height/2, posZ) < 0.1) { setExpired(); diff --git a/src/main/java/com/elytradev/glasshearts/client/particle/ParticleRedstoneSeekEntity.java b/src/main/java/com/elytradev/glasshearts/client/particle/ParticleRedstoneSeekEntity.java index 9c9c97e..e90dc5f 100644 --- a/src/main/java/com/elytradev/glasshearts/client/particle/ParticleRedstoneSeekEntity.java +++ b/src/main/java/com/elytradev/glasshearts/client/particle/ParticleRedstoneSeekEntity.java @@ -21,9 +21,9 @@ public void onUpdate() { Vec3d diff = seek.getPositionVector().addVector(0, seek.height/2, 0).subtract(posX, posY, posZ); - double targetX = diff.xCoord; - double targetY = diff.yCoord; - double targetZ = diff.zCoord; + double targetX = diff.x; + double targetY = diff.y; + double targetZ = diff.z; double diffX = targetX-motionX; double diffY = targetY-motionY; double diffZ = targetZ-motionZ; diff --git a/src/main/java/com/elytradev/glasshearts/entity/EntityAICreeperSeekHeart.java b/src/main/java/com/elytradev/glasshearts/entity/EntityAICreeperSeekHeart.java index 9d6f394..61be2fe 100644 --- a/src/main/java/com/elytradev/glasshearts/entity/EntityAICreeperSeekHeart.java +++ b/src/main/java/com/elytradev/glasshearts/entity/EntityAICreeperSeekHeart.java @@ -25,11 +25,6 @@ public boolean shouldExecute() { return super.shouldExecute(); } - @Override - public boolean continueExecuting() { - return super.continueExecuting(); - } - @Override public void updateTask() { super.updateTask(); diff --git a/src/main/java/com/elytradev/glasshearts/gem/Gem.java b/src/main/java/com/elytradev/glasshearts/gem/Gem.java index 9c86569..2d00906 100644 --- a/src/main/java/com/elytradev/glasshearts/gem/Gem.java +++ b/src/main/java/com/elytradev/glasshearts/gem/Gem.java @@ -12,21 +12,20 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.common.registry.IForgeRegistryEntry; -import net.minecraftforge.fml.common.registry.RegistryBuilder; +import net.minecraftforge.registries.ForgeRegistry; +import net.minecraftforge.registries.RegistryBuilder; +import net.minecraftforge.registries.IForgeRegistryEntry;; public abstract class Gem extends IForgeRegistryEntry.Impl { - public static FMLControlledNamespacedRegistry REGISTRY; + public static ForgeRegistry REGISTRY; private static final ResourceLocation MISSING = new ResourceLocation("glasshearts", "this/definitely/does/not/exist.png"); public static Gem getGemById(int id) { - return REGISTRY.getObjectById(id); + return REGISTRY.getValue(id); } public static int getIdForGem(Gem gem) { - return REGISTRY.getId(gem); + return REGISTRY.getID(gem); } @@ -152,7 +151,7 @@ public int getHeight() { public static void registerGemRegistry() { - REGISTRY = (FMLControlledNamespacedRegistry) new RegistryBuilder() + REGISTRY = (ForgeRegistry)new RegistryBuilder() .setIDRange(0, 254) .setName(new ResourceLocation("glasshearts", "gems")) .setType(Gem.class) @@ -161,17 +160,18 @@ public static void registerGemRegistry() { } public static void registerGems() { - GameRegistry.register((Gems.NONE = new GemNone()).setRegistryName("none")); - - GameRegistry.register((Gems.AGATE = new GemAgate()).setRegistryName("agate")); - GameRegistry.register((Gems.AMBER = new GemAmber()).setRegistryName("amber")); - GameRegistry.register((Gems.AMETHYST = new GemAmethyst()).setRegistryName("amethyst")); - GameRegistry.register((Gems.DIAMOND = new GemDiamond()).setRegistryName("diamond")); - GameRegistry.register((Gems.EMERALD = new GemEmerald()).setRegistryName("emerald")); - GameRegistry.register((Gems.ONYX = new GemOnyx()).setRegistryName("onyx")); - GameRegistry.register((Gems.OPAL = new GemOpal()).setRegistryName("opal")); - GameRegistry.register((Gems.RUBY = new GemRuby()).setRegistryName("ruby")); - GameRegistry.register((Gems.SAPPHIRE = new GemSapphire()).setRegistryName("sapphire")); - GameRegistry.register((Gems.TOPAZ = new GemTopaz()).setRegistryName("topaz")); + REGISTRY.registerAll( + (Gems.NONE = new GemNone()).setRegistryName("none"), + + (Gems.AGATE = new GemAgate()).setRegistryName("agate"), + (Gems.AMBER = new GemAmber()).setRegistryName("amber"), + (Gems.AMETHYST = new GemAmethyst()).setRegistryName("amethyst"), + (Gems.DIAMOND = new GemDiamond()).setRegistryName("diamond"), + (Gems.EMERALD = new GemEmerald()).setRegistryName("emerald"), + (Gems.ONYX = new GemOnyx()).setRegistryName("onyx"), + (Gems.OPAL = new GemOpal()).setRegistryName("opal"), + (Gems.RUBY = new GemRuby()).setRegistryName("ruby"), + (Gems.SAPPHIRE = new GemSapphire()).setRegistryName("sapphire"), + (Gems.TOPAZ = new GemTopaz()).setRegistryName("topaz")); } } diff --git a/src/main/java/com/elytradev/glasshearts/integration/tcon/ModifierSapping.java b/src/main/java/com/elytradev/glasshearts/integration/tcon/ModifierSapping.java deleted file mode 100644 index 193d457..0000000 --- a/src/main/java/com/elytradev/glasshearts/integration/tcon/ModifierSapping.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.elytradev.glasshearts.integration.tcon; - -import java.util.List; - -import com.elytradev.glasshearts.GlassHearts; -import com.google.common.collect.ImmutableList; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import slimeknights.tconstruct.library.Util; -import slimeknights.tconstruct.library.modifiers.ModifierAspect; -import slimeknights.tconstruct.library.modifiers.ModifierNBT; -import slimeknights.tconstruct.library.utils.TinkerUtil; -import slimeknights.tconstruct.library.utils.ToolBuilder; -import slimeknights.tconstruct.tools.modifiers.ToolModifier; - -public class ModifierSapping extends ToolModifier { - - // I don't know what I'm doing - // What even is the Tinkers' API - - public ModifierSapping() { - super("glasshearts.tcon.sapping", 0xFF1313); - - addAspects(ModifierAspect.weaponOnly); - addAspects(new ModifierAspect.MultiAspect(this, 10, 3, 1)); - } - - @Override - public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { - ModifierNBT data = ModifierNBT.readTag(modifierTag); - for (int i = 0; i < data.level; i++) { - ToolBuilder.addEnchantment(rootCompound, GlassHearts.inst.SAPPING); - } - } - - @Override - public List getExtraInfo(ItemStack tool, NBTTagCompound modifierTag) { - String loc = String.format(LOC_Extra, getIdentifier()); - return ImmutableList.of( - Util.translateFormatted(loc, Util.dfPercent.format(EnchantmentHelper.getEnchantmentLevel(GlassHearts.inst.SAPPING, tool)/10f)) - ); - } - - @Override - public String getTooltip(NBTTagCompound modifierTag, boolean detailed) { - ModifierNBT data = ModifierNBT.readTag(modifierTag); - int level = data.level; - - String tooltip = getLocalizedName(); - if (level > 0) { - tooltip += " " + TinkerUtil.getRomanNumeral(level); - } - - if (detailed) { - tooltip += " " + data.extraInfo; - } - return tooltip; - } - -} diff --git a/src/main/java/com/elytradev/glasshearts/integration/tcon/TConIntegration.java b/src/main/java/com/elytradev/glasshearts/integration/tcon/TConIntegration.java deleted file mode 100644 index 8ae4cc3..0000000 --- a/src/main/java/com/elytradev/glasshearts/integration/tcon/TConIntegration.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.elytradev.glasshearts.integration.tcon; - -import slimeknights.tconstruct.library.TinkerRegistry; - -public class TConIntegration { - - public static ModifierSapping SAPPING; - - public static void init() { - TinkerRegistry.registerModifier(SAPPING = new ModifierSapping()); - SAPPING.addItem("gemOpal"); - } - -} diff --git a/src/main/java/com/elytradev/glasshearts/item/ItemGem.java b/src/main/java/com/elytradev/glasshearts/item/ItemGem.java index 49bfddf..ca92453 100644 --- a/src/main/java/com/elytradev/glasshearts/item/ItemGem.java +++ b/src/main/java/com/elytradev/glasshearts/item/ItemGem.java @@ -19,9 +19,9 @@ public String getUnlocalizedName(ItemStack stack) { } @Override - public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList subItems) { + public void getSubItems(CreativeTabs tab, NonNullList subItems) { for (int i = 0; i < EnumGemOre.VALUES.length; i++) { - subItems.add(new ItemStack(itemIn, 1, i)); + subItems.add(new ItemStack(this, 1, i)); } } diff --git a/src/main/java/com/elytradev/glasshearts/world/GenerateGems.java b/src/main/java/com/elytradev/glasshearts/world/GenerateGems.java index c521c7d..055e7b9 100644 --- a/src/main/java/com/elytradev/glasshearts/world/GenerateGems.java +++ b/src/main/java/com/elytradev/glasshearts/world/GenerateGems.java @@ -9,8 +9,8 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.fml.common.IWorldGenerator; public class GenerateGems implements IWorldGenerator { diff --git a/src/main/java/com/elytradev/glasshearts/world/GeneratePetrifiedTree.java b/src/main/java/com/elytradev/glasshearts/world/GeneratePetrifiedTree.java index 360bdaf..1dbe226 100644 --- a/src/main/java/com/elytradev/glasshearts/world/GeneratePetrifiedTree.java +++ b/src/main/java/com/elytradev/glasshearts/world/GeneratePetrifiedTree.java @@ -12,19 +12,19 @@ import net.minecraft.init.Blocks; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkGenerator; -import net.minecraft.world.gen.ChunkProviderOverworld; +import net.minecraft.world.gen.ChunkGeneratorOverworld; +import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeDictionary.Type; public class GeneratePetrifiedTree { - private static final Accessor biomesForGeneration = Accessors.findField(ChunkProviderOverworld.class, "field_185981_C", "biomesForGeneration", "D"); + private static final Accessor biomesForGeneration = Accessors.findField(ChunkGeneratorOverworld.class, "field_185981_C", "biomesForGeneration", "D"); private static Random random = new Random(0); public static void generate(long seed, ChunkPrimer primer, IChunkGenerator gen) { - if (!(gen instanceof ChunkProviderOverworld)) return; + if (!(gen instanceof ChunkGeneratorOverworld)) return; random.setSeed(seed); diff --git a/src/main/java/com/elytradev/glasshearts/world/GlassHeartWorldData.java b/src/main/java/com/elytradev/glasshearts/world/GlassHeartWorldData.java index 6814291..abe9208 100644 --- a/src/main/java/com/elytradev/glasshearts/world/GlassHeartWorldData.java +++ b/src/main/java/com/elytradev/glasshearts/world/GlassHeartWorldData.java @@ -11,7 +11,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.WorldSavedData; +import net.minecraft.world.storage.WorldSavedData; import net.minecraftforge.common.util.Constants.NBT; public class GlassHeartWorldData extends WorldSavedData {