From 109264ddaa400a2785b9f629d02949352b9c9276 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 15 Nov 2017 16:43:44 -0500 Subject: [PATCH 01/87] Add code for link breakage handling, should never happen really in survival --- .../blocks/tiles/LeyLineTile.java | 24 +++++++++++++++++-- .../client/LeyLineTileRenderer.java | 6 ++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java index 50683b4..adecafa 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java @@ -141,15 +141,35 @@ public NBTTagCompound writeToNBT(NBTTagCompound compound) { return compound; } + public boolean isLinked() { + return !this.link_out.equals(BlockPos.ORIGIN) && !this.link_out.equals(BlockPos.ORIGIN.down()); + } + @Override public void update() { ticks = ticks + 0.1F; - if (!this.world.isRemote && !this.link_out.equals(BlockPos.ORIGIN) && this.world.isAreaLoaded(this.getPos(), 16)) { + + if (this.link_out.equals(BlockPos.ORIGIN.down())) { + this.link_out = BlockPos.ORIGIN; + markDirty(); + } + + if (!this.world.isRemote && this.isLinked() && this.world.isAreaLoaded(this.getPos(), 16)) { if (!this.getWorld().getBlockState(link_out).getBlock().equals(ModBlocks.leyLine)) { - link_out = BlockPos.ORIGIN; + link_out = BlockPos.ORIGIN.down(); markDirty(); + return; + } else { + LeyLineTile te = (LeyLineTile) this.world.getTileEntity(link_out); + if (te.getLinkOut().equals(BlockPos.ORIGIN.down())) { + System.out.println("Linked to BROKEN link node " + this.link_out); + this.link_out = BlockPos.ORIGIN.down(); + markDirty(); + return; + } } } + if (isLead) { delayCounter--; if (delayCounter <= 0 || lastList == null) { diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java index 123f1d7..769edf7 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java @@ -32,6 +32,10 @@ public void render(LeyLineTile te, double x, double y, double z, float partialTi int green = 0; if (te.isLead()) { green = 255; + } else if (te.getLinkOut().equals(BlockPos.ORIGIN.down())) { + red = 0; + blue = 255; + green = 0; } else { red = 255; blue = 255; @@ -84,7 +88,7 @@ public void render(LeyLineTile te, double x, double y, double z, float partialTi BlockPos pos = te.getLinkOut(); - if (!pos.equals(BlockPos.ORIGIN)) { + if (!pos.equals(BlockPos.ORIGIN) && !pos.equals(BlockPos.ORIGIN.down())) { GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); GlStateManager.disableAlpha(); From d19fde93f1dbc35495b14399334cbc7d774447a7 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 15 Nov 2017 16:47:02 -0500 Subject: [PATCH 02/87] Ensure unbreakability --- .../me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java index 8039e1e..40a5888 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java @@ -31,6 +31,7 @@ public class BlockLeyLine extends BlockTileEntity { public BlockLeyLine() { super(Material.ROCK, "leyline"); + this.setHardness(Float.POSITIVE_INFINITY); setUnlocalizedName(Reference.MOD_ID + ".leyline"); setRegistryName("leyline"); setCreativeTab(ModItems.CREATIVE_TAB); From c9c96c1ddef2b9a4e5535205220aae5e26327ca9 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 21 Nov 2017 01:43:30 -0500 Subject: [PATCH 03/87] Create card entity --- .../vigilant_eureka/items/ItemCard.java | 44 +++++++++++++++++++ .../vigilant_eureka/proxy/CommonProxy.java | 3 ++ .../vigilant_eureka/util/RayTraceHelper.java | 1 - 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java new file mode 100644 index 0000000..f133e17 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -0,0 +1,44 @@ +package me.itstheholyblack.vigilant_eureka.items; + +import me.itstheholyblack.vigilant_eureka.Reference; +import me.itstheholyblack.vigilant_eureka.entity.EntityCard; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.world.World; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class ItemCard extends Item { + + private static final double SPEED = 2; + + public ItemCard() { + setRegistryName(Reference.MOD_ID, "throwing_card"); + setUnlocalizedName(Reference.MOD_ID + ".throwing_card"); + setCreativeTab(ModItems.CREATIVE_TAB); + } + + public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { + ItemStack itemstack = playerIn.getHeldItem(handIn); + if (!playerIn.capabilities.isCreativeMode) { + itemstack.shrink(1); + } + if (!worldIn.isRemote) { + EntityCard c = new EntityCard(worldIn, playerIn, playerIn.getLook(1).x, playerIn.getLook(1).y, playerIn.getLook(1).z); + c.posY += playerIn.getEyeHeight(); + worldIn.spawnEntity(c); + } + return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); + } + + @SideOnly(Side.CLIENT) + public void initModel() { + ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory")); + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java index 758a77b..85f05f5 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java @@ -5,6 +5,7 @@ import me.itstheholyblack.vigilant_eureka.blocks.tiles.LeyLineTile; import me.itstheholyblack.vigilant_eureka.blocks.tiles.MovingCastleDoorTile; import me.itstheholyblack.vigilant_eureka.core.EventHandler; +import me.itstheholyblack.vigilant_eureka.entity.ModEntities; import me.itstheholyblack.vigilant_eureka.items.*; import me.itstheholyblack.vigilant_eureka.items.armor.InvisCap; import me.itstheholyblack.vigilant_eureka.items.armor.WarpBoots; @@ -36,6 +37,7 @@ public void preInit(FMLPreInitializationEvent e) { MinecraftForge.EVENT_BUS.register(new EventHandler()); FMLLog.log.info("Registering Vigilant Eureka networking."); PacketHandler.registerMessages(Reference.MOD_ID); + ModEntities.init(); } public void init(FMLInitializationEvent e) { @@ -74,6 +76,7 @@ public static void registerItems(RegistryEvent.Register event) { event.getRegistry().register(new ItemLeyKey()); event.getRegistry().register(new ItemLeyRune()); event.getRegistry().register(new DebugStick()); + event.getRegistry().register(new ItemCard()); Items.FIREWORKS.setCreativeTab(CreativeTabs.MISC); // please and thank you } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/util/RayTraceHelper.java b/src/main/java/me/itstheholyblack/vigilant_eureka/util/RayTraceHelper.java index 3a4bf7f..f40f744 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/util/RayTraceHelper.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/util/RayTraceHelper.java @@ -118,5 +118,4 @@ private static RayTraceResult tracePath(World world, float x, float y, float z, } return blockHit; } - } From 69a2e3c748e9699f5b1efde3a626ceeceae4e5ea Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 21 Nov 2017 01:43:47 -0500 Subject: [PATCH 04/87] Add base item to represent card --- .../vigilant_eureka/entity/EntityCard.java | 71 +++++++++++++++++++ .../vigilant_eureka/entity/ModEntities.java | 22 ++++++ 2 files changed, 93 insertions(+) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java new file mode 100644 index 0000000..00435a0 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -0,0 +1,71 @@ +package me.itstheholyblack.vigilant_eureka.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.math.MathHelper; +import net.minecraft.world.World; + +public class EntityCard extends Entity { + + private EntityLivingBase thrower; + + public double accelerationX; + public double accelerationY; + public double accelerationZ; + + public EntityCard(World world) { + this(world, null, 0, 0, 0); + } + + public EntityCard(World world, EntityLivingBase shooter, double accelX, double accelY, double accelZ) { + super(world); + setSize(1.0F, 1.0F); + this.thrower = shooter; + if (shooter != null) { + this.setLocationAndAngles(shooter.posX, shooter.posY, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); // sets pos and heading, not motion + this.setPosition(this.posX, this.posY, this.posZ); // possibly redundant, sets position again(?) + } + double d0 = (double) MathHelper.sqrt(accelX * accelX + accelY * accelY + accelZ * accelZ); + this.accelerationX = accelX / d0 * 0.5D; + this.accelerationY = accelY / d0 * 0.5D; + this.accelerationZ = accelZ / d0 * 0.5D; + } + + @Override + public void onUpdate() { + super.onUpdate(); + // update position based on velocity + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f = 0.95F; + // update velocity based on accel + this.motionX += this.accelerationX; + this.motionY += this.accelerationY; + this.motionZ += this.accelerationZ; + this.motionX *= (double)f; + this.motionY *= (double)f; + this.motionZ *= (double)f; + // finalize position update + this.setPosition(this.posX, this.posY, this.posZ); + } + + @Override + protected void entityInit() { + } + + @Override + protected void readEntityFromNBT(NBTTagCompound compound) { + + } + + @Override + protected void writeEntityToNBT(NBTTagCompound compound) { + + } + + public enum TYPES { + BLAND, SHARP, COLD, HOT, EXPLOSION, ENDERIC; + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java new file mode 100644 index 0000000..8120b34 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java @@ -0,0 +1,22 @@ +package me.itstheholyblack.vigilant_eureka.entity; + +import me.itstheholyblack.vigilant_eureka.Eureka; +import me.itstheholyblack.vigilant_eureka.Reference; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.registry.EntityRegistry; + +public class ModEntities { + public static void init() { + int id = 1; + EntityRegistry.registerModEntity( + new ResourceLocation("thrown_card"), + EntityCard.class, + Reference.MOD_ID + ":thrown_card", + id++, + Eureka.instance, + 64, + 1, + true + ); + } +} From a171cb9491162bad1859e4c275e78359a329306e Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 17:50:36 -0400 Subject: [PATCH 05/87] Update Forge --- .vscode/settings.json | 3 --- build.gradle | 6 +++--- src/main/resources/mcmod.info | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c5f3f6b..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "java.configuration.updateBuildConfiguration": "interactive" -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 94d43a7..153168b 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -version = "0.0.2" +version = "0.0.3" group = "me.itstheholyblack.vigilant_eureka" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "vigilant_eureka" @@ -21,7 +21,7 @@ compileJava { } minecraft { - version = "1.12.2-14.23.0.2491" + version = "1.12.2-14.23.3.2655" runDir = "run" // the mappings can be changed at any time, and must be in the following format. @@ -29,7 +29,7 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "snapshot_20171108" + mappings = "snapshot_20180424" makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 15041e1..982e699 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "vigilant_eureka", "name": "Vigilant Eureka", "description": "A mod that does things to the Minecraft.\nSource is available at https://github.com/tkdberger/vigilant-eureka", - "version": "0.0.2", + "version": "0.0.3", "mcversion": "1.12", "url": "https://minecraft.curseforge.com/projects/vigilant-eureka", "updateUrl": "", From 836e91403ada6963b8bf6299f79396ca6069c0fa Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 17:51:54 -0400 Subject: [PATCH 06/87] Add card effects at throw --- .../vigilant_eureka/items/ItemCard.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java index f133e17..2334300 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -2,10 +2,14 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.entity.EntityCard; +import me.itstheholyblack.vigilant_eureka.util.ArrayUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; @@ -16,12 +20,18 @@ public class ItemCard extends Item { - private static final double SPEED = 2; + private static Item[] COLD_THINGS; public ItemCard() { setRegistryName(Reference.MOD_ID, "throwing_card"); setUnlocalizedName(Reference.MOD_ID + ".throwing_card"); setCreativeTab(ModItems.CREATIVE_TAB); + COLD_THINGS = new Item[]{ + Items.SNOWBALL, + Item.getItemFromBlock(Blocks.ICE), + Item.getItemFromBlock(Blocks.FROSTED_ICE), + Item.getItemFromBlock(Blocks.PACKED_ICE) + }; } public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { @@ -30,9 +40,33 @@ public ActionResult onItemRightClick(World worldIn, EntityPlayer play itemstack.shrink(1); } if (!worldIn.isRemote) { + System.out.println("spawning card"); EntityCard c = new EntityCard(worldIn, playerIn, playerIn.getLook(1).x, playerIn.getLook(1).y, playerIn.getLook(1).z); + c.setType(EntityCard.TYPES.BLAND); c.posY += playerIn.getEyeHeight(); worldIn.spawnEntity(c); + + ItemStack other; + if (handIn.equals(EnumHand.MAIN_HAND)) { + other = playerIn.getHeldItem(EnumHand.OFF_HAND); + } else { + other = playerIn.getHeldItem(EnumHand.MAIN_HAND); + } + + Item otherItem = other.getItem(); + if (otherItem.equals(Items.ENDER_EYE) || otherItem.equals(Items.ENDER_PEARL)) { + c.setType(EntityCard.TYPES.ENDERIC); + } else if (otherItem.equals(Item.getItemFromBlock(Blocks.TNT)) || otherItem.equals(Items.FIREWORKS)) { + c.setType(EntityCard.TYPES.EXPLOSION); + } else if (otherItem instanceof ItemSword) { + c.setType(EntityCard.TYPES.SHARP); + } else if (otherItem.equals(Items.FIRE_CHARGE) || otherItem.equals(Items.FLINT_AND_STEEL)) { + c.setType(EntityCard.TYPES.HOT); + } else if (ArrayUtil.contains(COLD_THINGS, otherItem)) { + c.setType(EntityCard.TYPES.COLD); + } + + return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); } return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); } From 45b82cbe331fddce565009b5452c269a00dab4c6 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 17:53:08 -0400 Subject: [PATCH 07/87] Add card item assets --- .../vigilant_eureka/items/ModItems.java | 3 +++ .../vigilant_eureka/util/ArrayUtil.java | 12 ++++++++++++ .../models/item/throwing_card.json | 6 ++++++ .../vigilant_eureka/textures/items/card.png | Bin 0 -> 843 bytes .../textures/items/card.png.mcmeta | 18 ++++++++++++++++++ 5 files changed, 39 insertions(+) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java create mode 100644 src/main/resources/assets/vigilant_eureka/models/item/throwing_card.json create mode 100644 src/main/resources/assets/vigilant_eureka/textures/items/card.png create mode 100644 src/main/resources/assets/vigilant_eureka/textures/items/card.png.mcmeta diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java index 769e1c0..cfb8439 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java @@ -24,6 +24,8 @@ public class ModItems { public static ItemLeyRune leyRune; @GameRegistry.ObjectHolder(Reference.MOD_ID + ":debug_stick") public static DebugStick debugStick; + @GameRegistry.ObjectHolder(Reference.MOD_ID + ":throwing_card") + public static ItemCard itemCard; public static final CreativeTabs CREATIVE_TAB = new CreativeTabs("vigilantEureka") { @Override @@ -40,5 +42,6 @@ public static void initModels() { bismite.initModel(); leyKey.initModel(); debugStick.initModel(); + itemCard.initModel(); } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java b/src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java new file mode 100644 index 0000000..25b694a --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java @@ -0,0 +1,12 @@ +package me.itstheholyblack.vigilant_eureka.util; + +public class ArrayUtil { + public static boolean contains(Object[] arr, Object item) { + for (Object n : arr) { + if (item.equals(n)) { + return true; + } + } + return false; + } +} diff --git a/src/main/resources/assets/vigilant_eureka/models/item/throwing_card.json b/src/main/resources/assets/vigilant_eureka/models/item/throwing_card.json new file mode 100644 index 0000000..436976c --- /dev/null +++ b/src/main/resources/assets/vigilant_eureka/models/item/throwing_card.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "vigilant_eureka:items/card" + } +} diff --git a/src/main/resources/assets/vigilant_eureka/textures/items/card.png b/src/main/resources/assets/vigilant_eureka/textures/items/card.png new file mode 100644 index 0000000000000000000000000000000000000000..43972e2ace57dfffad46a19768ebfbd930786ee9 GIT binary patch literal 843 zcmV-R1GM~!P)WFU8GbZ8()Nlj2>E@cM*00OT`L_t(&-tC$}j;k;X zKuyI#*ykh>CyCS*oTFVKA=ZQBM^=6T)^ zF!FdjI{dq%2IhI*#&HAyfcyP^P+XP;002@-ZzDHu22NQTzezs|AwUSBYNY383L$`V z4gdhW_wVtXbA1I=d0kh?IlmRDG0_0Zx~>poJe{50LW~i-_o9M&1zHgel>6oOFMfrb zGkEV0O5C=3X$6Rk4EDa>B@m=nyMC`&u7Peg=v~pJOF?VjeN|5 z{)`7SKIn7mU{xMaH@?IJWP%hAVmJ@OaNt1`P^hx;;Meou(`fuyzJ&)gHZJi1U0KBg z0D#x)wd29Mu6iCw`9X7nVLUJ%7!P4~z%K18p>7o8;1& z3G;(8siFo|JSY{KdB7#a78_WC3G&V3kXx^;8pD3;B7oQhO9!QtGsyrzB3#zU!cV1|&Cw@_W@DFl7 VS7jNy42A#z002ovPDHLkV1nI-UWWhx literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/vigilant_eureka/textures/items/card.png.mcmeta b/src/main/resources/assets/vigilant_eureka/textures/items/card.png.mcmeta new file mode 100644 index 0000000..133c4a6 --- /dev/null +++ b/src/main/resources/assets/vigilant_eureka/textures/items/card.png.mcmeta @@ -0,0 +1,18 @@ +{ + "animation": { + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ] + } +} \ No newline at end of file From 4f8639ba68985e2b55c59ead8e3d7293c336bbe8 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 17:54:25 -0400 Subject: [PATCH 08/87] Cause things to happen on impact --- .../vigilant_eureka/entity/EntityCard.java | 99 +++++++++++++++++-- 1 file changed, 89 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index 00435a0..b85cdca 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -1,18 +1,29 @@ package me.itstheholyblack.vigilant_eureka.entity; -import net.minecraft.entity.Entity; +import me.itstheholyblack.vigilant_eureka.items.ModItems; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.EnderTeleportEvent; -public class EntityCard extends Entity { +public class EntityCard extends EntityThrowable { private EntityLivingBase thrower; public double accelerationX; public double accelerationY; public double accelerationZ; + private TYPES type; public EntityCard(World world) { this(world, null, 0, 0, 0); @@ -20,7 +31,7 @@ public EntityCard(World world) { public EntityCard(World world, EntityLivingBase shooter, double accelX, double accelY, double accelZ) { super(world); - setSize(1.0F, 1.0F); + setSize(0.5F, 0.1F); this.thrower = shooter; if (shooter != null) { this.setLocationAndAngles(shooter.posX, shooter.posY, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); // sets pos and heading, not motion @@ -30,11 +41,21 @@ public EntityCard(World world, EntityLivingBase shooter, double accelX, double a this.accelerationX = accelX / d0 * 0.5D; this.accelerationY = accelY / d0 * 0.5D; this.accelerationZ = accelZ / d0 * 0.5D; + this.type = TYPES.BLAND; } @Override public void onUpdate() { super.onUpdate(); + if (this.ticksExisted >= 20 * 5) { // 20 per second times five seconds, have the compiler do the math + RayTraceResult r = new RayTraceResult( + RayTraceResult.Type.MISS, + new Vec3d(this.posX, this.posY, this.posZ), + EnumFacing.UP, + new BlockPos(this.posX, this.posY, this.posZ) + ); + doImpact(r, false); + } // update position based on velocity this.posX += this.motionX; this.posY += this.motionY; @@ -44,28 +65,86 @@ public void onUpdate() { this.motionX += this.accelerationX; this.motionY += this.accelerationY; this.motionZ += this.accelerationZ; - this.motionX *= (double)f; - this.motionY *= (double)f; - this.motionZ *= (double)f; + this.motionX *= (double) f; + this.motionY *= (double) f; + this.motionZ *= (double) f; // finalize position update this.setPosition(this.posX, this.posY, this.posZ); } @Override - protected void entityInit() { + protected void onImpact(RayTraceResult result) { + if (result.typeOfHit.equals(RayTraceResult.Type.ENTITY)) { + if (!result.entityHit.equals(thrower)) { + // do stuff + if (this.posY >= result.entityHit.getPositionEyes(1).y - 0.4 + && this.posY <= result.entityHit.getPositionEyes(1).y + 0.4) { + doImpact(result, true); + } else { + doImpact(result, false); + } + } + } else { + doImpact(result, false); + } + } + + private void doImpact(RayTraceResult r, boolean amped) { + switch (this.type) { + case BLAND: + if (!this.world.isRemote) { + EntityItem entityItem = new EntityItem(this.world, this.posX, this.posY, this.posZ, new ItemStack(ModItems.itemCard, 1)); + this.world.spawnEntity(entityItem); + } + break; + case EXPLOSION: + this.world.newExplosion(this, this.posX, this.posY, this.posZ, amped ? 3.0F : 1.5F, amped, true); + break; + case ENDERIC: + if (!(this.thrower == null)) { + this.thrower.setPositionAndUpdate(r.hitVec.x, r.hitVec.y + 1, r.hitVec.z); + EnderTeleportEvent enderTeleportEvent = new EnderTeleportEvent( + thrower, + r.hitVec.x, + r.hitVec.y + 1, + r.hitVec.z, + 0.0F); + MinecraftForge.EVENT_BUS.post(enderTeleportEvent); + } + break; + case HOT: + if (r.typeOfHit.equals(RayTraceResult.Type.ENTITY)) { + r.entityHit.setFire(amped ? 8 : 4); + } else { + BlockPos pos = r.getBlockPos(); + this.world.setBlockState(pos.up(), Blocks.FIRE.getDefaultState()); + } + break; + } + this.setDead(); } @Override - protected void readEntityFromNBT(NBTTagCompound compound) { + protected void entityInit() { + } + @Override + public void readEntityFromNBT(NBTTagCompound compound) { } @Override - protected void writeEntityToNBT(NBTTagCompound compound) { + public void writeEntityToNBT(NBTTagCompound compound) { + } + + public TYPES getType() { + return type; + } + public void setType(TYPES type) { + this.type = type; } public enum TYPES { - BLAND, SHARP, COLD, HOT, EXPLOSION, ENDERIC; + BLAND, SHARP, COLD, HOT, EXPLOSION, ENDERIC } } From e39d50d0d76994576a3de08ccb3bd09fad3f3976 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 17:57:42 -0400 Subject: [PATCH 09/87] Format some JSON --- .../assets/vigilant_eureka/recipes/invis_cap.json | 12 ++++++------ .../assets/vigilant_eureka/recipes/warp_boots.json | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/resources/assets/vigilant_eureka/recipes/invis_cap.json b/src/main/resources/assets/vigilant_eureka/recipes/invis_cap.json index e983a6a..8fc0950 100644 --- a/src/main/resources/assets/vigilant_eureka/recipes/invis_cap.json +++ b/src/main/resources/assets/vigilant_eureka/recipes/invis_cap.json @@ -1,10 +1,10 @@ { - "type": "minecraft:crafting_shaped", - "pattern": [ - "LLL", - "LBL" - ], - "key": { + "type": "minecraft:crafting_shaped", + "pattern": [ + "LLL", + "LBL" + ], + "key": { "L": { "item": "minecraft:leather" }, diff --git a/src/main/resources/assets/vigilant_eureka/recipes/warp_boots.json b/src/main/resources/assets/vigilant_eureka/recipes/warp_boots.json index 17809cd..6c4eba6 100644 --- a/src/main/resources/assets/vigilant_eureka/recipes/warp_boots.json +++ b/src/main/resources/assets/vigilant_eureka/recipes/warp_boots.json @@ -1,10 +1,10 @@ { - "type": "minecraft:crafting_shaped", - "pattern": [ - "L L", - "LBL" - ], - "key": { + "type": "minecraft:crafting_shaped", + "pattern": [ + "L L", + "LBL" + ], + "key": { "L": { "item": "minecraft:leather" }, From 8996a642ab52d640b56b8810a9e8380186e3e307 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 17:57:57 -0400 Subject: [PATCH 10/87] Fix the Leyline TE render for the billionth time --- .../vigilant_eureka/client/LeyLineTileRenderer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java index 769edf7..fb8b183 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java @@ -89,6 +89,7 @@ public void render(LeyLineTile te, double x, double y, double z, float partialTi BlockPos pos = te.getLinkOut(); if (!pos.equals(BlockPos.ORIGIN) && !pos.equals(BlockPos.ORIGIN.down())) { + GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); GlStateManager.disableAlpha(); @@ -113,6 +114,7 @@ public void render(LeyLineTile te, double x, double y, double z, float partialTi tessellator.draw(); GlStateManager.popMatrix(); + GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); } From 7c258e070a0c9e34733fd0074125ed0fd3c7c429 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 18:25:36 -0400 Subject: [PATCH 11/87] Add default case to card impact --- .../vigilant_eureka/blocks/tiles/LeyLineTile.java | 3 +-- .../vigilant_eureka/core/CustomTeleporter.java | 2 +- .../itstheholyblack/vigilant_eureka/entity/EntityCard.java | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java index adecafa..deff507 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java @@ -237,7 +237,6 @@ public AxisAlignedBB getRenderBoundingBox() { } public enum EnumLinkResults { - SUCCEED, SELFLINK, DOUBLELINK, TWOWAY; + SUCCEED, SELFLINK, DOUBLELINK, TWOWAY } - } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/CustomTeleporter.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/CustomTeleporter.java index 09168f7..c0a1693 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/CustomTeleporter.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/CustomTeleporter.java @@ -42,7 +42,7 @@ public void placeInPortal(@Nonnull Entity entity, float rotationYaw) { public static void teleportToDimension(EntityPlayer player, int dimension, double x, double y, double z) { int oldDimension = player.world.provider.getDimension(); EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player; - MinecraftServer server = ((EntityPlayerMP) player).world.getMinecraftServer(); + MinecraftServer server = entityPlayerMP.world.getMinecraftServer(); WorldServer worldServer = server.getWorld(dimension); player.addExperienceLevel(0); diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index b85cdca..15d2d54 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -120,6 +120,12 @@ private void doImpact(RayTraceResult r, boolean amped) { this.world.setBlockState(pos.up(), Blocks.FIRE.getDefaultState()); } break; + default: + if (!this.world.isRemote) { + EntityItem entityItem = new EntityItem(this.world, this.posX, this.posY, this.posZ, new ItemStack(ModItems.itemCard, 1)); + this.world.spawnEntity(entityItem); + } + break; } this.setDead(); } From f804f5a17f12ce41877df20fd1472f05f13673ef Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 21:12:39 -0400 Subject: [PATCH 12/87] Add renderer for thrown cards --- .../vigilant_eureka/entity/ModEntities.java | 11 +++- .../entity/render/RenderEntityCard.java | 53 +++++++++++++++++++ .../vigilant_eureka/proxy/ClientProxy.java | 2 + 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityCard.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java index 8120b34..aebdf82 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java @@ -2,8 +2,12 @@ import me.itstheholyblack.vigilant_eureka.Eureka; import me.itstheholyblack.vigilant_eureka.Reference; +import me.itstheholyblack.vigilant_eureka.entity.render.RenderEntityCard; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public class ModEntities { public static void init() { @@ -12,11 +16,16 @@ public static void init() { new ResourceLocation("thrown_card"), EntityCard.class, Reference.MOD_ID + ":thrown_card", - id++, + ++id, Eureka.instance, 64, 1, true ); } + + @SideOnly(Side.CLIENT) + public static void initModels() { + RenderingRegistry.registerEntityRenderingHandler(EntityCard.class, RenderEntityCard.FACTORY); + } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityCard.java new file mode 100644 index 0000000..4695feb --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityCard.java @@ -0,0 +1,53 @@ +package me.itstheholyblack.vigilant_eureka.entity.render; + +import me.itstheholyblack.vigilant_eureka.entity.EntityCard; +import me.itstheholyblack.vigilant_eureka.items.ModItems; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderEntity; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.client.registry.IRenderFactory; + +public class RenderEntityCard extends RenderEntity { + public static final Factory FACTORY = new Factory(); + private RenderItem itemRenderer; + + public RenderEntityCard(RenderManager renderManagerIn) { + super(renderManagerIn); + } + + @Override + public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) { + if (this.itemRenderer == null) { + this.itemRenderer = Minecraft.getMinecraft().getRenderItem(); + } + GlStateManager.pushMatrix(); + GlStateManager.translate((float) x, (float) y, (float) z); + GlStateManager.disableLighting(); + GlStateManager.rotate(0, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(entity.rotationPitch, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(entity.rotationYaw, 0, 0, 1); + GlStateManager.pushAttrib(); + RenderHelper.enableStandardItemLighting(); + + this.itemRenderer.renderItem(new ItemStack(ModItems.itemCard, 1), ItemCameraTransforms.TransformType.FIXED); + + RenderHelper.disableStandardItemLighting(); + GlStateManager.popAttrib(); + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); + } + + public static class Factory implements IRenderFactory { + @Override + public Render createRenderFor(RenderManager manager) { + return new RenderEntityCard(manager); + } + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java index 435bb82..775a8a3 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java @@ -7,6 +7,7 @@ import me.itstheholyblack.vigilant_eureka.client.LeyLineTileRenderer; import me.itstheholyblack.vigilant_eureka.client.renderer.CustomBipedArmor; import me.itstheholyblack.vigilant_eureka.core.InputHandler; +import me.itstheholyblack.vigilant_eureka.entity.ModEntities; import me.itstheholyblack.vigilant_eureka.items.ModItems; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderLivingBase; @@ -35,6 +36,7 @@ public class ClientProxy extends CommonProxy { public static void registerModels(ModelRegistryEvent event) { ModBlocks.initModels(); ModItems.initModels(); + ModEntities.initModels(); } @SideOnly(Side.CLIENT) From 5495d77e2843bfea9b593cace98c1b47e52790c7 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 24 Apr 2018 21:13:24 -0400 Subject: [PATCH 13/87] Add "dimensional" card type to force teleportation shenanagins This won't be abused at _all._ --- .../vigilant_eureka/entity/EntityCard.java | 16 +++++++++++++++- .../vigilant_eureka/items/ItemCard.java | 12 +++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index 15d2d54..e940c60 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -1,6 +1,7 @@ package me.itstheholyblack.vigilant_eureka.entity; import me.itstheholyblack.vigilant_eureka.items.ModItems; +import me.itstheholyblack.vigilant_eureka.util.FullPosition; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.projectile.EntityThrowable; @@ -120,6 +121,19 @@ private void doImpact(RayTraceResult r, boolean amped) { this.world.setBlockState(pos.up(), Blocks.FIRE.getDefaultState()); } break; + case DIMENSIONAL: + NBTTagCompound nbt = this.getEntityData(); + FullPosition destination = new FullPosition(nbt.getInteger("p_x"), nbt.getInteger("p_y"), nbt.getInteger("p_z"), nbt.getInteger("dim")); + if (!this.world.isRemote && r.entityHit != null) { + if (r.entityHit.dimension != destination.getDimension()) { + r.entityHit.setPosition(destination.getX(), destination.getY(), destination.getZ()); + r.entityHit.changeDimension(destination.getDimension()); + r.entityHit.setPositionAndUpdate(destination.getX(), destination.getY(), destination.getZ()); + } else { + r.entityHit.setPositionAndUpdate(destination.getX(), destination.getY(), destination.getZ()); + } + } + break; default: if (!this.world.isRemote) { EntityItem entityItem = new EntityItem(this.world, this.posX, this.posY, this.posZ, new ItemStack(ModItems.itemCard, 1)); @@ -151,6 +165,6 @@ public void setType(TYPES type) { } public enum TYPES { - BLAND, SHARP, COLD, HOT, EXPLOSION, ENDERIC + BLAND, SHARP, COLD, HOT, EXPLOSION, ENDERIC, DIMENSIONAL } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java index 2334300..ee23cac 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -1,6 +1,7 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; +import me.itstheholyblack.vigilant_eureka.core.NBTUtil; import me.itstheholyblack.vigilant_eureka.entity.EntityCard; import me.itstheholyblack.vigilant_eureka.util.ArrayUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -10,6 +11,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; @@ -40,10 +42,10 @@ public ActionResult onItemRightClick(World worldIn, EntityPlayer play itemstack.shrink(1); } if (!worldIn.isRemote) { - System.out.println("spawning card"); EntityCard c = new EntityCard(worldIn, playerIn, playerIn.getLook(1).x, playerIn.getLook(1).y, playerIn.getLook(1).z); c.setType(EntityCard.TYPES.BLAND); c.posY += playerIn.getEyeHeight(); + c.setPositionAndRotationDirect(c.posX, c.posY, c.posZ, playerIn.cameraYaw, playerIn.cameraPitch, 0, false); worldIn.spawnEntity(c); ItemStack other; @@ -64,6 +66,14 @@ public ActionResult onItemRightClick(World worldIn, EntityPlayer play c.setType(EntityCard.TYPES.HOT); } else if (ArrayUtil.contains(COLD_THINGS, otherItem)) { c.setType(EntityCard.TYPES.COLD); + } else if (otherItem.equals(ModItems.dimKey)) { + NBTTagCompound keyComp = NBTUtil.getTagCompoundSafe(other); + NBTTagCompound cardComp = c.getEntityData(); + c.setType(EntityCard.TYPES.DIMENSIONAL); + cardComp.setInteger("p_x", keyComp.getInteger("x")); + cardComp.setInteger("p_y", keyComp.getInteger("y")); + cardComp.setInteger("p_z", keyComp.getInteger("z")); + cardComp.setInteger("dim", keyComp.getInteger("dim")); } return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); From b110c96aa33a2de2982bf690b0184c0972f427f6 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 07:03:10 -0400 Subject: [PATCH 14/87] Localize card --- .../vigilant_eureka/items/ItemCard.java | 11 +++++++++++ .../resources/assets/vigilant_eureka/lang/en_us.lang | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java index ee23cac..839b0d5 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -5,6 +5,8 @@ import me.itstheholyblack.vigilant_eureka.entity.EntityCard; import me.itstheholyblack.vigilant_eureka.util.ArrayUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -20,6 +22,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + public class ItemCard extends Item { private static Item[] COLD_THINGS; @@ -27,6 +31,7 @@ public class ItemCard extends Item { public ItemCard() { setRegistryName(Reference.MOD_ID, "throwing_card"); setUnlocalizedName(Reference.MOD_ID + ".throwing_card"); + setMaxStackSize(128); setCreativeTab(ModItems.CREATIVE_TAB); COLD_THINGS = new Item[]{ Items.SNOWBALL, @@ -85,4 +90,10 @@ public ActionResult onItemRightClick(World worldIn, EntityPlayer play public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory")); } + + @SideOnly(Side.CLIENT) + @Override + public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + tooltip.add(I18n.format("mouseovertext.throwing_card")); + } } diff --git a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang index 82527c0..6ba8409 100644 --- a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang +++ b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang @@ -7,12 +7,14 @@ item.vigilant_eureka.warp_boots.name=Warp Boots item.vigilant_eureka.invis_cap.name=Invisibility Cap item.vigilant_eureka.bismite.name=Bismite Deposit item.vigilant_eureka.ley_key.name=Crystalline Bismuth +item.vigilant_eureka.throwing_card.name=Throwing Card mouseovertext.dim_key=A key that opens many doors. That life has. Ed boy. mouseovertext.dim_door=A door. That moves you. To places. With motion. It's like magic, but better. mouseovertext.invis_cap=It's a cap that makes you invisible. Hey, that'd be cool as a cloak! mouseovertext.warp_boots=Boots that can outrun space and time, because that's definitely something your mortal feet can handle. mouseovertext.ley_key=Bismuth, melted into strange and alien shapes. Or just squares, one of the two. +mouseovertext.throwing_card=The card seems to hum with energy. Maybe you should throw it? itemGroup.vigilantEureka=Vigilant Eureka From 5ca2f1808ba2266d9085c49dfb8e463806b81752 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 10:26:25 -0400 Subject: [PATCH 15/87] Change cold effect to random cold block --- .../vigilant_eureka/entity/EntityCard.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index e940c60..c4f4550 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -2,7 +2,9 @@ import me.itstheholyblack.vigilant_eureka.items.ModItems; import me.itstheholyblack.vigilant_eureka.util.FullPosition; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.init.Blocks; @@ -17,6 +19,9 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; + public class EntityCard extends EntityThrowable { private EntityLivingBase thrower; @@ -121,6 +126,27 @@ private void doImpact(RayTraceResult r, boolean amped) { this.world.setBlockState(pos.up(), Blocks.FIRE.getDefaultState()); } break; + case COLD: + if (r.typeOfHit.equals(RayTraceResult.Type.BLOCK) && !this.world.isRemote) { + IBlockState state = this.world.getBlockState(this.getPosition()); + if (state.getBlock().equals(Blocks.ICE)) { + this.world.setBlockState(this.getPosition(), Blocks.PACKED_ICE.getDefaultState()); + } else if (state.getBlock().equals(Blocks.WATER)) { + this.world.setBlockState(this.getPosition(), Blocks.ICE.getDefaultState()); + } else { + IBlockState[] states = new IBlockState[] { + Blocks.ICE.getDefaultState(), + Blocks.SNOW.getDefaultState(), + Blocks.PACKED_ICE.getDefaultState() + }; + int index = ThreadLocalRandom.current().nextInt(0, states.length); + IBlockState cold_thing = states[index]; + EntityFallingBlock efb = new EntityFallingBlock(this.world, this.posX, this.posY + 1, this.posZ, cold_thing); + efb.fallTime = 1; + this.world.spawnEntity(efb); + } + } + break; case DIMENSIONAL: NBTTagCompound nbt = this.getEntityData(); FullPosition destination = new FullPosition(nbt.getInteger("p_x"), nbt.getInteger("p_y"), nbt.getInteger("p_z"), nbt.getInteger("dim")); From b522a7c3b4bfa366dec23bb69d84c4e67fd78421 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 10:27:52 -0400 Subject: [PATCH 16/87] Add a small change to gradle or whatever --- build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle b/build.gradle index 153168b..032bda4 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,15 @@ minecraft { // simply re-run your setup task after changing the mappings to update your workspace. mappings = "snapshot_20180424" makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + if (project.hasProperty('mc_username')) { + clientRunArgs += ['--username', project.mc_username] + if (project.hasProperty('mc_password')) { + clientRunArgs += ['--password', project.mc_password] + } + } + if (project.hasProperty('mc_uuid')) { + clientRunArgs += ['--uuid', project.mc_uuid] + } } dependencies { From 4b75e1deb5532b92625fda44b2373d46f7867007 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 10:29:03 -0400 Subject: [PATCH 17/87] Version bump --- src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java b/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java index d3914cf..45b4d06 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java @@ -3,6 +3,6 @@ public class Reference { public static final String MOD_NAME = "Vigilant Eureka"; public static final String MOD_ID = "vigilant_eureka"; - public static final String VERSION = "0.0.2-alpha"; + public static final String VERSION = "0.0.3-alpha"; public static final String MOD_KEY = "19d2daed26722f2762d067603604a6d1f909f262"; } From a796716d121fdfd3a2297275a8a9e0e19159883a Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 10:29:27 -0400 Subject: [PATCH 18/87] Pick a new, fancy color for links --- .../vigilant_eureka/client/LeyLineTileRenderer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java index fb8b183..69862bc 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/LeyLineTileRenderer.java @@ -98,19 +98,19 @@ public void render(LeyLineTile te, double x, double y, double z, float partialTi bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.pos(0.5, 0.375, 0.5).color(255, 255, 255, 255).endVertex(); - bufferbuilder.pos(0.5, 0.625, 0.5).color(255, 255, 255, 255).endVertex(); + bufferbuilder.pos(0.5, 0.375, 0.5).color(0, 255, 255, 255).endVertex(); + bufferbuilder.pos(0.5, 0.625, 0.5).color(0, 255, 255, 255).endVertex(); bufferbuilder.pos( (pos.getX() - te.getPos().getX()) + 0.5, (pos.getY() - te.getPos().getY()) + 0.375, (pos.getZ() - te.getPos().getZ()) + 0.5) - .color(255, 255, 255, 255).endVertex(); + .color(0, 255, 255, 255).endVertex(); bufferbuilder.pos( (pos.getX() - te.getPos().getX()) + 0.5, (pos.getY() - te.getPos().getY()) + 0.625, (pos.getZ() - te.getPos().getZ()) + 0.5) - .color(255, 255, 255, 255).endVertex(); + .color(0, 255, 255, 255).endVertex(); tessellator.draw(); GlStateManager.popMatrix(); From 35e6a53b331ab51d87519b407d1db18543f6675f Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 16:41:58 -0400 Subject: [PATCH 19/87] Allow non-players to use the moving door. --- .../blocks/MovingCastleDoor.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/MovingCastleDoor.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/MovingCastleDoor.java index 3fa8a48..a4f339a 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/MovingCastleDoor.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/MovingCastleDoor.java @@ -87,17 +87,20 @@ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState s } else { return; } - if (t.getDestination().getY() > 0 && entityIn instanceof EntityPlayer) { - // NBTTagCompound compound = t.getTileData(); - FullPosition destination = t.getDestination(); + FullPosition destination = t.getDestination(); + if (!t.getDestination().equals(BlockPos.ORIGIN)) { if (entityIn.dimension != destination.getDimension()) { - CustomTeleporter.teleportToDimension((EntityPlayer) entityIn, destination.getDimension(), - destination.getX(), destination.getY(), destination.getZ()); + if (entityIn instanceof EntityPlayer) { + CustomTeleporter.teleportToDimension((EntityPlayer) entityIn, destination.getDimension(), + destination.getX(), destination.getY(), destination.getZ()); + } else { + entityIn.setPosition(destination.getX(), destination.getY(), destination.getZ()); + entityIn.changeDimension(destination.getDimension()); + entityIn.setPositionAndUpdate(destination.getX(), destination.getY(), destination.getZ()); + } } else { entityIn.setPositionAndUpdate(destination.getX(), destination.getY(), destination.getZ()); } - } else { - System.out.println(t.getDestination().getY()); } } } @@ -107,6 +110,11 @@ public boolean isNormalCube(IBlockState state, IBlockAccess access, BlockPos pos return false; } + @Override + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) { + return true; + } + @Override public Class getTileEntityClass() { return MovingCastleDoorTile.class; @@ -122,6 +130,11 @@ public boolean isOpaqueCube(IBlockState state) { return false; } + @Override + public boolean isFullCube(IBlockState state) { + return false; + } + public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(IS_TOP, meta == 1); } From 13997df86589935cd6218cd75b0321486675fb2c Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 17:34:36 -0400 Subject: [PATCH 20/87] """Simplify""" type setting for cards --- .../vigilant_eureka/items/ItemCard.java | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java index 839b0d5..c56b186 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -3,7 +3,6 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.core.NBTUtil; import me.itstheholyblack.vigilant_eureka.entity.EntityCard; -import me.itstheholyblack.vigilant_eureka.util.ArrayUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; @@ -22,23 +21,45 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.HashMap; import java.util.List; public class ItemCard extends Item { - - private static Item[] COLD_THINGS; + private static HashMap TYPE_MAP = new HashMap<>(); public ItemCard() { setRegistryName(Reference.MOD_ID, "throwing_card"); setUnlocalizedName(Reference.MOD_ID + ".throwing_card"); setMaxStackSize(128); setCreativeTab(ModItems.CREATIVE_TAB); - COLD_THINGS = new Item[]{ - Items.SNOWBALL, - Item.getItemFromBlock(Blocks.ICE), - Item.getItemFromBlock(Blocks.FROSTED_ICE), - Item.getItemFromBlock(Blocks.PACKED_ICE) - }; + + for (Item i : new Item[]{Items.SNOWBALL, Item.getItemFromBlock(Blocks.ICE), Item.getItemFromBlock(Blocks.PACKED_ICE)}) { + TYPE_MAP.put(i, EntityCard.TYPES.COLD); + } + + for (Item i : new Item[]{Items.TNT_MINECART, Items.FIREWORKS, Items.FIREWORK_CHARGE, Item.getItemFromBlock(Blocks.TNT)}) { + TYPE_MAP.put(i, EntityCard.TYPES.EXPLOSION); + } + + for (Item i : new Item[]{Items.BLAZE_ROD, Items.BLAZE_POWDER, Items.FIRE_CHARGE, Items.FLINT_AND_STEEL}) { + TYPE_MAP.put(i, EntityCard.TYPES.HOT); + } + + for (Item i : new Item[]{ + Items.ENDER_EYE, + Items.ENDER_PEARL, + Items.END_CRYSTAL, + Item.getItemFromBlock(Blocks.END_STONE), + Item.getItemFromBlock(Blocks.END_BRICKS), + Item.getItemFromBlock(Blocks.END_ROD), + Item.getItemFromBlock(Blocks.ENDER_CHEST), + Item.getItemFromBlock(Blocks.PURPUR_BLOCK), Item.getItemFromBlock(Blocks.PURPUR_SLAB), Item.getItemFromBlock(Blocks.PURPUR_PILLAR), Item.getItemFromBlock(Blocks.PURPUR_STAIRS), + Items.CHORUS_FRUIT, + Items.CHORUS_FRUIT_POPPED, + Item.getItemFromBlock(Blocks.CHORUS_FLOWER), Item.getItemFromBlock(Blocks.CHORUS_PLANT) + }) { + TYPE_MAP.put(i, EntityCard.TYPES.ENDERIC); + } } public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { @@ -61,31 +82,26 @@ public ActionResult onItemRightClick(World worldIn, EntityPlayer play } Item otherItem = other.getItem(); - if (otherItem.equals(Items.ENDER_EYE) || otherItem.equals(Items.ENDER_PEARL)) { - c.setType(EntityCard.TYPES.ENDERIC); - } else if (otherItem.equals(Item.getItemFromBlock(Blocks.TNT)) || otherItem.equals(Items.FIREWORKS)) { - c.setType(EntityCard.TYPES.EXPLOSION); - } else if (otherItem instanceof ItemSword) { - c.setType(EntityCard.TYPES.SHARP); - } else if (otherItem.equals(Items.FIRE_CHARGE) || otherItem.equals(Items.FLINT_AND_STEEL)) { - c.setType(EntityCard.TYPES.HOT); - } else if (ArrayUtil.contains(COLD_THINGS, otherItem)) { - c.setType(EntityCard.TYPES.COLD); - } else if (otherItem.equals(ModItems.dimKey)) { + c.setType(getTypeFromItem(otherItem)); + if (otherItem.equals(ModItems.dimKey)) { NBTTagCompound keyComp = NBTUtil.getTagCompoundSafe(other); NBTTagCompound cardComp = c.getEntityData(); - c.setType(EntityCard.TYPES.DIMENSIONAL); cardComp.setInteger("p_x", keyComp.getInteger("x")); cardComp.setInteger("p_y", keyComp.getInteger("y")); cardComp.setInteger("p_z", keyComp.getInteger("z")); cardComp.setInteger("dim", keyComp.getInteger("dim")); + } else if (otherItem instanceof ItemSword) { + c.setType(EntityCard.TYPES.SHARP); } - return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); } return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); } + private static EntityCard.TYPES getTypeFromItem(Item item) { + return TYPE_MAP.get(item) == null ? EntityCard.TYPES.BLAND : TYPE_MAP.get(item); + } + @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory")); From 02f25dac4abb225d7b76b19839784ff3c37e0a46 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 19:17:51 -0400 Subject: [PATCH 21/87] Change cold behavior, just for fun. --- .../vigilant_eureka/entity/EntityCard.java | 30 ++++++++++++++----- .../entity/EntitySuspendedBlock.java | 21 +++++++++++++ .../vigilant_eureka/entity/ModEntities.java | 3 +- .../vigilant_eureka/items/ItemCard.java | 2 +- 4 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index c4f4550..f9c476e 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -19,7 +19,6 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; -import java.util.Random; import java.util.concurrent.ThreadLocalRandom; public class EntityCard extends EntityThrowable { @@ -134,16 +133,31 @@ private void doImpact(RayTraceResult r, boolean amped) { } else if (state.getBlock().equals(Blocks.WATER)) { this.world.setBlockState(this.getPosition(), Blocks.ICE.getDefaultState()); } else { - IBlockState[] states = new IBlockState[] { + IBlockState[] states = new IBlockState[]{ Blocks.ICE.getDefaultState(), Blocks.SNOW.getDefaultState(), - Blocks.PACKED_ICE.getDefaultState() + Blocks.PACKED_ICE.getDefaultState(), + Blocks.FROSTED_ICE.getDefaultState() }; - int index = ThreadLocalRandom.current().nextInt(0, states.length); - IBlockState cold_thing = states[index]; - EntityFallingBlock efb = new EntityFallingBlock(this.world, this.posX, this.posY + 1, this.posZ, cold_thing); - efb.fallTime = 1; - this.world.spawnEntity(efb); + BlockPos pos = new BlockPos(r.hitVec.addVector(0, 1, 0)); + for (int i = -1; i <= 1; ++i) { + for (int j = -1; j <= 1; ++j) { + for (int d = -1; d <= 1; ++d) { + pos.add(i, j, d); + + int index = ThreadLocalRandom.current().nextInt(0, states.length); + IBlockState cold_thing = states[index]; + EntityFallingBlock efb = new EntitySuspendedBlock(this.world, pos.getX(), pos.getY(), pos.getZ(), cold_thing); + efb.motionX += ((double) i) / ThreadLocalRandom.current().nextDouble(1, 2.5); + efb.motionY += ((double) j) / ThreadLocalRandom.current().nextDouble(1, 2.5); + efb.motionZ += ((double) d) / ThreadLocalRandom.current().nextDouble(1, 2.5); + efb.fallTime = 1; + efb.shouldDropItem = false; + efb.setNoGravity(true); + this.world.spawnEntity(efb); + } + } + } } } break; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java new file mode 100644 index 0000000..9578420 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java @@ -0,0 +1,21 @@ +package me.itstheholyblack.vigilant_eureka.entity; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.world.World; + +public class EntitySuspendedBlock extends EntityFallingBlock { + public EntitySuspendedBlock(World worldIn, double x, double y, double z, IBlockState fallingBlockState) { + super(worldIn, x, y, z, fallingBlockState); + } + + @Override + public void onUpdate() { + super.onUpdate(); + if (this.ticksExisted > 20) { + this.setNoGravity(false); + this.addVelocity(0, -0.5, 0); + this.setHurtEntities(true); + } + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java index aebdf82..f9b9a79 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java @@ -16,12 +16,13 @@ public static void init() { new ResourceLocation("thrown_card"), EntityCard.class, Reference.MOD_ID + ":thrown_card", - ++id, + id++, Eureka.instance, 64, 1, true ); + EntityRegistry.registerModEntity(new ResourceLocation("suspended_block"), EntitySuspendedBlock.class, Reference.MOD_ID + ":suspended_block", id++, Eureka.instance, 64, 1, true); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java index c56b186..08158db 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -33,7 +33,7 @@ public ItemCard() { setMaxStackSize(128); setCreativeTab(ModItems.CREATIVE_TAB); - for (Item i : new Item[]{Items.SNOWBALL, Item.getItemFromBlock(Blocks.ICE), Item.getItemFromBlock(Blocks.PACKED_ICE)}) { + for (Item i : new Item[]{Items.SNOWBALL, Item.getItemFromBlock(Blocks.SNOW), Item.getItemFromBlock(Blocks.SNOW_LAYER), Item.getItemFromBlock(Blocks.ICE), Item.getItemFromBlock(Blocks.PACKED_ICE)}) { TYPE_MAP.put(i, EntityCard.TYPES.COLD); } From 4e40b4b223981efbaef1715252b5e89b9b4ec855 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 20:47:27 -0400 Subject: [PATCH 22/87] Lock block type to Frosted Ice to prevent client crash --- .../vigilant_eureka/entity/EntityCard.java | 20 +++++++++---------- .../entity/EntitySuspendedBlock.java | 8 ++++++++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index f9c476e..877b6c8 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -133,21 +133,12 @@ private void doImpact(RayTraceResult r, boolean amped) { } else if (state.getBlock().equals(Blocks.WATER)) { this.world.setBlockState(this.getPosition(), Blocks.ICE.getDefaultState()); } else { - IBlockState[] states = new IBlockState[]{ - Blocks.ICE.getDefaultState(), - Blocks.SNOW.getDefaultState(), - Blocks.PACKED_ICE.getDefaultState(), - Blocks.FROSTED_ICE.getDefaultState() - }; BlockPos pos = new BlockPos(r.hitVec.addVector(0, 1, 0)); for (int i = -1; i <= 1; ++i) { for (int j = -1; j <= 1; ++j) { for (int d = -1; d <= 1; ++d) { pos.add(i, j, d); - - int index = ThreadLocalRandom.current().nextInt(0, states.length); - IBlockState cold_thing = states[index]; - EntityFallingBlock efb = new EntitySuspendedBlock(this.world, pos.getX(), pos.getY(), pos.getZ(), cold_thing); + EntitySuspendedBlock efb = new EntitySuspendedBlock(this.world, pos.getX(), pos.getY(), pos.getZ(), Blocks.FROSTED_ICE.getDefaultState()); efb.motionX += ((double) i) / ThreadLocalRandom.current().nextDouble(1, 2.5); efb.motionY += ((double) j) / ThreadLocalRandom.current().nextDouble(1, 2.5); efb.motionZ += ((double) d) / ThreadLocalRandom.current().nextDouble(1, 2.5); @@ -159,6 +150,15 @@ private void doImpact(RayTraceResult r, boolean amped) { } } } + } else if (!this.world.isRemote && r.typeOfHit.equals(RayTraceResult.Type.ENTITY)) { + // entity hit + BlockPos pos = r.entityHit.getPosition(); + EntityFallingBlock efb = new EntityFallingBlock(this.world, pos.getX(), pos.getY(), pos.getZ(), Blocks.FROSTED_ICE.getDefaultState()); + efb.motionY += 0.125; + efb.fallTime = 1; + efb.shouldDropItem = false; + + this.world.spawnEntity(efb); } break; case DIMENSIONAL: diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java index 9578420..b62cc67 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java @@ -2,9 +2,17 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.init.Blocks; import net.minecraft.world.World; public class EntitySuspendedBlock extends EntityFallingBlock { + + private IBlockState fallTile; + + public EntitySuspendedBlock(World worldIn) { + super(worldIn, 0, 0, 0, Blocks.FROSTED_ICE.getDefaultState()); + } + public EntitySuspendedBlock(World worldIn, double x, double y, double z, IBlockState fallingBlockState) { super(worldIn, x, y, z, fallingBlockState); } From 223df797024973fab14ec7cb8ee333eae2bd0b77 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 25 Apr 2018 21:38:44 -0400 Subject: [PATCH 23/87] Refactor EntitySuspendedBlock -> EntitySuspendedIce --- .../vigilant_eureka/entity/EntityCard.java | 2 +- ...{EntitySuspendedBlock.java => EntitySuspendedIce.java} | 8 +++----- .../vigilant_eureka/entity/ModEntities.java | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) rename src/main/java/me/itstheholyblack/vigilant_eureka/entity/{EntitySuspendedBlock.java => EntitySuspendedIce.java} (70%) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index 877b6c8..9a42c99 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -138,7 +138,7 @@ private void doImpact(RayTraceResult r, boolean amped) { for (int j = -1; j <= 1; ++j) { for (int d = -1; d <= 1; ++d) { pos.add(i, j, d); - EntitySuspendedBlock efb = new EntitySuspendedBlock(this.world, pos.getX(), pos.getY(), pos.getZ(), Blocks.FROSTED_ICE.getDefaultState()); + EntitySuspendedIce efb = new EntitySuspendedIce(this.world, pos.getX(), pos.getY(), pos.getZ(), Blocks.FROSTED_ICE.getDefaultState()); efb.motionX += ((double) i) / ThreadLocalRandom.current().nextDouble(1, 2.5); efb.motionY += ((double) j) / ThreadLocalRandom.current().nextDouble(1, 2.5); efb.motionZ += ((double) d) / ThreadLocalRandom.current().nextDouble(1, 2.5); diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java similarity index 70% rename from src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java rename to src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java index b62cc67..52429f5 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedBlock.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java @@ -5,15 +5,13 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class EntitySuspendedBlock extends EntityFallingBlock { +public class EntitySuspendedIce extends EntityFallingBlock { - private IBlockState fallTile; - - public EntitySuspendedBlock(World worldIn) { + public EntitySuspendedIce(World worldIn) { super(worldIn, 0, 0, 0, Blocks.FROSTED_ICE.getDefaultState()); } - public EntitySuspendedBlock(World worldIn, double x, double y, double z, IBlockState fallingBlockState) { + public EntitySuspendedIce(World worldIn, double x, double y, double z, IBlockState fallingBlockState) { super(worldIn, x, y, z, fallingBlockState); } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java index f9b9a79..62580a2 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java @@ -22,7 +22,7 @@ public static void init() { 1, true ); - EntityRegistry.registerModEntity(new ResourceLocation("suspended_block"), EntitySuspendedBlock.class, Reference.MOD_ID + ":suspended_block", id++, Eureka.instance, 64, 1, true); + EntityRegistry.registerModEntity(new ResourceLocation("suspended_ice"), EntitySuspendedIce.class, Reference.MOD_ID + ":suspended_ice", id++, Eureka.instance, 64, 1, true); } @SideOnly(Side.CLIENT) From a2495619f8638695443e10f001bfdd258e2bd9fe Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Thu, 26 Apr 2018 20:53:29 -0400 Subject: [PATCH 24/87] Got random ESI working. Cool. --- .../vigilant_eureka/entity/EntityCard.java | 16 +++++-- .../entity/EntitySuspendedIce.java | 46 ++++++++++++++++++- .../vigilant_eureka/util/ArrayUtil.java | 8 ++++ 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java index 9a42c99..39f72aa 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityCard.java @@ -1,6 +1,7 @@ package me.itstheholyblack.vigilant_eureka.entity; import me.itstheholyblack.vigilant_eureka.items.ModItems; +import me.itstheholyblack.vigilant_eureka.util.ArrayUtil; import me.itstheholyblack.vigilant_eureka.util.FullPosition; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; @@ -126,6 +127,12 @@ private void doImpact(RayTraceResult r, boolean amped) { } break; case COLD: + IBlockState cold_things[] = new IBlockState[]{ + Blocks.FROSTED_ICE.getDefaultState(), + Blocks.ICE.getDefaultState(), + Blocks.SNOW.getDefaultState(), + Blocks.PACKED_ICE.getDefaultState() + }; if (r.typeOfHit.equals(RayTraceResult.Type.BLOCK) && !this.world.isRemote) { IBlockState state = this.world.getBlockState(this.getPosition()); if (state.getBlock().equals(Blocks.ICE)) { @@ -138,7 +145,9 @@ private void doImpact(RayTraceResult r, boolean amped) { for (int j = -1; j <= 1; ++j) { for (int d = -1; d <= 1; ++d) { pos.add(i, j, d); - EntitySuspendedIce efb = new EntitySuspendedIce(this.world, pos.getX(), pos.getY(), pos.getZ(), Blocks.FROSTED_ICE.getDefaultState()); + IBlockState s = ArrayUtil.randomFromArr(cold_things); + // System.out.println(s); + EntitySuspendedIce efb = new EntitySuspendedIce(this.world, pos.getX(), pos.getY(), pos.getZ(), s); efb.motionX += ((double) i) / ThreadLocalRandom.current().nextDouble(1, 2.5); efb.motionY += ((double) j) / ThreadLocalRandom.current().nextDouble(1, 2.5); efb.motionZ += ((double) d) / ThreadLocalRandom.current().nextDouble(1, 2.5); @@ -153,9 +162,10 @@ private void doImpact(RayTraceResult r, boolean amped) { } else if (!this.world.isRemote && r.typeOfHit.equals(RayTraceResult.Type.ENTITY)) { // entity hit BlockPos pos = r.entityHit.getPosition(); - EntityFallingBlock efb = new EntityFallingBlock(this.world, pos.getX(), pos.getY(), pos.getZ(), Blocks.FROSTED_ICE.getDefaultState()); - efb.motionY += 0.125; + EntityFallingBlock efb = new EntityFallingBlock(this.world, pos.getX(), pos.getY() + 1, pos.getZ(), ArrayUtil.randomFromArr(cold_things)); + efb.motionY += 0.75; efb.fallTime = 1; + efb.setHurtEntities(true); efb.shouldDropItem = false; this.world.spawnEntity(efb); diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java index 52429f5..ef3a00d 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java @@ -1,11 +1,15 @@ package me.itstheholyblack.vigilant_eureka.entity; +import io.netty.buffer.ByteBuf; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.init.Blocks; import net.minecraft.world.World; +import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; -public class EntitySuspendedIce extends EntityFallingBlock { +public class EntitySuspendedIce extends EntityFallingBlock implements IEntityAdditionalSpawnData { + + private IBlockState fallTile; public EntitySuspendedIce(World worldIn) { super(worldIn, 0, 0, 0, Blocks.FROSTED_ICE.getDefaultState()); @@ -13,6 +17,7 @@ public EntitySuspendedIce(World worldIn) { public EntitySuspendedIce(World worldIn, double x, double y, double z, IBlockState fallingBlockState) { super(worldIn, x, y, z, fallingBlockState); + this.fallTile = fallingBlockState; } @Override @@ -24,4 +29,43 @@ public void onUpdate() { this.setHurtEntities(true); } } + + + @Override + public void writeSpawnData(ByteBuf buffer) { + int state = 0; + if (this.fallTile.equals(Blocks.ICE.getDefaultState())) { + buffer.writeInt(state); + return; + } else if (this.fallTile.equals(Blocks.FROSTED_ICE.getDefaultState())) { + state = 1; + } else if (this.fallTile.equals(Blocks.PACKED_ICE)) { + state = 2; + } else if (this.fallTile.equals(Blocks.SNOW.getDefaultState())) { + state = 3; + } + buffer.writeInt(state); + } + + @Override + public void readSpawnData(ByteBuf additionalData) { + int state = additionalData.readInt(); + switch (state) { + case 0: + this.fallTile = Blocks.ICE.getDefaultState(); + break; + case 1: + this.fallTile = Blocks.FROSTED_ICE.getDefaultState(); + break; + case 2: + this.fallTile = Blocks.PACKED_ICE.getDefaultState(); + break; + case 3: + this.fallTile = Blocks.SNOW.getDefaultState(); + break; + default: + this.fallTile = Blocks.FROSTED_ICE.getDefaultState(); + break; + } + } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java b/src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java index 25b694a..f9a7685 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/util/ArrayUtil.java @@ -1,6 +1,10 @@ package me.itstheholyblack.vigilant_eureka.util; +import java.util.Random; + public class ArrayUtil { + private static Random r = new Random(); + public static boolean contains(Object[] arr, Object item) { for (Object n : arr) { if (item.equals(n)) { @@ -9,4 +13,8 @@ public static boolean contains(Object[] arr, Object item) { } return false; } + + public static T randomFromArr(T[] arr) { + return arr[r.nextInt(arr.length)]; + } } From a64531b2093f8d2c729f5fbe1f0e1dfa1c67fefc Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Fri, 27 Apr 2018 12:43:56 -0400 Subject: [PATCH 25/87] Minecart elytra launching is not as impressive as planned --- .../vigilant_eureka/core/EventHandler.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index f03e746..f6e0c4e 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -5,8 +5,13 @@ import me.itstheholyblack.vigilant_eureka.items.ModItems; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.ItemElytra; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTUtil; @@ -14,6 +19,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; +import net.minecraftforge.event.entity.EntityMountEvent; import net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.fml.common.Mod; @@ -115,6 +121,22 @@ public void livingJump(LivingEvent.LivingJumpEvent event) { } } + @SubscribeEvent + public void minecartTakeoff(EntityMountEvent event) { + if (event.isDismounting() && event.getEntityBeingMounted() instanceof EntityMinecart && event.getEntityMounting() instanceof EntityPlayer) { + EntityMinecart minecart = (EntityMinecart) event.getEntityBeingMounted(); + EntityPlayer dismounting = (EntityPlayer) event.getEntityMounting(); + ItemStack chestpiece = dismounting.getItemStackFromSlot(EntityEquipmentSlot.CHEST); + if (chestpiece.getItem().equals(Items.ELYTRA) && ItemElytra.isUsable(chestpiece)) { + if (!event.getWorldObj().isRemote && (minecart.motionX != 0 && minecart.motionY != 0 && minecart.motionZ != 0)) { + dismounting.addVelocity(minecart.motionX, minecart.motionY, minecart.motionZ); + EntityPlayerMP player = (EntityPlayerMP) dismounting; + player.setElytraFlying(); + } + } + } + } + private static void removeLeyNBT(EntityLivingBase e) { e.getEntityData().removeTag("timeSince"); e.getEntityData().removeTag("inPoly"); From a3a3944e337d80e4838612f9d855ca12033c6263 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Fri, 27 Apr 2018 12:44:55 -0400 Subject: [PATCH 26/87] let's have some fun instead --- .../me/itstheholyblack/vigilant_eureka/core/EventHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index f6e0c4e..0c44410 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -129,7 +129,7 @@ public void minecartTakeoff(EntityMountEvent event) { ItemStack chestpiece = dismounting.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (chestpiece.getItem().equals(Items.ELYTRA) && ItemElytra.isUsable(chestpiece)) { if (!event.getWorldObj().isRemote && (minecart.motionX != 0 && minecart.motionY != 0 && minecart.motionZ != 0)) { - dismounting.addVelocity(minecart.motionX, minecart.motionY, minecart.motionZ); + dismounting.addVelocity(minecart.motionX, Math.abs(minecart.motionY), minecart.motionZ); EntityPlayerMP player = (EntityPlayerMP) dismounting; player.setElytraFlying(); } From bff1bc9104c6b762988c4ffe2359ecfa8ce700f2 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sun, 29 Apr 2018 20:39:29 -0400 Subject: [PATCH 27/87] Add firework boosting to minecarts --- .../vigilant_eureka/core/EventHandler.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index 0c44410..e3caa8d 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -16,12 +16,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTUtil; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.event.entity.EntityMountEvent; import net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent; import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -128,8 +130,8 @@ public void minecartTakeoff(EntityMountEvent event) { EntityPlayer dismounting = (EntityPlayer) event.getEntityMounting(); ItemStack chestpiece = dismounting.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (chestpiece.getItem().equals(Items.ELYTRA) && ItemElytra.isUsable(chestpiece)) { - if (!event.getWorldObj().isRemote && (minecart.motionX != 0 && minecart.motionY != 0 && minecart.motionZ != 0)) { - dismounting.addVelocity(minecart.motionX, Math.abs(minecart.motionY), minecart.motionZ); + if (!event.getWorldObj().isRemote && (Math.abs(minecart.motionX) + Math.abs(minecart.motionY) + Math.abs(minecart.motionZ) != 0)) { + dismounting.addVelocity(minecart.motionX, Math.abs(minecart.motionY) + 5, minecart.motionZ); EntityPlayerMP player = (EntityPlayerMP) dismounting; player.setElytraFlying(); } @@ -137,6 +139,22 @@ public void minecartTakeoff(EntityMountEvent event) { } } + @SubscribeEvent + public void useItem(PlayerInteractEvent event) { + if (!event.getWorld().isRemote) { + EntityPlayerMP player = (EntityPlayerMP) event.getEntityPlayer(); + if (event.getItemStack().getItem().equals(Items.FIREWORKS) && player.isRiding() && player.getRidingEntity() instanceof EntityMinecart) { + if (!player.capabilities.isCreativeMode) { + event.getItemStack().shrink(1); + } + Vec3d v = player.getLookVec(); + player.getRidingEntity().addVelocity(v.x * 500, v.y * 500, v.z * 500); + event.setCancellationResult(EnumActionResult.SUCCESS); + event.setCanceled(true); + } + } + } + private static void removeLeyNBT(EntityLivingBase e) { e.getEntityData().removeTag("timeSince"); e.getEntityData().removeTag("inPoly"); From 1018ff38763c55cdab9c26baaeb97a99947d0845 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sat, 12 May 2018 11:22:34 -0400 Subject: [PATCH 28/87] Let's try that again. --- .../vigilant_eureka/items/DebugStick.java | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java index c307e41..6cefddd 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java @@ -1,6 +1,7 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -8,13 +9,13 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import net.minecraft.world.gen.structure.template.PlacementSettings; -import net.minecraft.world.gen.structure.template.Template; -import net.minecraft.world.gen.structure.template.TemplateManager; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -32,11 +33,29 @@ public void initModel() { @Override public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { - if (!worldIn.isRemote) { - WorldServer server = (WorldServer) worldIn; - TemplateManager templateManager = server.getStructureTemplateManager(); - Template template = templateManager.get(null, new ResourceLocation(Reference.MOD_ID + ":leystruct1")); - template.addBlocksToWorld(worldIn, pos, new PlacementSettings()); + if (!worldIn.isRemote && worldIn instanceof WorldServer) { + try { + Chunk oldChunk = worldIn.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); + IChunkProvider provider = worldIn.getChunkProvider(); + IChunkGenerator generator = ((ChunkProviderServer) provider).chunkGenerator; + Chunk newChunk = generator.generateChunk(oldChunk.x, oldChunk.z); + + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + for (int y = 0; y < worldIn.getHeight(); y++) { + IBlockState state = newChunk.getBlockState(x, y, z); + worldIn.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); + } + } + } + + oldChunk.setTerrainPopulated(false); + generator.populate(oldChunk.x, oldChunk.z); + oldChunk.markDirty(); + oldChunk.resetRelightChecks(); + } catch (Exception e) { + e.printStackTrace(); + } } return EnumActionResult.SUCCESS; } From 96b9e854c2486f31900127f847b47cb6655e75cd Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sat, 12 May 2018 14:48:48 -0400 Subject: [PATCH 29/87] Rename PacketSendKey -> PacketSendWarp --- .../{PacketSendKey.java => PacketSendWarp.java} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/main/java/me/itstheholyblack/vigilant_eureka/network/{PacketSendKey.java => PacketSendWarp.java} (91%) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendKey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendWarp.java similarity index 91% rename from src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendKey.java rename to src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendWarp.java index e29ba1a..d04388e 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendKey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendWarp.java @@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -public class PacketSendKey implements IMessage { +public class PacketSendWarp implements IMessage { private BlockPos blockPos; @Override @@ -28,15 +28,15 @@ public void toBytes(ByteBuf buf) { buf.writeLong(blockPos.toLong()); } - public PacketSendKey() { + public PacketSendWarp() { // Calculate the position of the block we are looking at RayTraceResult result = Minecraft.getMinecraft().objectMouseOver; blockPos = result.getBlockPos(); } - public static class Handler implements IMessageHandler { + public static class Handler implements IMessageHandler { @Override - public IMessage onMessage(PacketSendKey message, MessageContext ctx) { + public IMessage onMessage(PacketSendWarp message, MessageContext ctx) { // Always use a construct like this to actually handle your message. This ensures that // your 'handle' code is run on the main Minecraft thread. 'onMessage' itself // is called on the networking thread so it is not safe to do a lot of things @@ -45,7 +45,7 @@ public IMessage onMessage(PacketSendKey message, MessageContext ctx) { return null; } - private void handle(PacketSendKey message, MessageContext ctx) { + private void handle(PacketSendWarp message, MessageContext ctx) { // This code is run on the server side. So you can do server-side calculations here EntityPlayerMP playerEntity = ctx.getServerHandler().player; World world = playerEntity.getEntityWorld(); From 98c7f65fd9cdbd052e0c856f9d765f0789ba8e6d Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sat, 12 May 2018 14:57:44 -0400 Subject: [PATCH 30/87] Add Baubles dependency --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 032bda4..0be56b7 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ dependencies { // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html - + compile files('libs/Baubles-deobf.jar') } processResources { From c109e44272fc4c1fcc554420bd8b02bcd88ee1eb Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sat, 12 May 2018 14:58:01 -0400 Subject: [PATCH 31/87] Add "dummy" ItemTime --- .../vigilant_eureka/items/armor/ItemTime.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ItemTime.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ItemTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ItemTime.java new file mode 100644 index 0000000..ce1e614 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ItemTime.java @@ -0,0 +1,55 @@ +package me.itstheholyblack.vigilant_eureka.items.armor; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import baubles.api.render.IRenderBauble; +import me.itstheholyblack.vigilant_eureka.Reference; +import me.itstheholyblack.vigilant_eureka.items.ModItems; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class ItemTime extends Item implements IBauble, IRenderBauble { + public ItemTime() { + setRegistryName(Reference.MOD_ID, "time"); + setUnlocalizedName(Reference.MOD_ID + ".time"); + this.setMaxStackSize(1); + this.setCreativeTab(ModItems.CREATIVE_TAB); + } + + @SideOnly(Side.CLIENT) + public void initModel() { + ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory")); + } + + @Override + public BaubleType getBaubleType(ItemStack itemStack) { + return BaubleType.AMULET; + } + + @Override + @SideOnly(Side.CLIENT) + public void onPlayerBaubleRender(ItemStack itemStack, EntityPlayer entityPlayer, RenderType renderType, float v) { + if (renderType.equals(RenderType.BODY)) { + Helper.rotateIfSneaking(entityPlayer); + Helper.translateToChest(); + Helper.defaultTransforms(); + scale(1.25F); + GlStateManager.translate(0F, -0.2F, 0F); + GlStateManager.pushMatrix(); + Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(this), ItemCameraTransforms.TransformType.NONE); + GlStateManager.popMatrix(); + } + } + + private static void scale(float f) { + GlStateManager.scale(f, f, f); + } +} From 318b884125a603ef4a0a11aeb97099d2977dd4b0 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sat, 12 May 2018 14:58:40 -0400 Subject: [PATCH 32/87] Register + assets for time --- .../vigilant_eureka/items/ModItems.java | 4 ++++ .../vigilant_eureka/proxy/CommonProxy.java | 2 ++ .../vigilant_eureka/models/item/time.json | 6 ++++++ .../vigilant_eureka/textures/items/time.png | Bin 0 -> 536 bytes .../models/armor/bugger_me_layer_1.png | Bin 1323 -> 1302 bytes 5 files changed, 12 insertions(+) create mode 100644 src/main/resources/assets/vigilant_eureka/models/item/time.json create mode 100644 src/main/resources/assets/vigilant_eureka/textures/items/time.png diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java index cfb8439..825eb8b 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java @@ -2,6 +2,7 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.items.armor.InvisCap; +import me.itstheholyblack.vigilant_eureka.items.armor.ItemTime; import me.itstheholyblack.vigilant_eureka.items.armor.WarpBoots; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; @@ -26,6 +27,8 @@ public class ModItems { public static DebugStick debugStick; @GameRegistry.ObjectHolder(Reference.MOD_ID + ":throwing_card") public static ItemCard itemCard; + @GameRegistry.ObjectHolder(Reference.MOD_ID + ":time") + public static ItemTime itemTime; public static final CreativeTabs CREATIVE_TAB = new CreativeTabs("vigilantEureka") { @Override @@ -39,6 +42,7 @@ public static void initModels() { dimKey.initModel(); warpBoots.initModel(); invisCap.initModel(); + itemTime.initModel(); bismite.initModel(); leyKey.initModel(); debugStick.initModel(); diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java index 85f05f5..008eea6 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java @@ -8,6 +8,7 @@ import me.itstheholyblack.vigilant_eureka.entity.ModEntities; import me.itstheholyblack.vigilant_eureka.items.*; import me.itstheholyblack.vigilant_eureka.items.armor.InvisCap; +import me.itstheholyblack.vigilant_eureka.items.armor.ItemTime; import me.itstheholyblack.vigilant_eureka.items.armor.WarpBoots; import me.itstheholyblack.vigilant_eureka.network.PacketHandler; import me.itstheholyblack.vigilant_eureka.world.WorldGenBismuth; @@ -72,6 +73,7 @@ public static void registerItems(RegistryEvent.Register event) { event.getRegistry().register(new DimKey()); event.getRegistry().register(new WarpBoots()); event.getRegistry().register(new InvisCap()); + event.getRegistry().register(new ItemTime()); event.getRegistry().register(new ItemBismite()); event.getRegistry().register(new ItemLeyKey()); event.getRegistry().register(new ItemLeyRune()); diff --git a/src/main/resources/assets/vigilant_eureka/models/item/time.json b/src/main/resources/assets/vigilant_eureka/models/item/time.json new file mode 100644 index 0000000..29bf1af --- /dev/null +++ b/src/main/resources/assets/vigilant_eureka/models/item/time.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "vigilant_eureka:items/time" + } +} diff --git a/src/main/resources/assets/vigilant_eureka/textures/items/time.png b/src/main/resources/assets/vigilant_eureka/textures/items/time.png new file mode 100644 index 0000000000000000000000000000000000000000..c853fc7fa2ba2fbd2d390144e861339ccab42375 GIT binary patch literal 536 zcmV+z0_XjSP)qE`R_03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00DeSL_t(I%gvHMOC&)M z#eaPmIg74r*x^NY4ay}wtP`0m^l^t=D42|~D1L)YE*ilNjWjtfaX}1JxZ6k=hn+zE z5(6f}2D5P)$Ta(B77TsRP+isa>b;_20wO|et;E(ci`ZIXYeht+@}GDIoO3?j3&X_( zvqk3|&N+-R3kho#oDGM>*3#*8u-5W&cgNXq=z8Fkdd%*vcu2!uP02Utt&`B1G-~1g0d_D_&3;OH(nL@7yxj)oy(uUM#0!ys;wT5F?cy56J00000D7=C6M_LgB0L6{(d z2;ndxh{Q#3p(2F9m2&0cFe#3JQyQE9+mDMB#87eo*)j4(kM zqccJ*Vp%j-JbpF1{!}j3hkY+ByEB@Z-S>IFUn!hL>+2Ss4u24az}gz1HL$Y6d%q7n ze5i1NNuRkQmjmwJ1zIg&W`=XcB9PAmU%%p_llPx@w%gQz3r_mGRws#j_I+x_rPqM{ zeISb5Sfs8saP{i{0Dxiz1ApJXWlduk3d5;$oEp!cTZEyLYCcaU`+eS{h;!X8;CW;s2>4tm0Iy$L zcbaxu(r$CFF`UokfM?IR@5Kx5>GgoekJV%WkT{=~xY&8UPKIvY1U5FvjDU0fI?!m4 zu~I2(BKG}|5vU|MI_NMhD-xYZC6%Kw8?tC4nHl?rKO{5t5plF$#@VDm^kKdau*Vi zCP<@qK!5A&ba*#zI1rMAKEd-QUQCVe<<+VkM2|QI78fsc6?tjsY$@EoZ!_a}?^U)PqJrMpThq7bAMG0GS5N*Xt!Z275w#wIHfvY0FW1Y zo@)}wH^*&VYbt8MVibDi9e7Yg)u`#E`2UuISd`z2i0C> z`HsS$f7{?E;Fsk)Y5-D_WI-Fo0e8EOnSZpu5vFBaD6j%eJIs*-V2mq&10jkG=RmaNlCu9=d>V-Sj5FKf76=2!5cEdqgG={o0d$Hu;nE-W(?7k zBE}f^QBkB&EV^VV-6j*p)69sOgyC>;d}(Q z{56K-`FZ|RBpM+0d0L6v>+yWgqx6T-fRXnDc6Qj^O%gKFYO&oFhR&AtF){N78EXUM#vKL>!PbKI52-KYDcZRBMlan{<*6 zWn%V(^-7Jt?(z@>F1xyQi_f#O98NczuJ_;V()ny{@$PvirlQAv_-V{2rH;MEqXE4h z@bRN-T}#F#w7s3(aqSvyd3X2JI6f{0ew6+NHT?Q01sB8t00000NkvXXu0mjfH{Db= delta 1258 zcmV0F6g^soWf>M>gfS{a z2*Cs+f(XHdiV*SxT%`yhm5Y@AF{y%!6e)rbDqMv8f)G*#6G9MSabb)JB8bI^We~%# z`-;QWtZe5=dH#^)cVUrcwX>Rg?!D)JR4_|AodTl~5XZpl*MERgz|Iao^Bj2jvVtWR zHS>vT6?pUr7z}{bRo-hffLaas`4h`7!GGSFru2X%7xh<9JLkWLA-&?(d%(#FV2odj z)s+I)*8T?oG#Y@`UgdqO^*XS(SNOLn?!+r1HbI*7Tyn0nxEC7<{%NCb7@As+D{rkZFK9v!0?%V;Ago-tr(;<@Q ze8<57*X!%k8Kco4kVi*1zys8&C{T(@TFXmo0ue>LFMrbSQwh0ej3-HBcz-zbV2YHV zPtzL!fVFh*lM}jnl5kzEQu#EUxM`9kNRk9wTU*@S?H0&$;OkdfUu%X1K)?i0QM4TY zD=Rl5lPG9Sr2&?lILniboNFv6jEdr-*>GK)HGX>U2nW zckg--oPQ%H1i`|asq6dmUay#B4{L#E&z8E2yfrf03QwLCQ|nKk7Hhc=9}0}eB-}U# zo<6f>L?b>%L!5>VIrjkgVYxpOYRXiWrX4t60nZLBPVQ zTAePtXJi|7VF1z;Xt!BCNjNdq>^44-a9&>-UTOiAPIo)cp z3ymV+@ngO>NeGzq9{c+QXmgY6&!4%!-R61@j<`4gVMyi6d;###ySoKeR;Y}%JiN8E zl7A=~1Rk_3qr&ozJO@Uj=_XAYF0s5+lg9Y>%DOzixH16b55>KOC(@LbT3e$M&haXj zzo#292_;c_b(QZCWk)05q{*`)!Ur;=(0Z=Sr7ne)X{W6FVWy*XbO3S)lX9rp)%qs^#Yk%MVTFZlr6&^gGVq*RAm`Vo$t(j%)3Pm}k z&RR9kJ*i1cJ{)>4FosQ>wfs#fazij@hR4T`#pIA;8Rt0ik{HvPXi5{KwLg?G9B@dn zBvT+`fFD0NOv!WqE(w!3<|Vvvo(C8MY;Rv_brx>ob< zDziaR-Z{FnSUCvj0Rlpv6EJIeKM1B>-#I^b%=76CaODFLv5FAMV8G8t!xte!Kyp}N z>+@Xn-Ma#<7ClR1^YHM`z5m``F=H8?3XxiSEdx`9DDtUkV}owKzRm+2902$3c_tnX zeXf>~*?F?PT|uu`OlFEo{rli!fwO@MI-O!tj>?R#TuhYNREiC)Y5ns`*d>#H0HH@e U#1j@Fc>n+a07*qoM6N<$f)?0SYXATM From dd37c0eb5bd9efff77e086c5bbd2d47912c230bc Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sat, 12 May 2018 14:59:03 -0400 Subject: [PATCH 33/87] Add keybind for time --- .../itstheholyblack/vigilant_eureka/client/Keybinds.java | 2 ++ .../itstheholyblack/vigilant_eureka/core/InputHandler.java | 7 +++++-- .../vigilant_eureka/items/armor/ArmorTypes.java | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/Keybinds.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/Keybinds.java index 591ae7a..6c39a3d 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/Keybinds.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/Keybinds.java @@ -11,6 +11,7 @@ public class Keybinds { public static KeyBinding warpKey; + public static KeyBinding timeKey; private static KeyBinding init(String s, int key, String group) { KeyBinding kb = new KeyBinding(Reference.MOD_ID + ".keybind." + s, key, group); @@ -20,5 +21,6 @@ private static KeyBinding init(String s, int key, String group) { public static void initWarpKey() { warpKey = init("warp_key", Keyboard.KEY_R, Reference.MOD_ID + ".gui.keybinds"); + timeKey = init("time_key", Keyboard.KEY_G, Reference.MOD_ID + ".gui.keybinds"); } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/InputHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/InputHandler.java index 200f73d..8e7d04a 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/InputHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/InputHandler.java @@ -4,7 +4,8 @@ import me.itstheholyblack.vigilant_eureka.client.Keybinds; import me.itstheholyblack.vigilant_eureka.items.ModItems; import me.itstheholyblack.vigilant_eureka.network.PacketHandler; -import me.itstheholyblack.vigilant_eureka.network.PacketSendKey; +import me.itstheholyblack.vigilant_eureka.network.PacketSendTime; +import me.itstheholyblack.vigilant_eureka.network.PacketSendWarp; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.inventory.EntityEquipmentSlot; @@ -18,7 +19,9 @@ public class InputHandler { public void onKeyInput(InputEvent.KeyInputEvent event) { EntityPlayerSP player = Minecraft.getMinecraft().player; if (Keybinds.warpKey.isPressed() && player.getItemStackFromSlot(EntityEquipmentSlot.FEET).getItem().equals(ModItems.warpBoots)) { - PacketHandler.INSTANCE.sendToServer(new PacketSendKey()); + PacketHandler.INSTANCE.sendToServer(new PacketSendWarp()); + } else if (Keybinds.timeKey.isPressed()) { + PacketHandler.INSTANCE.sendToServer(new PacketSendTime()); } } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ArmorTypes.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ArmorTypes.java index d765318..fc34df7 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ArmorTypes.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ArmorTypes.java @@ -5,8 +5,8 @@ import net.minecraft.item.ItemArmor; import net.minecraftforge.common.util.EnumHelper; -public class ArmorTypes { - public static final ItemArmor.ArmorMaterial BUGGER_ME_MAT = EnumHelper.addArmorMaterial("BUGGER_ME_MAT", +class ArmorTypes { + static final ItemArmor.ArmorMaterial BUGGER_ME_MAT = EnumHelper.addArmorMaterial("BUGGER_ME_MAT", Reference.MOD_ID + ":bugger_me", 20, new int[]{2, 6, 5, 2}, 40, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F); } From 996a99708d97b8c4d437b8a507965befce1cebb2 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sat, 12 May 2018 14:59:13 -0400 Subject: [PATCH 34/87] Add time packet and handling --- .../network/PacketHandler.java | 5 +- .../network/PacketSendTime.java | 90 +++++++++++++++++++ .../assets/vigilant_eureka/lang/en_us.lang | 1 + 3 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java index f8c24ef..3ebfd4f 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java @@ -12,7 +12,7 @@ public class PacketHandler { public PacketHandler() { } - public static int nextID() { + private static int nextID() { return packetId++; } @@ -23,7 +23,8 @@ public static void registerMessages(String channelName) { public static void registerMessages() { // Register messages which are sent from the client to the server here: - INSTANCE.registerMessage(PacketSendKey.Handler.class, PacketSendKey.class, nextID(), Side.SERVER); + INSTANCE.registerMessage(PacketSendWarp.Handler.class, PacketSendWarp.class, nextID(), Side.SERVER); + INSTANCE.registerMessage(PacketSendTime.Handler.class, PacketSendTime.class, nextID(), Side.SERVER); INSTANCE.registerMessage(PacketEndericPoof.Handler.class, PacketEndericPoof.class, nextID(), Side.CLIENT); } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java new file mode 100644 index 0000000..5161c35 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java @@ -0,0 +1,90 @@ +package me.itstheholyblack.vigilant_eureka.network; + +import baubles.api.BaublesApi; +import io.netty.buffer.ByteBuf; +import me.itstheholyblack.vigilant_eureka.items.ModItems; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraft.world.gen.IChunkGenerator; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +public class PacketSendTime implements IMessage { + + private BlockPos blockPos; + + @Override + public void fromBytes(ByteBuf buf) { + // Encoding the position as a long is more efficient + blockPos = BlockPos.fromLong(buf.readLong()); + } + + @Override + public void toBytes(ByteBuf buf) { + // Encoding the position as a long is more efficient + buf.writeLong(blockPos.toLong()); + } + + public PacketSendTime() { + RayTraceResult result = Minecraft.getMinecraft().objectMouseOver; + blockPos = result.getBlockPos(); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(PacketSendTime message, MessageContext ctx) { + // Always use a construct like this to actually handle your message. This ensures that + // your 'handle' code is run on the main Minecraft thread. 'onMessage' itself + // is called on the networking thread so it is not safe to do a lot of things + // here. + FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx)); + return null; + } + + private void handle(PacketSendTime message, MessageContext ctx) { + // This code is run on the server side. So you can do server-side calculations here + EntityPlayerMP playerEntity = ctx.getServerHandler().player; + World world = playerEntity.getEntityWorld(); + BlockPos pos = message.blockPos; + if (BaublesApi.isBaubleEquipped(playerEntity, ModItems.itemTime) != -1 && !world.isRemote && world instanceof WorldServer) { + // ngl i stole this from ICBM + try { + Chunk oldChunk = world.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); + IChunkProvider provider = world.getChunkProvider(); + IChunkGenerator generator = ((ChunkProviderServer) provider).chunkGenerator; + Chunk newChunk = generator.generateChunk(oldChunk.x, oldChunk.z); + + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + for (int y = pos.getY() - 4; y < pos.getY() + 4; y++) { + IBlockState state = newChunk.getBlockState(x, y, z); + IBlockState oldState = oldChunk.getBlockState(x, y, z); + if (!oldState.equals(Blocks.END_PORTAL) && !oldState.getBlock().equals(Blocks.END_PORTAL_FRAME) && !oldState.equals(Blocks.END_GATEWAY.getDefaultState())) { + world.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); + } + } + } + } + + oldChunk.setTerrainPopulated(false); + generator.populate(oldChunk.x, oldChunk.z); + oldChunk.markDirty(); + oldChunk.resetRelightChecks(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang index 6ba8409..5612007 100644 --- a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang +++ b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang @@ -19,6 +19,7 @@ mouseovertext.throwing_card=The card seems to hum with energy. Maybe you should itemGroup.vigilantEureka=Vigilant Eureka vigilant_eureka.keybind.warp_key=Warp with Warp Boots +vigilant_eureka.keybind.time_key=Open the Eye vigilant_eureka.gui.keybinds=Vigilant Eureka message.ley_link_good=It worked! From 86b3f5548f25989269c002edbb2b0ec89f0bed46 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 09:58:24 -0400 Subject: [PATCH 35/87] Add libs/ to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c0d5e44..ad32e34 100644 --- a/.gitignore +++ b/.gitignore @@ -62,4 +62,5 @@ Temporary Items # ARL Symlinks api/ +libs/ /forgestore.jks From 487e773205f5d909b5ccd43f2326c404ecec2fec Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 09:59:07 -0400 Subject: [PATCH 36/87] Add Baubles dependency --- src/main/java/me/itstheholyblack/vigilant_eureka/Eureka.java | 2 +- .../java/me/itstheholyblack/vigilant_eureka/Reference.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/Eureka.java b/src/main/java/me/itstheholyblack/vigilant_eureka/Eureka.java index c9d6370..02645c4 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/Eureka.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/Eureka.java @@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, certificateFingerprint = Reference.MOD_KEY, acceptedMinecraftVersions = "[1.12,)") +@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, certificateFingerprint = Reference.MOD_KEY, acceptedMinecraftVersions = "[1.12,)", dependencies = Reference.DEPENDS) public class Eureka { @SidedProxy(clientSide = "me.itstheholyblack.vigilant_eureka.proxy.ClientProxy", serverSide = "me.itstheholyblack.vigilant_eureka.proxy.ServerProxy") diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java b/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java index 45b4d06..24caf57 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java @@ -1,8 +1,9 @@ package me.itstheholyblack.vigilant_eureka; public class Reference { - public static final String MOD_NAME = "Vigilant Eureka"; + static final String MOD_NAME = "Vigilant Eureka"; public static final String MOD_ID = "vigilant_eureka"; - public static final String VERSION = "0.0.3-alpha"; + static final String VERSION = "0.0.4"; public static final String MOD_KEY = "19d2daed26722f2762d067603604a6d1f909f262"; + static final String DEPENDS = "required-after:baubles@[1.5.2,)"; } From 84d3b79ac518359022f43861dc9fbc939e2d4fad Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 09:59:54 -0400 Subject: [PATCH 37/87] version bump --- src/main/resources/mcmod.info | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 982e699..da7a924 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,16 +1,18 @@ [ -{ - "modid": "vigilant_eureka", - "name": "Vigilant Eureka", - "description": "A mod that does things to the Minecraft.\nSource is available at https://github.com/tkdberger/vigilant-eureka", - "version": "0.0.3", - "mcversion": "1.12", - "url": "https://minecraft.curseforge.com/projects/vigilant-eureka", - "updateUrl": "", - "authorList": ["Edwan Vi"], - "credits": "Paul Fulham, for being the generous god they are.\nSamuel#2783 (sorry) for the basis of the key texture.\nBord Listian, for the Crystalline Bismuth texture.\nPeople smarter than me, for Forge.", - "logoFile": "", - "screenshots": [], - "dependencies": [] -} + { + "modid": "vigilant_eureka", + "name": "Vigilant Eureka", + "description": "A mod that does things to the Minecraft.\nSource is available at https://github.com/tkdberger/vigilant-eureka", + "version": "0.0.4", + "mcversion": "1.12", + "url": "https://minecraft.curseforge.com/projects/vigilant-eureka", + "updateUrl": "", + "authorList": [ + "Edwan Vi" + ], + "credits": "Paul Fulham, for being the generous god they are.\nSamuel#2783 (sorry) for the basis of the key texture.\nBord Listian, for the Crystalline Bismuth texture.\nPeople smarter than me, for Forge.", + "logoFile": "", + "screenshots": [], + "dependencies": [] + } ] From 480630bac6380da91a588f63506c383445802b65 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 10:00:57 -0400 Subject: [PATCH 38/87] Couple of shots at structure restoration --- .../vigilant_eureka/items/DebugStick.java | 13 ++++++++++--- .../vigilant_eureka/network/PacketSendTime.java | 8 ++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java index 6cefddd..08d1e27 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java @@ -1,9 +1,11 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.util.EnumActionResult; @@ -39,18 +41,23 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos IChunkProvider provider = worldIn.getChunkProvider(); IChunkGenerator generator = ((ChunkProviderServer) provider).chunkGenerator; Chunk newChunk = generator.generateChunk(oldChunk.x, oldChunk.z); + //oldChunk.setTerrainPopulated(false); + //oldChunk.populate(provider, generator); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { for (int y = 0; y < worldIn.getHeight(); y++) { IBlockState state = newChunk.getBlockState(x, y, z); - worldIn.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); + Block oldBlock = oldChunk.getBlockState(x, y, z).getBlock(); + if (!oldBlock.equals(Blocks.END_PORTAL) && !oldBlock.equals(Blocks.END_PORTAL_FRAME) && !oldBlock.equals(Blocks.END_GATEWAY)) { + worldIn.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); + } } } } - oldChunk.setTerrainPopulated(false); - generator.populate(oldChunk.x, oldChunk.z); + oldChunk.populate(provider, generator); + System.out.println("Finished that up nice!"); oldChunk.markDirty(); oldChunk.resetRelightChecks(); } catch (Exception e) { diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java index 5161c35..80f17e5 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java @@ -60,10 +60,12 @@ private void handle(PacketSendTime message, MessageContext ctx) { if (BaublesApi.isBaubleEquipped(playerEntity, ModItems.itemTime) != -1 && !world.isRemote && world instanceof WorldServer) { // ngl i stole this from ICBM try { - Chunk oldChunk = world.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); + Chunk oldChunk = world.getChunkFromBlockCoords(pos); IChunkProvider provider = world.getChunkProvider(); IChunkGenerator generator = ((ChunkProviderServer) provider).chunkGenerator; Chunk newChunk = generator.generateChunk(oldChunk.x, oldChunk.z); + oldChunk.setTerrainPopulated(false); + generator.populate(oldChunk.x, oldChunk.z); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { @@ -76,9 +78,7 @@ private void handle(PacketSendTime message, MessageContext ctx) { } } } - - oldChunk.setTerrainPopulated(false); - generator.populate(oldChunk.x, oldChunk.z); + System.out.println("Finished that up nice!"); oldChunk.markDirty(); oldChunk.resetRelightChecks(); } catch (Exception e) { From d3fd42f97fade4a34f7d9049b15e47e4d56d1a44 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 15:24:32 -0400 Subject: [PATCH 39/87] Fix the ghosts, thanks @therealfarfetchd --- .../vigilant_eureka/core/ChunkRebuilder.java | 44 +++++++++++++++++++ .../vigilant_eureka/items/DebugStick.java | 29 +----------- .../network/PacketSendTime.java | 34 +------------- .../network/PacketSendWarp.java | 4 +- 4 files changed, 49 insertions(+), 62 deletions(-) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java new file mode 100644 index 0000000..702479c --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java @@ -0,0 +1,44 @@ +package me.itstheholyblack.vigilant_eureka.core; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraft.world.gen.IChunkGenerator; + +public class ChunkRebuilder { + public static void rebuildChunk(World world, BlockPos pos) { + // ngl i stole this from ICBM + try { + Chunk oldChunk = world.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); + IChunkProvider provider = world.getChunkProvider(); + IChunkGenerator generator = ((ChunkProviderServer) provider).chunkGenerator; + Chunk newChunk = generator.generateChunk(oldChunk.x, oldChunk.z); + //oldChunk.setTerrainPopulated(false); + //oldChunk.populate(provider, generator); + + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + for (int y = (pos.getY() - 4); y < (pos.getY() + 4); y++) { + IBlockState state = newChunk.getBlockState(x, y, z); + Block oldBlock = oldChunk.getBlockState(x, y, z).getBlock(); + if (!oldBlock.equals(Blocks.END_PORTAL) && !oldBlock.equals(Blocks.END_PORTAL_FRAME) && !oldBlock.equals(Blocks.END_GATEWAY)) { + world.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); + } + } + } + } + oldChunk.setTerrainPopulated(false); + oldChunk.populate(provider, generator); + System.out.println("Finished that up nice!"); + oldChunk.markDirty(); + oldChunk.resetRelightChecks(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java index 08d1e27..7140489 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java @@ -1,6 +1,7 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; +import me.itstheholyblack.vigilant_eureka.core.ChunkRebuilder; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -36,33 +37,7 @@ public void initModel() { @Override public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote && worldIn instanceof WorldServer) { - try { - Chunk oldChunk = worldIn.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); - IChunkProvider provider = worldIn.getChunkProvider(); - IChunkGenerator generator = ((ChunkProviderServer) provider).chunkGenerator; - Chunk newChunk = generator.generateChunk(oldChunk.x, oldChunk.z); - //oldChunk.setTerrainPopulated(false); - //oldChunk.populate(provider, generator); - - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - for (int y = 0; y < worldIn.getHeight(); y++) { - IBlockState state = newChunk.getBlockState(x, y, z); - Block oldBlock = oldChunk.getBlockState(x, y, z).getBlock(); - if (!oldBlock.equals(Blocks.END_PORTAL) && !oldBlock.equals(Blocks.END_PORTAL_FRAME) && !oldBlock.equals(Blocks.END_GATEWAY)) { - worldIn.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); - } - } - } - } - oldChunk.setTerrainPopulated(false); - oldChunk.populate(provider, generator); - System.out.println("Finished that up nice!"); - oldChunk.markDirty(); - oldChunk.resetRelightChecks(); - } catch (Exception e) { - e.printStackTrace(); - } + ChunkRebuilder.rebuildChunk(worldIn, pos); } return EnumActionResult.SUCCESS; } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java index 80f17e5..f28ae0c 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java @@ -2,19 +2,14 @@ import baubles.api.BaublesApi; import io.netty.buffer.ByteBuf; +import me.itstheholyblack.vigilant_eureka.core.ChunkRebuilder; import me.itstheholyblack.vigilant_eureka.items.ModItems; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderServer; -import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; @@ -58,32 +53,7 @@ private void handle(PacketSendTime message, MessageContext ctx) { World world = playerEntity.getEntityWorld(); BlockPos pos = message.blockPos; if (BaublesApi.isBaubleEquipped(playerEntity, ModItems.itemTime) != -1 && !world.isRemote && world instanceof WorldServer) { - // ngl i stole this from ICBM - try { - Chunk oldChunk = world.getChunkFromBlockCoords(pos); - IChunkProvider provider = world.getChunkProvider(); - IChunkGenerator generator = ((ChunkProviderServer) provider).chunkGenerator; - Chunk newChunk = generator.generateChunk(oldChunk.x, oldChunk.z); - oldChunk.setTerrainPopulated(false); - generator.populate(oldChunk.x, oldChunk.z); - - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - for (int y = pos.getY() - 4; y < pos.getY() + 4; y++) { - IBlockState state = newChunk.getBlockState(x, y, z); - IBlockState oldState = oldChunk.getBlockState(x, y, z); - if (!oldState.equals(Blocks.END_PORTAL) && !oldState.getBlock().equals(Blocks.END_PORTAL_FRAME) && !oldState.equals(Blocks.END_GATEWAY.getDefaultState())) { - world.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); - } - } - } - } - System.out.println("Finished that up nice!"); - oldChunk.markDirty(); - oldChunk.resetRelightChecks(); - } catch (Exception e) { - e.printStackTrace(); - } + ChunkRebuilder.rebuildChunk(world, pos); } } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendWarp.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendWarp.java index d04388e..d09bbbf 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendWarp.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendWarp.java @@ -56,9 +56,7 @@ private void handle(PacketSendWarp message, MessageContext ctx) { } catch (NullPointerException e) { look = playerEntity.getPosition(); } - if (playerEntity.getCooldownTracker().hasCooldown(ModItems.warpBoots)) { - return; - } else { + if (!playerEntity.getCooldownTracker().hasCooldown(ModItems.warpBoots)) { playerEntity.getCooldownTracker().setCooldown(ModItems.warpBoots, 20); playerEntity.setPositionAndUpdate(look.getX(), look.getY() + 2, look.getZ()); PacketHandler.INSTANCE.sendToAll(new PacketEndericPoof(look.up(2))); From df11c5dfa0fc352897776c19a51f9bf38b20e25e Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 17:17:37 -0400 Subject: [PATCH 40/87] Add tooltip and item name to time --- .../vigilant_eureka/items/ModItems.java | 2 +- .../items/{armor => baubles}/ItemTime.java | 13 ++++++++++++- .../vigilant_eureka/proxy/CommonProxy.java | 2 +- .../assets/vigilant_eureka/lang/en_us.lang | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) rename src/main/java/me/itstheholyblack/vigilant_eureka/items/{armor => baubles}/ItemTime.java (82%) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java index 825eb8b..1365001 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java @@ -2,7 +2,7 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.items.armor.InvisCap; -import me.itstheholyblack.vigilant_eureka.items.armor.ItemTime; +import me.itstheholyblack.vigilant_eureka.items.baubles.ItemTime; import me.itstheholyblack.vigilant_eureka.items.armor.WarpBoots; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ItemTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java similarity index 82% rename from src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ItemTime.java rename to src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java index ce1e614..91819a6 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/ItemTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java @@ -1,4 +1,4 @@ -package me.itstheholyblack.vigilant_eureka.items.armor; +package me.itstheholyblack.vigilant_eureka.items.baubles; import baubles.api.BaubleType; import baubles.api.IBauble; @@ -9,13 +9,18 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + public class ItemTime extends Item implements IBauble, IRenderBauble { public ItemTime() { setRegistryName(Reference.MOD_ID, "time"); @@ -49,6 +54,12 @@ public void onPlayerBaubleRender(ItemStack itemStack, EntityPlayer entityPlayer, } } + @SideOnly(Side.CLIENT) + @Override + public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + tooltip.add(I18n.format("mouseovertext.time")); + } + private static void scale(float f) { GlStateManager.scale(f, f, f); } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java index 008eea6..d092c57 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java @@ -8,7 +8,7 @@ import me.itstheholyblack.vigilant_eureka.entity.ModEntities; import me.itstheholyblack.vigilant_eureka.items.*; import me.itstheholyblack.vigilant_eureka.items.armor.InvisCap; -import me.itstheholyblack.vigilant_eureka.items.armor.ItemTime; +import me.itstheholyblack.vigilant_eureka.items.baubles.ItemTime; import me.itstheholyblack.vigilant_eureka.items.armor.WarpBoots; import me.itstheholyblack.vigilant_eureka.network.PacketHandler; import me.itstheholyblack.vigilant_eureka.world.WorldGenBismuth; diff --git a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang index 5612007..d963d84 100644 --- a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang +++ b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang @@ -8,6 +8,7 @@ item.vigilant_eureka.invis_cap.name=Invisibility Cap item.vigilant_eureka.bismite.name=Bismite Deposit item.vigilant_eureka.ley_key.name=Crystalline Bismuth item.vigilant_eureka.throwing_card.name=Throwing Card +item.vigilant_eureka.time.name=Time's Eye mouseovertext.dim_key=A key that opens many doors. That life has. Ed boy. mouseovertext.dim_door=A door. That moves you. To places. With motion. It's like magic, but better. @@ -15,6 +16,7 @@ mouseovertext.invis_cap=It's a cap that makes you invisible. Hey, that'd be cool mouseovertext.warp_boots=Boots that can outrun space and time, because that's definitely something your mortal feet can handle. mouseovertext.ley_key=Bismuth, melted into strange and alien shapes. Or just squares, one of the two. mouseovertext.throwing_card=The card seems to hum with energy. Maybe you should throw it? +mouseovertext.time=A strange gilded eye-shaped amulet. What would happen if you opened it? itemGroup.vigilantEureka=Vigilant Eureka From b4b0a8827cd0d3b8ec66c4b2cc3237957ed548b2 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 17:19:50 -0400 Subject: [PATCH 41/87] Add some particles to rebuildChunk --- .../vigilant_eureka/core/ChunkRebuilder.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java index 702479c..8593b0f 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java @@ -3,15 +3,17 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; +import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderServer; import net.minecraft.world.gen.IChunkGenerator; public class ChunkRebuilder { - public static void rebuildChunk(World world, BlockPos pos) { + public static void rebuildChunk(World world, BlockPos pos, BlockPos stand) { // ngl i stole this from ICBM try { Chunk oldChunk = world.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); @@ -26,8 +28,12 @@ public static void rebuildChunk(World world, BlockPos pos) { for (int y = (pos.getY() - 4); y < (pos.getY() + 4); y++) { IBlockState state = newChunk.getBlockState(x, y, z); Block oldBlock = oldChunk.getBlockState(x, y, z).getBlock(); + BlockPos working = new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16); if (!oldBlock.equals(Blocks.END_PORTAL) && !oldBlock.equals(Blocks.END_PORTAL_FRAME) && !oldBlock.equals(Blocks.END_GATEWAY)) { - world.setBlockState(new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16), state, 3); + world.setBlockState(working, state, 3); + if (!oldBlock.equals(Blocks.AIR) && world.canSeeSky(working)) { + ((WorldServer) world).spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, true, working.getX(), working.getY(), working.getZ(), 10, 0.5, 1, 0.5, 0.005D); + } } } } From 65cbdd9ce58e9dc08366cabad4a499735c3656bc Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 17:20:10 -0400 Subject: [PATCH 42/87] Clean up DebugStick.java --- .../vigilant_eureka/items/DebugStick.java | 9 +-------- .../vigilant_eureka/network/PacketSendTime.java | 16 ++++++++++------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java index 7140489..cb68bd5 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java @@ -2,11 +2,8 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.core.ChunkRebuilder; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.util.EnumActionResult; @@ -15,10 +12,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderServer; -import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -37,7 +30,7 @@ public void initModel() { @Override public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote && worldIn instanceof WorldServer) { - ChunkRebuilder.rebuildChunk(worldIn, pos); + ChunkRebuilder.rebuildChunk(worldIn, pos, playerIn.getPosition()); } return EnumActionResult.SUCCESS; } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java index f28ae0c..7c6d31b 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java @@ -17,23 +17,27 @@ public class PacketSendTime implements IMessage { - private BlockPos blockPos; + private BlockPos look; + private BlockPos stand; @Override public void fromBytes(ByteBuf buf) { // Encoding the position as a long is more efficient - blockPos = BlockPos.fromLong(buf.readLong()); + look = BlockPos.fromLong(buf.readLong()); + stand = BlockPos.fromLong(buf.readLong()); } @Override public void toBytes(ByteBuf buf) { // Encoding the position as a long is more efficient - buf.writeLong(blockPos.toLong()); + buf.writeLong(look.toLong()); + buf.writeLong(stand.toLong()); } public PacketSendTime() { RayTraceResult result = Minecraft.getMinecraft().objectMouseOver; - blockPos = result.getBlockPos(); + look = result.getBlockPos(); + stand = Minecraft.getMinecraft().player.getPosition(); } public static class Handler implements IMessageHandler { @@ -51,9 +55,9 @@ private void handle(PacketSendTime message, MessageContext ctx) { // This code is run on the server side. So you can do server-side calculations here EntityPlayerMP playerEntity = ctx.getServerHandler().player; World world = playerEntity.getEntityWorld(); - BlockPos pos = message.blockPos; + BlockPos pos = message.look; if (BaublesApi.isBaubleEquipped(playerEntity, ModItems.itemTime) != -1 && !world.isRemote && world instanceof WorldServer) { - ChunkRebuilder.rebuildChunk(world, pos); + ChunkRebuilder.rebuildChunk(world, pos, message.stand); } } } From 1c0b558770ae95b4e779a04ac91627fd374978dd Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 14 May 2018 18:19:31 -0400 Subject: [PATCH 43/87] Format sauce --- .../java/me/itstheholyblack/vigilant_eureka/items/ModItems.java | 2 +- .../me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java index 1365001..0e86a1b 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ModItems.java @@ -2,8 +2,8 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.items.armor.InvisCap; -import me.itstheholyblack.vigilant_eureka.items.baubles.ItemTime; import me.itstheholyblack.vigilant_eureka.items.armor.WarpBoots; +import me.itstheholyblack.vigilant_eureka.items.baubles.ItemTime; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java index d092c57..94a584d 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java @@ -8,8 +8,8 @@ import me.itstheholyblack.vigilant_eureka.entity.ModEntities; import me.itstheholyblack.vigilant_eureka.items.*; import me.itstheholyblack.vigilant_eureka.items.armor.InvisCap; -import me.itstheholyblack.vigilant_eureka.items.baubles.ItemTime; import me.itstheholyblack.vigilant_eureka.items.armor.WarpBoots; +import me.itstheholyblack.vigilant_eureka.items.baubles.ItemTime; import me.itstheholyblack.vigilant_eureka.network.PacketHandler; import me.itstheholyblack.vigilant_eureka.world.WorldGenBismuth; import me.itstheholyblack.vigilant_eureka.world.WorldGenLey; From ad5308759681070bba42117c5efc42c8b9ddaf28 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:11:08 -0400 Subject: [PATCH 44/87] Add open model (vs default closed) --- .../assets/vigilant_eureka/models/item/time.json | 10 +++++++++- .../vigilant_eureka/models/item/time_open.json | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/vigilant_eureka/models/item/time_open.json diff --git a/src/main/resources/assets/vigilant_eureka/models/item/time.json b/src/main/resources/assets/vigilant_eureka/models/item/time.json index 29bf1af..8c995bb 100644 --- a/src/main/resources/assets/vigilant_eureka/models/item/time.json +++ b/src/main/resources/assets/vigilant_eureka/models/item/time.json @@ -2,5 +2,13 @@ "parent": "item/generated", "textures": { "layer0": "vigilant_eureka:items/time" - } + }, + "overrides": [ + { + "predicate": { + "open_eye": 1 + }, + "model": "vigilant_eureka:item/time_open" + } + ] } diff --git a/src/main/resources/assets/vigilant_eureka/models/item/time_open.json b/src/main/resources/assets/vigilant_eureka/models/item/time_open.json new file mode 100644 index 0000000..53d6425 --- /dev/null +++ b/src/main/resources/assets/vigilant_eureka/models/item/time_open.json @@ -0,0 +1,14 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "vigilant_eureka:items/time_open" + }, + "overrides": [ + { + "predicate": { + "open_eye": 0 + }, + "model": "vigilant_eureka:item/time" + } + ] +} From e156586f04fcfbb11fbd644861a63d89264c877a Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:11:54 -0400 Subject: [PATCH 45/87] Set open_eye property of ItemTime based on cooldown --- .../items/baubles/ItemTime.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java index 91819a6..2f64e4a 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java @@ -4,25 +4,46 @@ import baubles.api.IBauble; import baubles.api.render.IRenderBauble; import me.itstheholyblack.vigilant_eureka.Reference; +import me.itstheholyblack.vigilant_eureka.client.Icons; +import me.itstheholyblack.vigilant_eureka.client.renderer.RenderHelp; import me.itstheholyblack.vigilant_eureka.items.ModItems; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; import java.util.List; public class ItemTime extends Item implements IBauble, IRenderBauble { public ItemTime() { + // set property for multitexture + this.addPropertyOverride(new ResourceLocation("open_eye"), new IItemPropertyGetter() { + @Override + @SideOnly(Side.CLIENT) + public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { + if (entityIn instanceof EntityPlayer && ((EntityPlayer) entityIn).getCooldownTracker().hasCooldown(stack.getItem())) { + return 1.0F; + } + return 0.0F; + } + }); setRegistryName(Reference.MOD_ID, "time"); setUnlocalizedName(Reference.MOD_ID + ".time"); this.setMaxStackSize(1); From 58d65586c168e239640e9f77ff7fc1c9d3dc957b Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:12:17 -0400 Subject: [PATCH 46/87] Add cooldown to eye on packet handle --- .../vigilant_eureka/network/PacketSendTime.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java index 7c6d31b..e3c21cb 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java @@ -8,6 +8,9 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -56,8 +59,11 @@ private void handle(PacketSendTime message, MessageContext ctx) { EntityPlayerMP playerEntity = ctx.getServerHandler().player; World world = playerEntity.getEntityWorld(); BlockPos pos = message.look; - if (BaublesApi.isBaubleEquipped(playerEntity, ModItems.itemTime) != -1 && !world.isRemote && world instanceof WorldServer) { + if (!playerEntity.getCooldownTracker().hasCooldown(ModItems.itemTime) && BaublesApi.isBaubleEquipped(playerEntity, ModItems.itemTime) != -1 && !world.isRemote && world instanceof WorldServer) { + playerEntity.getCooldownTracker().setCooldown(ModItems.itemTime, 100); ChunkRebuilder.rebuildChunk(world, pos, message.stand); + } else if (playerEntity.getCooldownTracker().hasCooldown(ModItems.itemTime)) { + playerEntity.sendStatusMessage(new TextComponentTranslation("message.eye_already_open"), true); } } } From 9976040eabf9ef685220ad71f0cb32f8871b20bd Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:13:21 -0400 Subject: [PATCH 47/87] Render ItemTime differently if closed --- .../vigilant_eureka/items/baubles/ItemTime.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java index 2f64e4a..f8765dd 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java @@ -64,14 +64,20 @@ public BaubleType getBaubleType(ItemStack itemStack) { @SideOnly(Side.CLIENT) public void onPlayerBaubleRender(ItemStack itemStack, EntityPlayer entityPlayer, RenderType renderType, float v) { if (renderType.equals(RenderType.BODY)) { - Helper.rotateIfSneaking(entityPlayer); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Helper.translateToChest(); Helper.defaultTransforms(); scale(1.25F); - GlStateManager.translate(0F, -0.2F, 0F); - GlStateManager.pushMatrix(); - Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(this), ItemCameraTransforms.TransformType.NONE); - GlStateManager.popMatrix(); + boolean armor = !entityPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty(); + GlStateManager.translate(-0.5F, -0.7F, armor ? 0.1F : 0F); + + boolean open = entityPlayer.getCooldownTracker().hasCooldown(this); + TextureAtlasSprite gemIcon = open ? Icons.INSTANCE.time_open : Icons.INSTANCE.time_closed; + float f = gemIcon.getMinU(); + float f1 = gemIcon.getMaxU(); + float f2 = gemIcon.getMinV(); + float f3 = gemIcon.getMaxV(); + RenderHelp.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, gemIcon.getIconWidth(), gemIcon.getIconHeight(), 1F / 32F); } } From af04565ea13021e3f0d89d37ead1c215294f1569 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:15:18 -0400 Subject: [PATCH 48/87] Steal more Botania code like always + localize message for eye fail --- .../vigilant_eureka/client/Icons.java | 22 +++++ .../client/renderer/RenderHelp.java | 99 +++++++++++++++++++ .../vigilant_eureka/proxy/ClientProxy.java | 4 +- .../assets/vigilant_eureka/lang/en_us.lang | 3 +- 4 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/RenderHelp.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java new file mode 100644 index 0000000..478c173 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java @@ -0,0 +1,22 @@ +package me.itstheholyblack.vigilant_eureka.client; + +import me.itstheholyblack.vigilant_eureka.client.renderer.RenderHelp; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class Icons { + + public static final Icons INSTANCE = new Icons(); + + public TextureAtlasSprite time_open; + public TextureAtlasSprite time_closed; + + private Icons(){} + + @SubscribeEvent + public void onTextureStitch(TextureStitchEvent.Pre evt) { + time_open = RenderHelp.forName(evt.getMap(), "time_open_rend", "items"); + time_closed = RenderHelp.forName(evt.getMap(), "time_rend", "items"); + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/RenderHelp.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/RenderHelp.java new file mode 100644 index 0000000..348ae89 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/RenderHelp.java @@ -0,0 +1,99 @@ +package me.itstheholyblack.vigilant_eureka.client.renderer; + +import me.itstheholyblack.vigilant_eureka.Reference; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderHelp { + + public static TextureAtlasSprite forName(TextureMap ir, String name) { + return ir.registerSprite(new ResourceLocation(Reference.MOD_ID + ":" + name)); + } + + public static TextureAtlasSprite forName(TextureMap ir, String name, String dir) { + return ir.registerSprite(new ResourceLocation(Reference.MOD_ID + ":" + dir + "/" + name)); + } + + + /** + * Renders a sprite from the spritesheet with depth, like a "builtin/generated" item model. + * Adapted from ItemRenderer.renderItemIn2D, 1.7.10 + */ + public static void renderIconIn3D(Tessellator tess, float p_78439_1_, float p_78439_2_, float p_78439_3_, float p_78439_4_, int width, int height, float thickness) { + BufferBuilder wr = tess.getBuffer(); + wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + wr.pos(0.0D, 0.0D, 0.0D).tex(p_78439_1_, p_78439_4_).normal(0, 0, 1).endVertex(); + wr.pos(1.0D, 0.0D, 0.0D).tex(p_78439_3_, p_78439_4_).normal(0, 0, 1).endVertex(); + wr.pos(1.0D, 1.0D, 0.0D).tex(p_78439_3_, p_78439_2_).normal(0, 0, 1).endVertex(); + wr.pos(0.0D, 1.0D, 0.0D).tex(p_78439_1_, p_78439_2_).normal(0, 0, 1).endVertex(); + tess.draw(); + wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + wr.pos(0.0D, 1.0D, 0.0F - thickness).tex(p_78439_1_, p_78439_2_).normal(0, 0, -1).endVertex(); + wr.pos(1.0D, 1.0D, 0.0F - thickness).tex(p_78439_3_, p_78439_2_).normal(0, 0, -1).endVertex(); + wr.pos(1.0D, 0.0D, 0.0F - thickness).tex(p_78439_3_, p_78439_4_).normal(0, 0, -1).endVertex(); + wr.pos(0.0D, 0.0D, 0.0F - thickness).tex(p_78439_1_, p_78439_4_).normal(0, 0, -1).endVertex(); + tess.draw(); + float f5 = 0.5F * (p_78439_1_ - p_78439_3_) / width; + float f6 = 0.5F * (p_78439_4_ - p_78439_2_) / height; + wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + int k; + float f7; + float f8; + + for (k = 0; k < width; ++k) { + f7 = (float) k / (float) width; + f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; + wr.pos(f7, 0.0D, 0.0F - thickness).tex(f8, p_78439_4_).normal(-1, 0, 0).endVertex(); + wr.pos(f7, 0.0D, 0.0D).tex(f8, p_78439_4_).normal(-1, 0, 0).endVertex(); + wr.pos(f7, 1.0D, 0.0D).tex(f8, p_78439_2_).normal(-1, 0, 0).endVertex(); + wr.pos(f7, 1.0D, 0.0F - thickness).tex(f8, p_78439_2_).normal(-1, 0, 0).endVertex(); + } + + tess.draw(); + wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + float f9; + + for (k = 0; k < width; ++k) { + f7 = (float) k / (float) width; + f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; + f9 = f7 + 1.0F / width; + wr.pos(f9, 1.0D, 0.0F - thickness).tex(f8, p_78439_2_).normal(1, 0, 0).endVertex(); + wr.pos(f9, 1.0D, 0.0D).tex(f8, p_78439_2_).normal(1, 0, 0).endVertex(); + wr.pos(f9, 0.0D, 0.0D).tex(f8, p_78439_4_).normal(1, 0, 0).endVertex(); + wr.pos(f9, 0.0D, 0.0F - thickness).tex(f8, p_78439_4_).normal(1, 0, 0).endVertex(); + } + + tess.draw(); + wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + + for (k = 0; k < height; ++k) { + f7 = (float) k / (float) height; + f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; + f9 = f7 + 1.0F / height; + wr.pos(0.0D, f9, 0.0D).tex(p_78439_1_, f8).normal(0, 1, 0).endVertex(); + wr.pos(1.0D, f9, 0.0D).tex(p_78439_3_, f8).normal(0, 1, 0).endVertex(); + wr.pos(1.0D, f9, 0.0F - thickness).tex(p_78439_3_, f8).normal(0, 1, 0).endVertex(); + wr.pos(0.0D, f9, 0.0F - thickness).tex(p_78439_1_, f8).normal(0, 1, 0).endVertex(); + } + + tess.draw(); + wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + + for (k = 0; k < height; ++k) { + f7 = (float) k / (float) height; + f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; + wr.pos(1.0D, f7, 0.0D).tex(p_78439_3_, f8).normal(0, -1, 0).endVertex(); + wr.pos(0.0D, f7, 0.0D).tex(p_78439_1_, f8).normal(0, -1, 0).endVertex(); + wr.pos(0.0D, f7, 0.0F - thickness).tex(p_78439_1_, f8).normal(0, -1, 0).endVertex(); + wr.pos(1.0D, f7, 0.0F - thickness).tex(p_78439_3_, f8).normal(0, -1, 0).endVertex(); + } + + tess.draw(); + + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java index 775a8a3..03f05a7 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/ClientProxy.java @@ -3,6 +3,7 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.blocks.ModBlocks; import me.itstheholyblack.vigilant_eureka.blocks.tiles.LeyLineTile; +import me.itstheholyblack.vigilant_eureka.client.Icons; import me.itstheholyblack.vigilant_eureka.client.Keybinds; import me.itstheholyblack.vigilant_eureka.client.LeyLineTileRenderer; import me.itstheholyblack.vigilant_eureka.client.renderer.CustomBipedArmor; @@ -40,10 +41,10 @@ public static void registerModels(ModelRegistryEvent event) { } @SideOnly(Side.CLIENT) - @SubscribeEvent @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); + MinecraftForge.EVENT_BUS.register(Icons.INSTANCE); Keybinds.initWarpKey(); } @@ -54,7 +55,6 @@ public void preInit(FMLPreInitializationEvent event) { * @author Paul Fulham */ @SideOnly(Side.CLIENT) - @SubscribeEvent @Override public void init(FMLInitializationEvent event) { super.init(event); diff --git a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang index d963d84..473d8b5 100644 --- a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang +++ b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang @@ -31,5 +31,6 @@ message.ley_link_twoway=Two way links aren't acceptable. message.ley_solve_good=The links pulse and strengthen. message.ley_solve_incomplete=The line isn't complete! +message.enter_ley=Something feels different. -message.enter_ley=Something feels different. \ No newline at end of file +message.eye_already_open=The eye is stubbornly open - perhaps you must wait for it to close? \ No newline at end of file From 20725b4b478e40082e1c2ccbc37ddbccc054f0ed Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:16:01 -0400 Subject: [PATCH 49/87] Fix "dangerous prefix" error --- .../vigilant_eureka/entity/ModEntities.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java index 62580a2..0f9e1ad 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java @@ -12,17 +12,8 @@ public class ModEntities { public static void init() { int id = 1; - EntityRegistry.registerModEntity( - new ResourceLocation("thrown_card"), - EntityCard.class, - Reference.MOD_ID + ":thrown_card", - id++, - Eureka.instance, - 64, - 1, - true - ); - EntityRegistry.registerModEntity(new ResourceLocation("suspended_ice"), EntitySuspendedIce.class, Reference.MOD_ID + ":suspended_ice", id++, Eureka.instance, 64, 1, true); + EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "thrown_card"), EntityCard.class, Reference.MOD_ID + ":thrown_card", id++, Eureka.instance, 64, 1, true); + EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "suspended_ice"), EntitySuspendedIce.class, Reference.MOD_ID + ":suspended_ice", id++, Eureka.instance, 64, 1, true); } @SideOnly(Side.CLIENT) From fd412f667af62cac9c6c7d9b5c7786b711f4a2b6 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:16:25 -0400 Subject: [PATCH 50/87] Suspended ice will default to snow if it forgets --- .../entity/EntitySuspendedIce.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java index ef3a00d..6813a8a 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntitySuspendedIce.java @@ -34,14 +34,18 @@ public void onUpdate() { @Override public void writeSpawnData(ByteBuf buffer) { int state = 0; - if (this.fallTile.equals(Blocks.ICE.getDefaultState())) { - buffer.writeInt(state); - return; - } else if (this.fallTile.equals(Blocks.FROSTED_ICE.getDefaultState())) { - state = 1; - } else if (this.fallTile.equals(Blocks.PACKED_ICE)) { - state = 2; - } else if (this.fallTile.equals(Blocks.SNOW.getDefaultState())) { + try { + if (this.fallTile.equals(Blocks.ICE.getDefaultState())) { + buffer.writeInt(state); + return; + } else if (this.fallTile.equals(Blocks.FROSTED_ICE.getDefaultState())) { + state = 1; + } else if (this.fallTile.equals(Blocks.PACKED_ICE)) { + state = 2; + } else if (this.fallTile.equals(Blocks.SNOW.getDefaultState())) { + state = 3; + } + } catch (NullPointerException e) { state = 3; } buffer.writeInt(state); From 9bad3b1d7f97da354baef248a856ab3767721832 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:16:46 -0400 Subject: [PATCH 51/87] Add throwing cards and Time's Eye to loot tables --- .../vigilant_eureka/core/EventHandler.java | 30 ++++++++++++++ .../loot_tables/inject/simple_dungeon.json | 40 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 src/main/resources/assets/vigilant_eureka/loot_tables/inject/simple_dungeon.json diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index e3caa8d..7034089 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -17,9 +17,16 @@ import net.minecraft.nbt.NBTUtil; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; +import net.minecraft.world.storage.loot.LootEntry; +import net.minecraft.world.storage.loot.LootEntryTable; +import net.minecraft.world.storage.loot.LootPool; +import net.minecraft.world.storage.loot.RandomValueRange; +import net.minecraft.world.storage.loot.conditions.LootCondition; +import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.entity.EntityMountEvent; import net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent; import net.minecraftforge.event.entity.living.LivingEvent; @@ -155,6 +162,29 @@ public void useItem(PlayerInteractEvent event) { } } + // loot tables + @SubscribeEvent + public void lootLoad(LootTableLoadEvent evt) { + String prefix = "minecraft:chests/"; + String name = evt.getName().toString(); + + if (name.startsWith(prefix)) { + String file = name.substring(name.indexOf(prefix) + prefix.length()); + if (file.equals("stronghold_library") || file.equals("simple_dungeon")) { + System.out.println("Injecting..."); + evt.getTable().addPool(getInjectPool("simple_dungeon")); + } + } + } + + private LootPool getInjectPool(String entryName) { + return new LootPool(new LootEntry[]{getInjectEntry(entryName, 1)}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "eureka_inject_pool"); + } + + private LootEntryTable getInjectEntry(String name, int weight) { + return new LootEntryTable(new ResourceLocation(Reference.MOD_ID, "inject/" + name), weight, 0, new LootCondition[0], "eureka_inject_entry"); + } + private static void removeLeyNBT(EntityLivingBase e) { e.getEntityData().removeTag("timeSince"); e.getEntityData().removeTag("inPoly"); diff --git a/src/main/resources/assets/vigilant_eureka/loot_tables/inject/simple_dungeon.json b/src/main/resources/assets/vigilant_eureka/loot_tables/inject/simple_dungeon.json new file mode 100644 index 0000000..e025865 --- /dev/null +++ b/src/main/resources/assets/vigilant_eureka/loot_tables/inject/simple_dungeon.json @@ -0,0 +1,40 @@ +{ + "__comment": "This table is injected as its own pool into minecraft:chests/simple_dungeon", + "pools": [ + { + "name": "main", + "rolls": 1, + "entries": [ + { + "type": "item", + "name": "vigilant_eureka:time", + "weight": 2, + "functions": [ + { + "function": "set_count", + "count": { + "min": 0, + "max": 1 + } + } + ] + }, + { + "type": "item", + "name": "vigilant_eureka:throwing_card", + "weight": 5, + "quality": 2, + "functions": [ + { + "function": "set_count", + "count": { + "min": 1, + "max": 10 + } + } + ] + } + ] + } + ] +} \ No newline at end of file From 31a023bf8caac075e9e80427fcbaa8dd0604fb8c Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 15 May 2018 16:16:58 -0400 Subject: [PATCH 52/87] Texture rename --- .../textures/items/time_open_rend.png | Bin 0 -> 536 bytes .../vigilant_eureka/textures/items/time_rend.png | Bin 0 -> 1804 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/vigilant_eureka/textures/items/time_open_rend.png create mode 100644 src/main/resources/assets/vigilant_eureka/textures/items/time_rend.png diff --git a/src/main/resources/assets/vigilant_eureka/textures/items/time_open_rend.png b/src/main/resources/assets/vigilant_eureka/textures/items/time_open_rend.png new file mode 100644 index 0000000000000000000000000000000000000000..c853fc7fa2ba2fbd2d390144e861339ccab42375 GIT binary patch literal 536 zcmV+z0_XjSP)qE`R_03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00DeSL_t(I%gvHMOC&)M z#eaPmIg74r*x^NY4ay}wtP`0m^l^t=D42|~D1L)YE*ilNjWjtfaX}1JxZ6k=hn+zE z5(6f}2D5P)$Ta(B77TsRP+isa>b;_20wO|et;E(ci`ZIXYeht+@}GDIoO3?j3&X_( zvqk3|&N+-R3kho#oDGM>*3#*8u-5W&cgNXq=z8Fkdd%*vcu2!uP02Utt&`B1G-~1g0d_D_&3;OH(nL@7yxj)oy(uUM#0!ys;wT5F?cy56J0000 zaB^>EX>4U6ba`-PAZ2)IW&i+q+T~VTw(BMg{bv*%0+Im1aColO8FcvFVC*=_$vx+` z{i~fA5JKA02HB?n_2)2u;9_>pIIl6J5G*d2T;hyQw8xd#ldN0MJ+NozNp7wQhDgxL zF^pl$JLC*~-txNbWXS!^Q0jZ4JWu3ph~su}dfbkL4hMD{HhCKo-k#ktE=O24q^S20 z>ee57ex(6_GapWrgAb$*Psdg@B=jR&r^s8IKt-4T%hBuDoT>~=+=ayAxeyBAOO%Y( z<4NMC4%#WPczPIHNWm5xivguGufM*2h1{IbH|0;1UOoCCzcFoALeB|#VJKYfmvZtC zxw%uic)NKH;qv?>_i-lVcAc!v{}?Tf(U0h|3kW&vpw3WM4|-*0Ypn{n6@PEzO!mAJ z?ua8%L1)7zE4V8qV$e9qQKL+Q`f4jxKy=($(K1(1Sq+2{WF)SOZZ~fltdgXGe3pvs zAdvEfg_hg2+*OKj+$b9C9)dB#l7DrZpD2wn4-}D&SFV7I=gtO-$sCcf1T`>1V<*+G z1fTcoHF*^<=vSH}0?f8d3!uMvdTcIPL<+T$FNwrv0@0s;>(Bw)Y>5>J7wG8-jA zA|nXOfX+Bj1+c`Cr*Nj>l4mniYcX>;WWc? z#_9}(oC_BzuJ{s)mRM5Bl}(lEs;{AHjWyNWxJkn~ZlP(5Ew$XKV=HyneGgrG?5XF0 ztu|!1;YS!c;z(xXi?vPb+x;7?(PoVoQ&Ukd)*w|qP0%bSesTuJ*bxZV$pDFAo}Af8 z&hcb!a%L0bRCoqRKgnq{83Ti^6Z=6IcMs;gk?`N}Wsk6f+NUe5tQ9)l?X|_KtHOE>Y zU1F45RK)n^{=0S*^Mvm=;Ys7L^`Z&yi+?M|vo#-s{%rFGoRM|OpY5c4%b zK$)K~@)aRZ8O6`s5X*(`N$D2`uE=UI51mf=l+(9#J2?;#-hNWy$~=7C=dLIVy%Q&~ zziS%w@5tru>3NFFWyrm!+kDz#Ll1IF$7f@ax>GZNEn{-;hR&|*BQzAFs*Ri{4;4+U z885Fjv_U;SeAUgdwnEKnk*!OpNmOO28i#;sY`vPgPkY8$d=l)QeQBvDSxYP`?Xeg& z`_v{Bpbev|r><#fpxim?g$`em;=`Jr06IQv;%gZ9SrpATEM8A6HtpUK+U~5W?AkNB zFQeKC!*^H-`EP4b$%V3H|_7 zY;ccw!=ck9<B`CTr}WdUThSEDC`E3XeT_Le)sTWPK{bAf+7+`m@{ z(plIfm)Fu3&e9aN^Mp-bk={*xj}^>b7;7D7V@IYFgBET1Cmq{f&)U1nX9WKk(RWVFPrUu4{eKzKfsest z{s#Cq7G0s9v916B00v@9M??Vs0RI60puMM)00009a7bBm000XU000XU0RWnu7ytkO z2XskIMF-*q4*>u>(MCwK)*<45a80TW zU|ntt@lQyzkS1`&Uj0&p9qz{-q|6rv-n=*O`@Y}Dz!XG;*jkCL zWgfA$#MX+4%;Z=22RP?^d>V$!3FeE=Ih=DCW0n%uD!3eth^?j5>0qtp_i)JNXyoh0 z7@{buC-|P{>NE@mpePC^lS!pc-kqE%0IhYsf?ur`uP=Y)on5qKYyB%h5O8+U5&*M# z&Gv3iQ53#MP5TPN5D_72Kat-*vllx7xV^LL@F3^*&eCi)0qFPpq-o0Pw1ToM0eBp| z=VSav`ZqrTI6gvtTp0xuZ>iQoS(a$6Ns?q?u}PAkwf3jNjDkj^;r(szJSg}eRov}% z{q!u$NYiwYphB`=3MseEF={Sc9hiw(wTXe-L8~K@j*{wY2eg48UM8@Y5Fv u0HP?O-ERAPmSr>b>E>F3iey>C|A#+%EQOgoX)7B50000 Date: Wed, 16 May 2018 07:03:28 -0400 Subject: [PATCH 53/87] Add new inventory texture to Time --- .../vigilant_eureka/textures/items/time.png | Bin 536 -> 257 bytes .../textures/items/time_open.png | Bin 0 -> 5300 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/vigilant_eureka/textures/items/time_open.png diff --git a/src/main/resources/assets/vigilant_eureka/textures/items/time.png b/src/main/resources/assets/vigilant_eureka/textures/items/time.png index c853fc7fa2ba2fbd2d390144e861339ccab42375..97287297c1ef8ddaf8a533787bbf7783ed2181be 100644 GIT binary patch delta 204 zcmbQi(#SNywq8$}fk981v0|xx83O|Ydx@v7EBhl>ei2pi@+%jcfkKict`Q~9`MJ5N zc_j?aMX8A;sVNHOnI#zt?w-B@;f;LaKt-9JE{-7zlh delta 485 zcmVR5;7cl0Qo%K@i1% zeHb~5u58%hMRyI#B|WSYnJn~ihg>L_jIk(wgH0|P!3~WxIe#v3K@3#5+ejFPok0B( z117=-vvC>7H2Y^341Lg0UDfsKy`o_PB0_Af#MUy4*ji$1MMS3ZpLhqHb3Wb+!^H%% zMduvOIgBw232POc4Tr?m(&==t*79<9$Jub`>&6(OD5@to&vUgGh5}F&1>^C!QYY&> zI|@K+U9aG|)qmpY;Z5G*X-mGY91{cqho>z8Fkdd%*vcu2!uP02Utt&`B1G-~1g0d_D_&3;OH(nL@7yxj)oy(uUM#0!ys2!g=ps-=xaBLD`2fuBA{01!nH?RMMWvn-pcPd3*QR3wWU bJ|12H%C&}LS9orL00000NkvXXu0mjfmA=zo diff --git a/src/main/resources/assets/vigilant_eureka/textures/items/time_open.png b/src/main/resources/assets/vigilant_eureka/textures/items/time_open.png new file mode 100644 index 0000000000000000000000000000000000000000..d9327786ebdbf7018965b0fb7522439e814807ea GIT binary patch literal 5300 zcmeHKd0Z1`8csPxDG0Jw0kMVvivF5RGD*l`!W|$=00D)9*JNe_BS|JE6B5`}5s&pM zYrOzZSZ}}sD~ejYFBI>q-UlA7x>|L$YGLU&0U_?PcK!Xf|2g~;@_qBX&-;GQJnuI% zGm{cx-CccM84QNIGA=q9{P(0kUAutqelJ=O2E*}oerh_Ej98ckBdH;@IFrgV;7r^~ zXc!FZm4Bptz36VRThoJ{6PyD57d39)eMwZ(Xep@X=hRnJiQWj$t(m7dnp_rM0ynR? zd7x?kfxt6j_cH^YvcD`Id1p?-)+6)NR2Mhodpy3J7a+Ri6cw0#&pT$%y}rijp=93m zT=;H&R`5&tup0??bu$`s4f)rKrgnG9?GuvM$Lq%O>paepEmeuUYf!nqx%xqx_s{(A zj9x!fuDz8sc$@$0sS~kB4tFm0KRrxx;+L)3sHcbTr{ZJpZ~}Y1j0`S-hQS#M)!$`7 zUrzY8AOjC@&eUqd!T>c*JmH;?{#&&ZJtrSo_5GW=Hdt2}-Zt)B=z9C_?v#HNPq4clcy_9p6ztn z`_EkotlanhqaO~dvyY6{g zCSP`9Il+ZxZa;oi^m(@ba6O|w;ouZM?6bc#E(;&JaG?jUd!%Ri9rv?PVY%Cur74eB z++w{-8Zm5b#po$9s>OA$OOYEcVTtGc0&C0m{nb+)=f5QQjN+Tn>E7rp$#}1&wTtKe zZQz;(#_8wWj{A^V!FNa2#*J6ZhRP4l8?sSbk(yTX)^}Xh`um4fzRzpl^vck#zn9QA zbN#N3*MB*UCdxguHU0DuYThMQF%o5?~c-0|8br+)R+HQ-F%uG1B z*L$$TZ3GTimkh`XnP-xfE?Ii{;89n+;Jh+nWxcmIwJhCb)V1p+DN|Oy2>RZ~bKj=1 zC*vP3ANwSLTv2`T`Pg+YQ-73Do`YnKCn{Lm3W6pUzf7T@T=1p!&kMDP`{`JZo zulspyuRS{*2P!O3Y4P42ZgS((EB+fI{#lrj6UxoYBrERsIA6?s+ihOT1=+>EVGcRF zkw@JO<6oZen=|9wvyuvP+zGL7w-&F!e$t7TMRVeIt@3-|v@!I2^N2ycvc?6Z6d~xW zwey-})L=hdx^vE~JZl?!$pJ~1l(Xi@T#-W$H$ zUQ<+gVfBl0p-2B1X=ABts6e&bWUYQR^-1xqh5^BQh?|9Vug?4_PM`U>W=1G^B4FLA zEie1#gy~y+-$FjVwZfnmE*V@WM6GDq19~3mwAl#*h0@I~SMG2x2zPtLcMb>~U-bE- zxdN)^W2kEW-bGEv%wa)SBWsxl8fRQ&PD;;QkHY=^T%(d*CRD9`y;M86pk99P*UF0L z4sc`7r!J!7#SDf=6ajXYbXB|*C3PGGBh@&^sxyEp7z|mM)qtQmIK@=sS%hBBdb(>5 zi%DQ|R+>=7RT-l2Y$7h-h^OQyq@wvbs03q$g}TbDQb3@?DTHa&Y4s+lRnD^UO2Kb> z8e%bR5GqH`N>?Q@qevsp6mSF_E?Z$Ga$#1eD^q5~G}7egm^KP9lC!cY${>Xxi^amR z@HwP03*t#65{L^!Fw6!Bwkc0fAy&5D6hKq7azx`M)Ci;_NIjG0MAW32lCxOgJhP3Q z7FJ;elWhs;v5nqDVUQ9G1YkV?0Kr_Yn9YURumrM?2WM5P_GrDSO+}z5WJL@RkHdv@ zy7wYXlp?nyU#AhKRItHA$+(F$8&O=5i|eTX`=kb~*<_#7Y{Ka&Tiser1A(G!neAg@ zm8zun7+S_GLT9i=&}e%khPLAjW~0`I!B7a-;yO@>2{7~C!-M$tfKHcVBew}9jV4hu z&7zE!v*-e(7>N>?)b3;8@QkI&|Ys8O~+C=syLc!-EC;)^7hP^cCP__!UFQg5OV zJ&My*fSf}B9uWp>U=fP5QJg1c3s8ZWtro*-HXr2*BnTYB7sFyZibNv;tc_^xtD>ne zK&3&|5)6a+Y@P@>Od#R%*$597u{9d8n2$?vv4$_SQPILmBa)PI7R=#x%p_?MN<$iT za#lQ{H(NVSq!Kzjg+gf2ctSWtzzYcx3BVdbaUGx$xX}b$OLOwLZL}CFjRAxRFb|XZ#Y@2 zE8{>cY0R_BpMsBX9kp>EZq3lWA*SDT2}}%2_5P7sqUu0O;6y3e86JSvc4w+gjw^ zJkg0;B@zt`;{pMjFTvHotvGP229dBs1VXU@hC@UmNvkE=*-fN|vLHr0A`A2oxXz%1 zY}c6?Y%|%w_iM3aGqITS?ul? zpyt*&a32Df0v`qb z Date: Wed, 16 May 2018 07:04:21 -0400 Subject: [PATCH 54/87] Rotate appropriately for sneaking Might just do a downward translation as appropriate in the future to really make it hang there. --- .../itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java index f8765dd..6c611de 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java @@ -65,6 +65,7 @@ public BaubleType getBaubleType(ItemStack itemStack) { public void onPlayerBaubleRender(ItemStack itemStack, EntityPlayer entityPlayer, RenderType renderType, float v) { if (renderType.equals(RenderType.BODY)) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + Helper.rotateIfSneaking(entityPlayer); Helper.translateToChest(); Helper.defaultTransforms(); scale(1.25F); From af0387b2b55e1de7e858b8af19e7d21a2ad3556b Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 21 May 2018 19:57:38 -0400 Subject: [PATCH 55/87] Make blacklisting blocks from chunk rebuilding better --- .../vigilant_eureka/core/ChunkRebuilder.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java index 8593b0f..97bee87 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/ChunkRebuilder.java @@ -1,5 +1,6 @@ package me.itstheholyblack.vigilant_eureka.core; +import me.itstheholyblack.vigilant_eureka.util.ArrayUtil; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -13,6 +14,16 @@ import net.minecraft.world.gen.IChunkGenerator; public class ChunkRebuilder { + + private static final Block[] blacklist = new Block[]{ + Blocks.END_GATEWAY, + Blocks.END_PORTAL, + Blocks.END_PORTAL_FRAME, + Blocks.BEDROCK, + Blocks.BARRIER, + Blocks.COMMAND_BLOCK, Blocks.CHAIN_COMMAND_BLOCK, Blocks.REPEATING_COMMAND_BLOCK + }; + public static void rebuildChunk(World world, BlockPos pos, BlockPos stand) { // ngl i stole this from ICBM try { @@ -29,10 +40,10 @@ public static void rebuildChunk(World world, BlockPos pos, BlockPos stand) { IBlockState state = newChunk.getBlockState(x, y, z); Block oldBlock = oldChunk.getBlockState(x, y, z).getBlock(); BlockPos working = new BlockPos(x + oldChunk.x * 16, y, z + oldChunk.z * 16); - if (!oldBlock.equals(Blocks.END_PORTAL) && !oldBlock.equals(Blocks.END_PORTAL_FRAME) && !oldBlock.equals(Blocks.END_GATEWAY)) { + if (!ArrayUtil.contains(blacklist, oldBlock)) { world.setBlockState(working, state, 3); - if (!oldBlock.equals(Blocks.AIR) && world.canSeeSky(working)) { - ((WorldServer) world).spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, true, working.getX(), working.getY(), working.getZ(), 10, 0.5, 1, 0.5, 0.005D); + if (world.canSeeSky(working) && !oldBlock.equals(state.getBlock())) { + ((WorldServer) world).spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, true, working.getX(), working.getY(), working.getZ(), 10, 0.5, 1, 0.5, 0.05D); } } } @@ -40,9 +51,9 @@ public static void rebuildChunk(World world, BlockPos pos, BlockPos stand) { } oldChunk.setTerrainPopulated(false); oldChunk.populate(provider, generator); - System.out.println("Finished that up nice!"); oldChunk.markDirty(); oldChunk.resetRelightChecks(); + ((WorldServer) world).spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, true, stand.getX(), stand.getY(), stand.getZ(), 1000, 0.75, 1, 0.75, 0.05D); } catch (Exception e) { e.printStackTrace(); } From 9c1813c2799e10732fd23024f5f44afc1baf0233 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 22 May 2018 13:42:09 -0400 Subject: [PATCH 56/87] Broken groundwork --- .../entity/EntityPlayerBody.java | 58 +++++++++++++++++++ .../vigilant_eureka/entity/ModEntities.java | 3 + .../entity/render/RenderEntityPlayerBody.java | 35 +++++++++++ 3 files changed, 96 insertions(+) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java new file mode 100644 index 0000000..ca3a386 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java @@ -0,0 +1,58 @@ +package me.itstheholyblack.vigilant_eureka.entity; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.world.World; + +public class EntityPlayerBody extends EntityLiving { + + private static final DataParameter PLAYER_NAME = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.STRING); + private static final DataParameter SMALL_ARMS = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.BOOLEAN); + + public EntityPlayerBody(World worldIn) { + super(worldIn); + setSize(0.6F, 1.8F); + setHealth(20); + } + + @Override + public void entityInit() { + super.entityInit(); + dataManager.register(PLAYER_NAME, ""); + dataManager.register(SMALL_ARMS, false); + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); + compound.setString("playerName", dataManager.get(PLAYER_NAME)); + compound.setBoolean("smallArms", dataManager.get(SMALL_ARMS)); + } + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); + setPlayer(compound.getString("playerName")); + setSmallArms(compound.getBoolean("smallArms")); + } + + public String getPlayer() { + return dataManager.get(PLAYER_NAME); + } + + public void setPlayer(String player) { + dataManager.set(PLAYER_NAME, player); + } + + public boolean smallArms() { + return dataManager.get(SMALL_ARMS); + } + + public void setSmallArms(boolean smallArms) { + dataManager.set(SMALL_ARMS, smallArms); + } +} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java index 0f9e1ad..3a34579 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/ModEntities.java @@ -3,6 +3,7 @@ import me.itstheholyblack.vigilant_eureka.Eureka; import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.entity.render.RenderEntityCard; +import me.itstheholyblack.vigilant_eureka.entity.render.RenderEntityPlayerBody; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -14,10 +15,12 @@ public static void init() { int id = 1; EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "thrown_card"), EntityCard.class, Reference.MOD_ID + ":thrown_card", id++, Eureka.instance, 64, 1, true); EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "suspended_ice"), EntitySuspendedIce.class, Reference.MOD_ID + ":suspended_ice", id++, Eureka.instance, 64, 1, true); + EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "player_body"), EntityPlayerBody.class, Reference.MOD_ID + ":player_body", id++, Eureka.instance, 64, 1, true); } @SideOnly(Side.CLIENT) public static void initModels() { RenderingRegistry.registerEntityRenderingHandler(EntityCard.class, RenderEntityCard.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityPlayerBody.class, RenderEntityPlayerBody::new); } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java new file mode 100644 index 0000000..569baa8 --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java @@ -0,0 +1,35 @@ +package me.itstheholyblack.vigilant_eureka.entity.render; + +import me.itstheholyblack.vigilant_eureka.entity.EntityPlayerBody; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.entity.RenderBiped; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.util.ResourceLocation; + +import javax.annotation.Nonnull; + +public class RenderEntityPlayerBody extends RenderBiped { + public RenderEntityPlayerBody(RenderManager renderManagerIn) { + super(renderManagerIn, new ModelPlayer(0.0F, false), 0); + } + + @Override + public void doRender(@Nonnull EntityPlayerBody dopple, double x, double y, double z, float yaw, float partialTicks) { + this.mainModel = new ModelPlayer(0.0f, dopple.smallArms()); + super.doRender(dopple, x, y, z, yaw, partialTicks); + } + + @Nonnull + @Override + protected ResourceLocation getEntityTexture(@Nonnull EntityPlayerBody entity) { + Minecraft mc = Minecraft.getMinecraft(); + + if (!(mc.getRenderViewEntity() instanceof AbstractClientPlayer)) + return DefaultPlayerSkin.getDefaultSkinLegacy(); + + return ((AbstractClientPlayer) mc.getRenderViewEntity()).getLocationSkin(); + } +} From f83a3dd40ab7c702760875e3fa2ed8a5abf156ea Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 22 May 2018 13:43:51 -0400 Subject: [PATCH 57/87] Change the stick out again --- .../vigilant_eureka/items/DebugStick.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java index cb68bd5..c2e6094 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java @@ -1,7 +1,8 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; -import me.itstheholyblack.vigilant_eureka.core.ChunkRebuilder; +import me.itstheholyblack.vigilant_eureka.entity.EntityPlayerBody; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -11,7 +12,6 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -29,9 +29,11 @@ public void initModel() { @Override public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { - if (!worldIn.isRemote && worldIn instanceof WorldServer) { - ChunkRebuilder.rebuildChunk(worldIn, pos, playerIn.getPosition()); - } + EntityPlayerBody e = new EntityPlayerBody(worldIn); + e.setPosition(pos.getX(), pos.getY(), pos.getZ()); + e.setPlayer(playerIn.getGameProfile().getName()); + System.out.println(playerIn.getGameProfile().getName()); + worldIn.spawnEntity(e); return EnumActionResult.SUCCESS; } } From db6168c1af8329b48b63a2f1930a97778267f1b6 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:12:30 -0400 Subject: [PATCH 58/87] Move NBTUtil to util package --- .../vigilant_eureka/blocks/BlockLeyLine.java | 2 +- .../client/renderer/CustomBipedArmor.java | 1 + .../vigilant_eureka/core/NBTUtil.java | 15 ------------ .../vigilant_eureka/items/DimKey.java | 2 +- .../vigilant_eureka/items/ItemCard.java | 2 +- .../vigilant_eureka/items/ItemLeyKey.java | 3 ++- .../vigilant_eureka/items/ItemLeyRune.java | 2 +- .../items/baubles/ItemTime.java | 1 - .../network/PacketSendTime.java | 2 -- .../vigilant_eureka/util/NBTUtil.java | 24 +++++++++++++++++++ 10 files changed, 31 insertions(+), 23 deletions(-) delete mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/core/NBTUtil.java create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/util/NBTUtil.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java index 40a5888..4c8d192 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java @@ -3,9 +3,9 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.blocks.tiles.LeyLineTile; import me.itstheholyblack.vigilant_eureka.core.EnumLeyTypes; -import me.itstheholyblack.vigilant_eureka.core.NBTUtil; import me.itstheholyblack.vigilant_eureka.core.PolyHelper; import me.itstheholyblack.vigilant_eureka.items.ModItems; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java index 7a3aea8..459790f 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java @@ -1,6 +1,7 @@ package me.itstheholyblack.vigilant_eureka.client.renderer; import me.itstheholyblack.vigilant_eureka.items.ModItems; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/NBTUtil.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/NBTUtil.java deleted file mode 100644 index 833987c..0000000 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/NBTUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package me.itstheholyblack.vigilant_eureka.core; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class NBTUtil { - public static NBTTagCompound getTagCompoundSafe(ItemStack stack) { - NBTTagCompound tagCompound = stack.getTagCompound(); - if (tagCompound == null) { - tagCompound = new NBTTagCompound(); - stack.setTagCompound(tagCompound); - } - return tagCompound; - } -} diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java index 3cf9465..d07f9ec 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java @@ -4,7 +4,7 @@ import me.itstheholyblack.vigilant_eureka.blocks.ModBlocks; import me.itstheholyblack.vigilant_eureka.blocks.MovingCastleDoor; import me.itstheholyblack.vigilant_eureka.blocks.tiles.MovingCastleDoorTile; -import me.itstheholyblack.vigilant_eureka.core.NBTUtil; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import me.itstheholyblack.vigilant_eureka.util.RayTraceHelper; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelBakery; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java index 08158db..b8682a8 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -1,8 +1,8 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; -import me.itstheholyblack.vigilant_eureka.core.NBTUtil; import me.itstheholyblack.vigilant_eureka.entity.EntityCard; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java index b536acd..5b09cfc 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java @@ -1,6 +1,7 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; @@ -56,6 +57,6 @@ public void initModel() { @SideOnly(Side.CLIENT) public boolean hasEffect(ItemStack stack) { - return me.itstheholyblack.vigilant_eureka.core.NBTUtil.getTagCompoundSafe(stack).hasKey("tolink"); + return NBTUtil.getTagCompoundSafe(stack).hasKey("tolink"); } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyRune.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyRune.java index 8da72fc..84688a1 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyRune.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyRune.java @@ -2,7 +2,7 @@ import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.core.EnumLeyTypes; -import me.itstheholyblack.vigilant_eureka.core.NBTUtil; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java index 6c611de..1ff84de 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java @@ -10,7 +10,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java index e3c21cb..6c84717 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java @@ -8,9 +8,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.FMLCommonHandler; diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/util/NBTUtil.java b/src/main/java/me/itstheholyblack/vigilant_eureka/util/NBTUtil.java new file mode 100644 index 0000000..3989c9b --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/util/NBTUtil.java @@ -0,0 +1,24 @@ +package me.itstheholyblack.vigilant_eureka.util; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class NBTUtil { + public static NBTTagCompound getTagCompoundSafe(ItemStack stack) { + NBTTagCompound tagCompound = stack.getTagCompound(); + if (tagCompound == null) { + tagCompound = new NBTTagCompound(); + stack.setTagCompound(tagCompound); + } + return tagCompound; + } + + public static NBTTagCompound getPlayerPersist(EntityPlayer p) { + NBTTagCompound data = p.getEntityData(); + if (!data.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) { + data.setTag(EntityPlayer.PERSISTED_NBT_TAG, new NBTTagCompound()); + } + return data.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); + } +} From 6185466f857c2c40bfa29f7ac1add79eb5bf5066 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:13:41 -0400 Subject: [PATCH 59/87] Create EntityPlayerBody + renderer --- .../entity/EntityPlayerBody.java | 27 ++++++++++++++++- .../entity/render/RenderEntityPlayerBody.java | 29 ++++++++++++++----- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java index ca3a386..0855d89 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java @@ -1,13 +1,17 @@ package me.itstheholyblack.vigilant_eureka.entity; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.util.DamageSource; import net.minecraft.world.World; +import javax.annotation.Nonnull; + public class EntityPlayerBody extends EntityLiving { private static final DataParameter PLAYER_NAME = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.STRING); @@ -15,7 +19,7 @@ public class EntityPlayerBody extends EntityLiving { public EntityPlayerBody(World worldIn) { super(worldIn); - setSize(0.6F, 1.8F); + setSize(0.6F, 0.5F); setHealth(20); } @@ -40,11 +44,32 @@ public void readEntityFromNBT(NBTTagCompound compound) { setSmallArms(compound.getBoolean("smallArms")); } + @Override + public boolean attackEntityFrom(@Nonnull DamageSource source, float amount) { + EntityPlayer p = this.world.getPlayerEntityByName(this.getPlayer()); + return (p != null) ? super.attackEntityFrom(source, amount) && p.attackEntityFrom(source, amount) : super.attackEntityFrom(source, amount); + } + + @Override + public void onDeath(DamageSource cause) { + super.onDeath(cause); + EntityPlayer p = this.world.getPlayerEntityByName(this.getPlayer()); + if (p != null) { + NBTUtil.getPlayerPersist(p).setBoolean("metaphysical_high_ground", false); + p.setInvisible(false); + } + } + public String getPlayer() { return dataManager.get(PLAYER_NAME); } public void setPlayer(String player) { + if (player.endsWith("s")) { + this.setCustomNameTag(player + "' body"); + } else { + this.setCustomNameTag(player + "'s body"); + } dataManager.set(PLAYER_NAME, player); } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java index 569baa8..054c328 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java @@ -1,17 +1,22 @@ package me.itstheholyblack.vigilant_eureka.entity.render; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; import me.itstheholyblack.vigilant_eureka.entity.EntityPlayerBody; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; +import java.util.Map; public class RenderEntityPlayerBody extends RenderBiped { + private static final ResourceLocation TEXTURE_STEVE = new ResourceLocation("textures/entity/steve.png"); + private static final ResourceLocation TEXTURE_ALEX = new ResourceLocation("textures/entity/alex.png"); + public RenderEntityPlayerBody(RenderManager renderManagerIn) { super(renderManagerIn, new ModelPlayer(0.0F, false), 0); } @@ -22,14 +27,24 @@ public void doRender(@Nonnull EntityPlayerBody dopple, double x, double y, doubl super.doRender(dopple, x, y, z, yaw, partialTicks); } + @Override + protected void applyRotations(EntityPlayerBody entityLiving, float p_77043_2_, float rotationYaw, float partialTicks) { + GlStateManager.rotate(180.0F - rotationYaw, 0, 1, 0); + GlStateManager.translate(0, 0.24, 0); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + } + @Nonnull @Override protected ResourceLocation getEntityTexture(@Nonnull EntityPlayerBody entity) { - Minecraft mc = Minecraft.getMinecraft(); - - if (!(mc.getRenderViewEntity() instanceof AbstractClientPlayer)) - return DefaultPlayerSkin.getDefaultSkinLegacy(); + GameProfile profile = new GameProfile(null, entity.getPlayer()); + Minecraft minecraft = Minecraft.getMinecraft(); + Map map = minecraft.getSkinManager().loadSkinFromCache(profile); - return ((AbstractClientPlayer) mc.getRenderViewEntity()).getLocationSkin(); + if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) { + return minecraft.getSkinManager().loadSkin(map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN); + } else { + return entity.smallArms() ? TEXTURE_ALEX : TEXTURE_STEVE; + } } } From c51d2cf9ae857a88b6a34f048cdd60858a4a5f61 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:14:20 -0400 Subject: [PATCH 60/87] Create spawn packet this is so we can see if the EntityPlayerBody should have small arms --- .../network/PacketSpawnBody.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java new file mode 100644 index 0000000..a29f4ac --- /dev/null +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java @@ -0,0 +1,60 @@ +package me.itstheholyblack.vigilant_eureka.network; + +import io.netty.buffer.ByteBuf; +import me.itstheholyblack.vigilant_eureka.entity.EntityPlayerBody; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class PacketSpawnBody implements IMessage { + + boolean smallArms; + + @SideOnly(Side.CLIENT) + public PacketSpawnBody() { + smallArms = !(Minecraft.getMinecraft().player).getSkinType().equals("default"); + } + + @Override + public void fromBytes(ByteBuf buf) { + smallArms = buf.readBoolean(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeBoolean(smallArms); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(PacketSpawnBody message, MessageContext ctx) { + // Always use a construct like this to actually handle your message. This ensures that + // your 'handle' code is run on the main Minecraft thread. 'onMessage' itself + // is called on the networking thread so it is not safe to do a lot of things + // here. + FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(() -> handle(message, ctx)); + return null; + } + + private void handle(PacketSpawnBody message, MessageContext ctx) { + EntityPlayerMP playerEntity = ctx.getServerHandler().player; + World world = playerEntity.getEntityWorld(); + + EntityPlayerBody e = new EntityPlayerBody(world); + e.setPosition(playerEntity.posX, playerEntity.posY + 1, playerEntity.posZ); + e.rotationYaw = (float) (180.0F * world.rand.nextDouble()); + e.renderYawOffset = e.rotationYaw; + + e.setSmallArms(message.smallArms); + e.setPlayer(playerEntity.getName()); + + world.spawnEntity(e); + } + } +} From f5a863f7fb6faf5ca4cd710daa0598a4f43d187a Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:14:41 -0400 Subject: [PATCH 61/87] Localize, mother----er! --- src/main/resources/assets/vigilant_eureka/lang/en_us.lang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang index 473d8b5..3774633 100644 --- a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang +++ b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang @@ -33,4 +33,6 @@ message.ley_solve_good=The links pulse and strengthen. message.ley_solve_incomplete=The line isn't complete! message.enter_ley=Something feels different. -message.eye_already_open=The eye is stubbornly open - perhaps you must wait for it to close? \ No newline at end of file +message.eye_already_open=The eye is stubbornly open - perhaps you must wait for it to close? + +entity.vigilant_eureka:player_body.name=Someone's body \ No newline at end of file From 20fcb37cbc92a1b434075548b6a3a85a2428408f Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:14:54 -0400 Subject: [PATCH 62/87] Register new packet with handler --- .../itstheholyblack/vigilant_eureka/network/PacketHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java index 3ebfd4f..44d50b0 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketHandler.java @@ -22,9 +22,10 @@ public static void registerMessages(String channelName) { } public static void registerMessages() { - // Register messages which are sent from the client to the server here: INSTANCE.registerMessage(PacketSendWarp.Handler.class, PacketSendWarp.class, nextID(), Side.SERVER); INSTANCE.registerMessage(PacketSendTime.Handler.class, PacketSendTime.class, nextID(), Side.SERVER); + INSTANCE.registerMessage(PacketSpawnBody.Handler.class, PacketSpawnBody.class, nextID(), Side.SERVER); + INSTANCE.registerMessage(PacketEndericPoof.Handler.class, PacketEndericPoof.class, nextID(), Side.CLIENT); } } From fbbf7bd03c0ea1e34aedd2efd7171a02f6b710dc Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:15:18 -0400 Subject: [PATCH 63/87] Bind spawning to the debug stick for testing --- .../vigilant_eureka/items/DebugStick.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java index c2e6094..67f04a6 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DebugStick.java @@ -1,12 +1,14 @@ package me.itstheholyblack.vigilant_eureka.items; import me.itstheholyblack.vigilant_eureka.Reference; -import me.itstheholyblack.vigilant_eureka.entity.EntityPlayerBody; -import net.minecraft.client.Minecraft; +import me.itstheholyblack.vigilant_eureka.network.PacketHandler; +import me.itstheholyblack.vigilant_eureka.network.PacketSpawnBody; +import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -29,11 +31,15 @@ public void initModel() { @Override public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { - EntityPlayerBody e = new EntityPlayerBody(worldIn); - e.setPosition(pos.getX(), pos.getY(), pos.getZ()); - e.setPlayer(playerIn.getGameProfile().getName()); - System.out.println(playerIn.getGameProfile().getName()); - worldIn.spawnEntity(e); - return EnumActionResult.SUCCESS; + NBTTagCompound persist = NBTUtil.getPlayerPersist(playerIn); + if (!persist.getBoolean("metaphysical_high_ground")) { + persist.setBoolean("metaphysical_high_ground", true); + playerIn.setInvisible(true); + if (worldIn.isRemote) { + PacketHandler.INSTANCE.sendToServer(new PacketSpawnBody()); + } + return EnumActionResult.SUCCESS; + } + return EnumActionResult.FAIL; } } From 2a6685f00aac1ad27ed58790ccbce723d92335ab Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:15:47 -0400 Subject: [PATCH 64/87] Actually grant some sort of advantage for this --- .../client/renderer/CustomBipedArmor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java index 459790f..8392c5c 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java @@ -5,7 +5,10 @@ import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; /** * Class to conditionally render armor, allowing full invisibility. Code concept by Paul Fulham, modified by Edwan Vi into a working state. @@ -13,6 +16,7 @@ * @author Paul Fulham * @author Edwan Vi */ +@SideOnly(Side.CLIENT) public class CustomBipedArmor implements LayerRenderer { private LayerBipedArmor layer; @@ -23,7 +27,11 @@ public CustomBipedArmor(LayerBipedArmor l) { @Override public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float delta, float age, float yaw, float pitch, float scale) { - if (!entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem().equals(ModItems.invisCap)) { + boolean visible = !entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem().equals(ModItems.invisCap); + if (entity instanceof EntityPlayer) { + visible = visible && !NBTUtil.getPlayerPersist((EntityPlayer) entity).getBoolean("metaphysical_high_ground"); + } + if (visible) { layer.doRenderLayer(entity, limbSwing, limbSwingAmount, delta, age, yaw, pitch, scale); } } From 1989d087ad19837cef6b199637f6cfa2e69b61bb Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Wed, 23 May 2018 07:16:11 -0400 Subject: [PATCH 65/87] Format source on Icons --- .../java/me/itstheholyblack/vigilant_eureka/client/Icons.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java index 478c173..30357e1 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/Icons.java @@ -12,7 +12,8 @@ public class Icons { public TextureAtlasSprite time_open; public TextureAtlasSprite time_closed; - private Icons(){} + private Icons() { + } @SubscribeEvent public void onTextureStitch(TextureStitchEvent.Pre evt) { From 641480849f3e098942e2bd00d22201133d8440b2 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sun, 17 Jun 2018 19:08:00 -0400 Subject: [PATCH 66/87] Get player's UUID involved in body + some basic interactions --- .../entity/EntityPlayerBody.java | 84 +++++++++++++++---- .../entity/render/RenderEntityPlayerBody.java | 12 +-- .../network/PacketSpawnBody.java | 4 +- .../assets/vigilant_eureka/lang/en_us.lang | 2 + 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java index 0855d89..6c2efad 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java @@ -1,76 +1,124 @@ package me.itstheholyblack.vigilant_eureka.entity; +import com.google.common.base.Optional; +import me.itstheholyblack.vigilant_eureka.items.ModItems; import me.itstheholyblack.vigilant_eureka.util.NBTUtil; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumHand; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.UUID; public class EntityPlayerBody extends EntityLiving { - private static final DataParameter PLAYER_NAME = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.STRING); + private static final DataParameter PLAYER_USERNAME = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.STRING); + private static final DataParameter> PLAYER_UUID = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.OPTIONAL_UNIQUE_ID); private static final DataParameter SMALL_ARMS = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.BOOLEAN); public EntityPlayerBody(World worldIn) { super(worldIn); - setSize(0.6F, 0.5F); + setSize(1.8F, 0.5F); setHealth(20); } @Override public void entityInit() { super.entityInit(); - dataManager.register(PLAYER_NAME, ""); + dataManager.register(PLAYER_USERNAME, ""); dataManager.register(SMALL_ARMS, false); + dataManager.register(PLAYER_UUID, Optional.absent()); } @Override public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); - compound.setString("playerName", dataManager.get(PLAYER_NAME)); + compound.setString("playerName", dataManager.get(PLAYER_USERNAME)); + if (dataManager.get(PLAYER_UUID).isPresent()) { + compound.setUniqueId("playerId", dataManager.get(PLAYER_UUID).get()); + } compound.setBoolean("smallArms", dataManager.get(SMALL_ARMS)); } @Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); - setPlayer(compound.getString("playerName")); + setPlayerName(compound.getString("playerName")); setSmallArms(compound.getBoolean("smallArms")); + setPlayerId(compound.getUniqueId("playerId")); + } + + @Override + public void onLivingUpdate() { + super.onLivingUpdate(); + this.limbSwingAmount = 0.0F; + } + + @Override + public boolean processInteract(EntityPlayer player, EnumHand hand) { + if (player.getName().equals(this.getPlayerName())) { + if (!player.getHeldItem(hand).isEmpty() && player.getUniqueID().equals(this.getPlayerId())) { + player.sendStatusMessage(new TextComponentTranslation("message.body"), true); + } else if (player.getUniqueID().equals(this.getPlayerId())) { + this.attackEntityFrom(DamageSource.OUT_OF_WORLD, this.getHealth()); + } + } + return true; } @Override public boolean attackEntityFrom(@Nonnull DamageSource source, float amount) { - EntityPlayer p = this.world.getPlayerEntityByName(this.getPlayer()); - return (p != null) ? super.attackEntityFrom(source, amount) && p.attackEntityFrom(source, amount) : super.attackEntityFrom(source, amount); + EntityPlayer p = this.world.getPlayerEntityByName(this.getPlayerName()); + return (p != null && !source.equals(DamageSource.OUT_OF_WORLD)) ? super.attackEntityFrom(source, amount) && p.attackEntityFrom(source, amount) : super.attackEntityFrom(source, amount); } @Override - public void onDeath(DamageSource cause) { - super.onDeath(cause); - EntityPlayer p = this.world.getPlayerEntityByName(this.getPlayer()); + public void onDeath(@Nonnull DamageSource cause) { + EntityPlayer p = this.world.getPlayerEntityByUUID(this.getPlayerId()); if (p != null) { NBTUtil.getPlayerPersist(p).setBoolean("metaphysical_high_ground", false); - p.setInvisible(false); + if (!p.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem().equals(ModItems.invisCap)) { + p.setInvisible(false); + } + if (!cause.equals(DamageSource.OUT_OF_WORLD)) { + p.attackEntityFrom(cause, p.getHealth()); + } else { + System.out.println("The void calls me!"); + p.setPositionAndUpdate(this.posX, this.posY, this.posZ); + } } + super.onDeath(cause); + } + + @Nullable + public UUID getPlayerId() { + return dataManager.get(PLAYER_UUID).isPresent() ? dataManager.get(PLAYER_UUID).get() : null; + } + + public void setPlayerId(UUID id) { + dataManager.set(PLAYER_UUID, Optional.of(id)); } - public String getPlayer() { - return dataManager.get(PLAYER_NAME); + public String getPlayerName() { + return dataManager.get(PLAYER_USERNAME); } - public void setPlayer(String player) { - if (player.endsWith("s")) { - this.setCustomNameTag(player + "' body"); + public void setPlayerName(String name) { + if (name.endsWith("s")) { + this.setCustomNameTag(name + "' body"); } else { - this.setCustomNameTag(player + "'s body"); + this.setCustomNameTag(name + "'s body"); } - dataManager.set(PLAYER_NAME, player); + dataManager.set(PLAYER_USERNAME, name); } public boolean smallArms() { diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java index 054c328..060f793 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/render/RenderEntityPlayerBody.java @@ -8,14 +8,15 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; import java.util.Map; +import java.util.UUID; public class RenderEntityPlayerBody extends RenderBiped { - private static final ResourceLocation TEXTURE_STEVE = new ResourceLocation("textures/entity/steve.png"); - private static final ResourceLocation TEXTURE_ALEX = new ResourceLocation("textures/entity/alex.png"); public RenderEntityPlayerBody(RenderManager renderManagerIn) { super(renderManagerIn, new ModelPlayer(0.0F, false), 0); @@ -30,6 +31,7 @@ public void doRender(@Nonnull EntityPlayerBody dopple, double x, double y, doubl @Override protected void applyRotations(EntityPlayerBody entityLiving, float p_77043_2_, float rotationYaw, float partialTicks) { GlStateManager.rotate(180.0F - rotationYaw, 0, 1, 0); + GlStateManager.translate(0, 0, -1); GlStateManager.translate(0, 0.24, 0); GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); } @@ -37,14 +39,14 @@ protected void applyRotations(EntityPlayerBody entityLiving, float p_77043_2_, f @Nonnull @Override protected ResourceLocation getEntityTexture(@Nonnull EntityPlayerBody entity) { - GameProfile profile = new GameProfile(null, entity.getPlayer()); + GameProfile profile = new GameProfile(entity.getPlayerId(), entity.getPlayerName()); Minecraft minecraft = Minecraft.getMinecraft(); Map map = minecraft.getSkinManager().loadSkinFromCache(profile); - if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) { return minecraft.getSkinManager().loadSkin(map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN); } else { - return entity.smallArms() ? TEXTURE_ALEX : TEXTURE_STEVE; + UUID uuid = EntityPlayer.getUUID(profile); + return DefaultPlayerSkin.getDefaultSkin(uuid); } } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java index a29f4ac..d8c5cb9 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSpawnBody.java @@ -3,6 +3,7 @@ import io.netty.buffer.ByteBuf; import me.itstheholyblack.vigilant_eureka.entity.EntityPlayerBody; import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -52,7 +53,8 @@ private void handle(PacketSpawnBody message, MessageContext ctx) { e.renderYawOffset = e.rotationYaw; e.setSmallArms(message.smallArms); - e.setPlayer(playerEntity.getName()); + e.setPlayerName(playerEntity.getName()); + e.setPlayerId(EntityPlayer.getUUID(playerEntity.getGameProfile())); world.spawnEntity(e); } diff --git a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang index 3774633..b8a9625 100644 --- a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang +++ b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang @@ -35,4 +35,6 @@ message.enter_ley=Something feels different. message.eye_already_open=The eye is stubbornly open - perhaps you must wait for it to close? +message.body=Is that me? + entity.vigilant_eureka:player_body.name=Someone's body \ No newline at end of file From 81083a2414c12b456cf4aff09bc81538f0af761a Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sun, 17 Jun 2018 19:08:29 -0400 Subject: [PATCH 67/87] Update forge + mappings --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 0be56b7..d8581e6 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ compileJava { } minecraft { - version = "1.12.2-14.23.3.2655" + version = "1.12.2-14.23.4.2705" runDir = "run" // the mappings can be changed at any time, and must be in the following format. @@ -29,7 +29,7 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "snapshot_20180424" + mappings = "snapshot_20180616" makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. if (project.hasProperty('mc_username')) { clientRunArgs += ['--username', project.mc_username] From cdd5fa057597a07e022e03c28a8ee71b92bd7ce5 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sun, 17 Jun 2018 19:19:04 -0400 Subject: [PATCH 68/87] Lower launch level on minecarts --- .../me/itstheholyblack/vigilant_eureka/core/EventHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index 7034089..0b123e7 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -155,7 +155,7 @@ public void useItem(PlayerInteractEvent event) { event.getItemStack().shrink(1); } Vec3d v = player.getLookVec(); - player.getRidingEntity().addVelocity(v.x * 500, v.y * 500, v.z * 500); + player.getRidingEntity().addVelocity(v.x * 500, v.y * 5, v.z * 500); event.setCancellationResult(EnumActionResult.SUCCESS); event.setCanceled(true); } From 77e72a40092511a61df21f92da8fbf449567ab8b Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Sun, 17 Jun 2018 19:19:23 -0400 Subject: [PATCH 69/87] Dumb fix for accidentally becoming visible with cap --- .../vigilant_eureka/items/armor/InvisCap.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/InvisCap.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/InvisCap.java index d87a36b..76fe01e 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/InvisCap.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/armor/InvisCap.java @@ -5,6 +5,7 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -33,4 +34,9 @@ public void initModel() { public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { tooltip.add(I18n.format("mouseovertext.invis_cap")); } + + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { + player.setInvisible(true); + } } From b8d9e3387bb76532d374dc6d7b2416b101f3c119 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 18 Jun 2018 19:42:58 -0400 Subject: [PATCH 70/87] Sync potions between body and player --- .../entity/EntityPlayerBody.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java index 6c2efad..ff4f149 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java @@ -10,13 +10,19 @@ import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.potion.PotionEffect; +import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.Collection; import java.util.UUID; public class EntityPlayerBody extends EntityLiving { @@ -24,6 +30,7 @@ public class EntityPlayerBody extends EntityLiving { private static final DataParameter PLAYER_USERNAME = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.STRING); private static final DataParameter> PLAYER_UUID = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.OPTIONAL_UNIQUE_ID); private static final DataParameter SMALL_ARMS = EntityDataManager.createKey(EntityPlayerBody.class, DataSerializers.BOOLEAN); + private static final ITextComponent INTERACT_MESSAGE = new TextComponentTranslation("message.body").setStyle(new Style().setColor(TextFormatting.GOLD)); public EntityPlayerBody(World worldIn) { super(worldIn); @@ -61,13 +68,37 @@ public void readEntityFromNBT(NBTTagCompound compound) { public void onLivingUpdate() { super.onLivingUpdate(); this.limbSwingAmount = 0.0F; + EntityPlayer p = this.world.getPlayerEntityByUUID(this.getPlayerId()); + if (p != null && !world.isRemote) { + // i'm messing with the scoreboard and there's nothing you can do to stop me + if (!this.isOnSameTeam(p)) { + if (this.getTeam() != null) { + world.getScoreboard().removePlayerFromTeam(this.getCachedUniqueIdString(), (ScorePlayerTeam) this.getTeam()); + } + world.getScoreboard().addPlayerToTeam(this.getCachedUniqueIdString(), p.getTeam().getName()); + } + // "sync" potions + Collection playerEffects = p.getActivePotionEffects(); + Collection bodyEffects = this.getActivePotionEffects(); + for (PotionEffect effect : bodyEffects) { + if (!playerEffects.contains(effect)) { + this.removeActivePotionEffect(effect.getPotion()); + this.markPotionsDirty(); + } + } + for (PotionEffect effect : playerEffects) { + if (!this.isPotionActive(effect.getPotion())) { + this.addPotionEffect(effect); + } + } + } } @Override public boolean processInteract(EntityPlayer player, EnumHand hand) { if (player.getName().equals(this.getPlayerName())) { if (!player.getHeldItem(hand).isEmpty() && player.getUniqueID().equals(this.getPlayerId())) { - player.sendStatusMessage(new TextComponentTranslation("message.body"), true); + player.sendStatusMessage(INTERACT_MESSAGE, true); } else if (player.getUniqueID().equals(this.getPlayerId())) { this.attackEntityFrom(DamageSource.OUT_OF_WORLD, this.getHealth()); } From 156f1ba6bd81a0cd3e2ffff43a955635098b73ca Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 18 Jun 2018 19:43:12 -0400 Subject: [PATCH 71/87] Remove print that shouldn't have been comitted --- .../itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java index ff4f149..015cb6b 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java @@ -123,7 +123,6 @@ public void onDeath(@Nonnull DamageSource cause) { if (!cause.equals(DamageSource.OUT_OF_WORLD)) { p.attackEntityFrom(cause, p.getHealth()); } else { - System.out.println("The void calls me!"); p.setPositionAndUpdate(this.posX, this.posY, this.posZ); } } From 33772a311ea826de892e74125726844750bc6553 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 18 Jun 2018 19:43:35 -0400 Subject: [PATCH 72/87] Remove last(?) getPlayerEntityByName --- .../vigilant_eureka/entity/EntityPlayerBody.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java index 015cb6b..b488635 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/entity/EntityPlayerBody.java @@ -108,7 +108,7 @@ public boolean processInteract(EntityPlayer player, EnumHand hand) { @Override public boolean attackEntityFrom(@Nonnull DamageSource source, float amount) { - EntityPlayer p = this.world.getPlayerEntityByName(this.getPlayerName()); + EntityPlayer p = this.world.getPlayerEntityByUUID(this.getPlayerId()); return (p != null && !source.equals(DamageSource.OUT_OF_WORLD)) ? super.attackEntityFrom(source, amount) && p.attackEntityFrom(source, amount) : super.attackEntityFrom(source, amount); } From d34320dee0525866bc0916b613d44ae8759ad921 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 18 Jun 2018 19:45:03 -0400 Subject: [PATCH 73/87] Use events for invisibility for ghosty players --- .../vigilant_eureka/core/EventHandler.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index 0b123e7..94143a8 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -105,18 +105,21 @@ public void livingTick(LivingEvent.LivingUpdateEvent event) { } } } + + if (e instanceof EntityPlayer) { + NBTTagCompound playerData = me.itstheholyblack.vigilant_eureka.util.NBTUtil.getPlayerPersist((EntityPlayer) e); + if (playerData.getBoolean("metaphysical_high_ground")) { + e.setInvisible(true); // simply doing e.setInvisible(playerData.getBoolean("metaphysical_high_ground")) causes invis pots to fail + } + } } @SubscribeEvent public void armorChanged(LivingEquipmentChangeEvent event) { ItemStack oldStack = event.getFrom(); - ItemStack newStack = event.getTo(); EntityEquipmentSlot slot = event.getSlot(); if (slot.equals(EntityEquipmentSlot.HEAD)) { - if (newStack.getItem().equals(ModItems.invisCap)) { - // switch to the invis cap - event.getEntityLiving().setInvisible(true); - } else if (oldStack.getItem().equals(ModItems.invisCap)) { + if (oldStack.getItem().equals(ModItems.invisCap)) { // switch off cap event.getEntityLiving().setInvisible(false); } From 9c74788a4effba828432d0401138428672ad7f72 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Mon, 18 Jun 2018 19:45:38 -0400 Subject: [PATCH 74/87] While I was in here I cleaned out the trash --- .../blocks/BlockTileEntity.java | 6 ++++ .../vigilant_eureka/core/EventHandler.java | 33 ++++++------------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockTileEntity.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockTileEntity.java index 466594d..a535af2 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockTileEntity.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockTileEntity.java @@ -17,8 +17,14 @@ public BlockTileEntity(Material material, String name) { super(material); } + /** + * Returns the {@link Class} of this block's tile entity + */ public abstract Class getTileEntityClass(); + /** + * Returns the {@link TE} instance for this specific block + */ public TE getTileEntity(IBlockAccess world, BlockPos pos) { return (TE) world.getTileEntity(pos); } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index 94143a8..9d81cba 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -42,40 +42,27 @@ public class EventHandler { @SubscribeEvent public void livingTick(LivingEvent.LivingUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); - if (e.isElytraFlying()) { // OH YES + if (e.isElytraFlying()) { BlockPos pos = e.getPosition(); World worldIn = e.getEntityWorld(); - int i = 0; - while (i <= 9) { - BlockPos scanpos = pos.down(i); - Block scanned = worldIn.getBlockState(scanpos).getBlock(); + for (int i = 0; i < 10; i++) { + Block scanned = worldIn.getBlockState(pos.down(i)).getBlock(); if (scanned.equals(Blocks.FIRE) || scanned.equals(Blocks.LAVA) || scanned.equals(Blocks.FLOWING_LAVA)) { // boost player, using code stolen from Mojang Vec3d vec3d = e.getLookVec(); - double d0 = 1.5D; - double d1 = 0.1D; - e.motionX += vec3d.x * d1 + (vec3d.x * d0 - e.motionX) * 0.2D; - e.motionZ += vec3d.z * d1 + (vec3d.z * d0 - e.motionZ) * 0.2D; - double up_boost; - if (i > 0) { - // A graph of this function is available at https://www.desmos.com/calculator/ss7gkav3cb - // where i is the x axis. - up_boost = -0.07 * i + 0.6; - } else { - up_boost = 0.07; - } - if (up_boost > 0) { - e.addVelocity(0, up_boost, 0); - } + e.motionX += vec3d.x * 0.1 + (vec3d.x * 1.5 - e.motionX) * 0.2D; + e.motionZ += vec3d.z * 0.1 + (vec3d.z * 1.5 - e.motionZ) * 0.2D; + // A graph of this function is available at https://www.desmos.com/calculator/ss7gkav3cb + // where i is the x axis. + e.addVelocity(0, i > 0 ? -0.07 * i + 0.6 : 0.07, 0); break; } else if (!scanned.equals(Blocks.AIR)) { break; } - i++; } } - if (e.getEntityData().getBoolean("inPoly")) { - NBTTagCompound entityData = e.getEntityData(); + NBTTagCompound entityData = e.getEntityData(); + if (entityData.getBoolean("inPoly")) { BlockPos pos = NBTUtil.getPosFromTag(entityData.getCompoundTag("masterPos")); // test if entity still in polygon TileEntity tile = e.getEntityWorld().getTileEntity(pos); From 6337fa387a4e9e023b171d00d7629ce22a6f2bc0 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 08:02:39 -0400 Subject: [PATCH 75/87] Fix calling a client method on server in ItemCard How did this happen? We're smarter than this! --- .../java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java index b8682a8..8d08439 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemCard.java @@ -71,7 +71,7 @@ public ActionResult onItemRightClick(World worldIn, EntityPlayer play EntityCard c = new EntityCard(worldIn, playerIn, playerIn.getLook(1).x, playerIn.getLook(1).y, playerIn.getLook(1).z); c.setType(EntityCard.TYPES.BLAND); c.posY += playerIn.getEyeHeight(); - c.setPositionAndRotationDirect(c.posX, c.posY, c.posZ, playerIn.cameraYaw, playerIn.cameraPitch, 0, false); + c.setPositionAndRotation(c.posX, c.posY, c.posZ, playerIn.cameraYaw, playerIn.cameraPitch); worldIn.spawnEntity(c); ItemStack other; From dc936476460d30751fa8910a08ddc16885cb32da Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 08:04:21 -0400 Subject: [PATCH 76/87] Let player scrub NBT from Bismuth --- .../vigilant_eureka/items/ItemLeyKey.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java index 5b09cfc..9466e38 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java @@ -5,9 +5,13 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; @@ -24,6 +28,14 @@ public ItemLeyKey() { setCreativeTab(ModItems.CREATIVE_TAB); } + public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { + ItemStack stack = playerIn.getHeldItem(handIn); + if (playerIn.isSneaking()) { + NBTUtil.getTagCompoundSafe(stack).removeTag("tolink"); + } + return new ActionResult<>(EnumActionResult.SUCCESS, stack); + } + @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { From 273b67a70303f5ba05d059f2ecb6e6b6fc562932 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 08:04:46 -0400 Subject: [PATCH 77/87] Fix the part where the log screamed at you for tile entities existing Sorry about that --- .../vigilant_eureka/Reference.java | 6 ++- .../vigilant_eureka/proxy/CommonProxy.java | 48 ++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java b/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java index 24caf57..c16843a 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/Reference.java @@ -1,9 +1,13 @@ package me.itstheholyblack.vigilant_eureka; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + public class Reference { static final String MOD_NAME = "Vigilant Eureka"; public static final String MOD_ID = "vigilant_eureka"; static final String VERSION = "0.0.4"; - public static final String MOD_KEY = "19d2daed26722f2762d067603604a6d1f909f262"; + static final String MOD_KEY = "19d2daed26722f2762d067603604a6d1f909f262"; static final String DEPENDS = "required-after:baubles@[1.5.2,)"; + public static final Logger LOGGER = LogManager.getLogger(MOD_ID); } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java index 94a584d..727d404 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java @@ -1,5 +1,6 @@ package me.itstheholyblack.vigilant_eureka.proxy; +import com.google.common.collect.ImmutableMap; import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.blocks.*; import me.itstheholyblack.vigilant_eureka.blocks.tiles.LeyLineTile; @@ -19,8 +20,14 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.datafix.FixTypes; +import net.minecraft.util.datafix.IFixableData; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ModFixs; import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -30,6 +37,9 @@ import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; +import javax.annotation.Nonnull; +import java.util.Map; + @Mod.EventBusSubscriber(modid = Reference.MOD_ID) public class CommonProxy { @@ -39,6 +49,7 @@ public void preInit(FMLPreInitializationEvent e) { FMLLog.log.info("Registering Vigilant Eureka networking."); PacketHandler.registerMessages(Reference.MOD_ID); ModEntities.init(); + registerTiles(); } public void init(FMLInitializationEvent e) { @@ -46,6 +57,9 @@ public void init(FMLInitializationEvent e) { GameRegistry.registerWorldGenerator(worldGenBismuth, 100); GameRegistry.registerWorldGenerator(new WorldGenLey(), 100); GameRegistry.addSmelting(ModItems.bismite, new ItemStack(ModItems.leyKey), 0.7F); + // fix the tiles + ModFixs fixes = FMLCommonHandler.instance().getDataFixer().init(Reference.MOD_ID, 1); + fixes.registerFix(FixTypes.BLOCK_ENTITY, new TileEntitySpaceFixer()); } public void postInit(FMLPostInitializationEvent e) { @@ -58,8 +72,11 @@ public static void registerBlocks(RegistryEvent.Register event) { event.getRegistry().register(new MovingCastleDoor()); event.getRegistry().register(new BlockBismuthOre()); event.getRegistry().register(new BlockLeyLine()); - GameRegistry.registerTileEntity(MovingCastleDoorTile.class, Reference.MOD_ID + ":castledoor"); - GameRegistry.registerTileEntity(LeyLineTile.class, Reference.MOD_KEY + "leytile"); + } + + private static void registerTiles() { + GameRegistry.registerTileEntity(MovingCastleDoorTile.class, new ResourceLocation(Reference.MOD_ID, "castledoor")); + GameRegistry.registerTileEntity(LeyLineTile.class, new ResourceLocation(Reference.MOD_ID, "leytile")); } @SubscribeEvent @@ -81,4 +98,31 @@ public static void registerItems(RegistryEvent.Register event) { event.getRegistry().register(new ItemCard()); Items.FIREWORKS.setCreativeTab(CreativeTabs.MISC); // please and thank you } + + private static class TileEntitySpaceFixer implements IFixableData { + private final Map tileEntityNames; + { + ImmutableMap.Builder nameMap = ImmutableMap.builder(); + nameMap.put("minecraft:19d2daed26722f2762d067603604a6d1f909f262leytile", "vigilant_eureka:leytile"); + nameMap.put("19d2daed26722f2762d067603604a6d1f909f262leytile", "vigilant_eureka:leytile"); + nameMap.put("minecraft:leytile", "vigilant_eureka:leytile"); + nameMap.put("leytile", "vigilant_eureka:leytile"); + tileEntityNames = nameMap.build(); + } + + @Override + public int getFixVersion() { + return 1; + } + + @Nonnull + @Override + public NBTTagCompound fixTagCompound(@Nonnull NBTTagCompound compound) { + String tileEntityLocation = compound.getString("id"); + + compound.setString("id", tileEntityNames.getOrDefault(tileEntityLocation, tileEntityLocation)); + + return compound; + } + } } From 7b279d46d3869edc81e7016bbee3a31384ecd950 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 08:29:08 -0400 Subject: [PATCH 78/87] Clean up addInformation on ley keys --- .../vigilant_eureka/items/ItemLeyKey.java | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java index 9466e38..ceca95d 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/ItemLeyKey.java @@ -39,26 +39,20 @@ public ActionResult onItemRightClick(World worldIn, EntityPlayer play @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { - NBTTagCompound compound = stack.getTagCompound(); - if (compound != null) { - BlockPos p = net.minecraft.nbt.NBTUtil.getPosFromTag(compound.getCompoundTag("tolink")); - int x; - int y; - int z; - x = p.getX(); - y = p.getY(); - z = p.getZ(); - // (0, 0, 0) isn't reachable without breaking bedrock - if (y == 0) { - tooltip.add(I18n.format("mouseovertext.ley_key")); - } else { - String fulltip = I18n.format("mouseovertext.ley_key") + "\nX: " + Integer.toString(x) + "\nY: " - + Integer.toString(y) + "\nZ: " + Integer.toString(z); - tooltip.add(fulltip); - } - } else { + NBTTagCompound compound = NBTUtil.getTagCompoundSafe(stack); + BlockPos p = net.minecraft.nbt.NBTUtil.getPosFromTag(compound.getCompoundTag("tolink")); + int x = p.getX(); + int y = p.getY(); + int z = p.getZ(); + // (0, 0, 0) isn't reachable without breaking bedrock + if (y == 0) { tooltip.add(I18n.format("mouseovertext.ley_key")); + } else { + String fulltip = I18n.format("mouseovertext.ley_key") + "\nX: " + Integer.toString(x) + "\nY: " + + Integer.toString(y) + "\nZ: " + Integer.toString(z); + tooltip.add(fulltip); } + super.addInformation(stack, worldIn, tooltip, flagIn); } From 588ab80d22219020a670a9f1fc2fd965b4d6e4e1 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 08:29:45 -0400 Subject: [PATCH 79/87] Formatting --- .../me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java index 727d404..3266ee6 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java @@ -101,6 +101,7 @@ public static void registerItems(RegistryEvent.Register event) { private static class TileEntitySpaceFixer implements IFixableData { private final Map tileEntityNames; + { ImmutableMap.Builder nameMap = ImmutableMap.builder(); nameMap.put("minecraft:19d2daed26722f2762d067603604a6d1f909f262leytile", "vigilant_eureka:leytile"); From 05042adc6c4622029d2ec7506bbe0383cdb0d4af Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 09:00:33 -0400 Subject: [PATCH 80/87] Boil ten lines down to four --- .../vigilant_eureka/items/DimKey.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java index d07f9ec..048322b 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java @@ -73,7 +73,6 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos System.out.println(worldIn.getBlockState(pos).getBlock()); if (worldIn.getBlockState(pos).getBlock().equals(ModBlocks.movingdoor)) { - System.out.println("clicked on door"); MovingCastleDoorTile t; if (worldIn.getBlockState(pos).getValue(MovingCastleDoor.IS_TOP)) { t = (MovingCastleDoorTile) worldIn.getTileEntity(pos); @@ -91,16 +90,10 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos return EnumActionResult.FAIL; } } - - System.out.println("Did not click door, was " + worldIn.getBlockState(pos).getBlock() + " instead."); - int x = playerIn.getPosition().getX(); - int y = playerIn.getPosition().getY(); - int z = playerIn.getPosition().getZ(); - int dim = playerIn.dimension; - tag.setInteger("x", x); - tag.setInteger("y", y); - tag.setInteger("z", z); - tag.setInteger("dim", dim); + tag.setInteger("x", playerIn.getPosition().getX()); + tag.setInteger("y", playerIn.getPosition().getY()); + tag.setInteger("z", playerIn.getPosition().getZ()); + tag.setInteger("dim", playerIn.dimension); return EnumActionResult.SUCCESS; } From 5a522317a87cd84dd40b264b452aa2a26adb1d9d Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 09:03:20 -0400 Subject: [PATCH 81/87] Move away from println and FMLLog "that doesn't belong to you" ~ some guy on MMD --- .../vigilant_eureka/blocks/tiles/LeyLineTile.java | 10 ++++++---- .../vigilant_eureka/core/EventHandler.java | 2 +- .../vigilant_eureka/proxy/CommonProxy.java | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java index deff507..8f704a6 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java @@ -1,5 +1,6 @@ package me.itstheholyblack.vigilant_eureka.blocks.tiles; +import me.itstheholyblack.vigilant_eureka.Reference; import me.itstheholyblack.vigilant_eureka.blocks.ModBlocks; import me.itstheholyblack.vigilant_eureka.core.EnumLeyTypes; import me.itstheholyblack.vigilant_eureka.core.Polygon; @@ -50,16 +51,16 @@ public EnumLinkResults addLinkOut(BlockPos bp) { if (!this.link_out.equals(bp)) { LeyLineTile otherLine = (LeyLineTile) this.world.getTileEntity(bp); if (!otherLine.link_out.equals(this.getPos())) { - System.out.println("Link succeeded!"); + Reference.LOGGER.debug("Link succeeded!"); this.link_out = bp; markDirty(); return EnumLinkResults.SUCCEED; } else { - System.out.println("Link failed - two way connection"); + Reference.LOGGER.debug("Link failed - two way connection"); return EnumLinkResults.TWOWAY; } } else { - System.out.println("Link failed - double linkage"); + Reference.LOGGER.debug("Link failed - double linkage"); return EnumLinkResults.DOUBLELINK; } } @@ -162,7 +163,7 @@ public void update() { } else { LeyLineTile te = (LeyLineTile) this.world.getTileEntity(link_out); if (te.getLinkOut().equals(BlockPos.ORIGIN.down())) { - System.out.println("Linked to BROKEN link node " + this.link_out); + Reference.LOGGER.debug("Linked to BROKEN link node " + this.link_out); this.link_out = BlockPos.ORIGIN.down(); markDirty(); return; @@ -217,6 +218,7 @@ public SPacketUpdateTileEntity getUpdatePacket() { } @Override + @SideOnly(Side.CLIENT) public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) { // Here we get the packet from the server and read it into our client side tile entity this.readFromNBT(packet.getNbtCompound()); diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java index 9d81cba..d9bbbf6 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/core/EventHandler.java @@ -161,7 +161,7 @@ public void lootLoad(LootTableLoadEvent evt) { if (name.startsWith(prefix)) { String file = name.substring(name.indexOf(prefix) + prefix.length()); if (file.equals("stronghold_library") || file.equals("simple_dungeon")) { - System.out.println("Injecting..."); + Reference.LOGGER.info("Injecting loot..."); evt.getTable().addPool(getInjectPool("simple_dungeon")); } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java index 3266ee6..cf37e9e 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/proxy/CommonProxy.java @@ -44,9 +44,9 @@ public class CommonProxy { public void preInit(FMLPreInitializationEvent e) { - FMLLog.log.info("Registering Vigilant Eureka event handler."); + Reference.LOGGER.info("Registering Vigilant Eureka event handler."); MinecraftForge.EVENT_BUS.register(new EventHandler()); - FMLLog.log.info("Registering Vigilant Eureka networking."); + Reference.LOGGER.info("Registering Vigilant Eureka networking."); PacketHandler.registerMessages(Reference.MOD_ID); ModEntities.init(); registerTiles(); From c39c91dac5889717047e09bf53583e12ade23250 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 09:03:40 -0400 Subject: [PATCH 82/87] Try to stop cascading lag --- .../vigilant_eureka/world/WorldGenLey.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/world/WorldGenLey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/world/WorldGenLey.java index b2f2789..ca4521a 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/world/WorldGenLey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/world/WorldGenLey.java @@ -48,12 +48,12 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkG // get template Template t = templateManager.get(world.getMinecraftServer(), r); // actual block level co-ords of chunk - int blockX = chunkX * 16; - int blockZ = chunkZ * 16; + int blockX = (chunkX * 16) + 8; + int blockZ = (chunkZ * 16) + 8; // get block level generation position int XModifier = random.nextInt(16); int ZModifier = random.nextInt(16); - // pick random values in ( + // pick random values in (0, 15) while (!(XModifier == 0 || XModifier == 15 || ZModifier == 0 || ZModifier == 15)) { XModifier = random.nextInt(16); ZModifier = random.nextInt(16); @@ -68,10 +68,8 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkG y = getGroundFromAbove(world, randX, randZ); } if (y < 0) { - System.out.println("Y < 0"); return; } - // System.out.format("Generating %s at (%d, %d, %d)\n", r.toString(), randX, y, randZ); PlacementSettings settings = new PlacementSettings(); BlockPos generationPos = new BlockPos(randX, y, randZ); settings.setRandom(world.rand); From 8925d1c57ece77f943d7d274df7545460cbbd1f5 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 09:03:55 -0400 Subject: [PATCH 83/87] Update mcmod --- src/main/resources/mcmod.info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index da7a924..b2d502a 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -13,6 +13,6 @@ "credits": "Paul Fulham, for being the generous god they are.\nSamuel#2783 (sorry) for the basis of the key texture.\nBord Listian, for the Crystalline Bismuth texture.\nPeople smarter than me, for Forge.", "logoFile": "", "screenshots": [], - "dependencies": [] + "dependencies": ["Baubles (latest build best build)"] } ] From a8e235e01c22457eae899f6c33f4a2775d0f4474 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 09:19:16 -0400 Subject: [PATCH 84/87] Update version in Gradle --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index d8581e6..2ccbc23 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -version = "0.0.3" +version = "0.0.4" group = "me.itstheholyblack.vigilant_eureka" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "vigilant_eureka" @@ -29,7 +29,7 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "snapshot_20180616" + mappings = "snapshot_20180619" makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. if (project.hasProperty('mc_username')) { clientRunArgs += ['--username', project.mc_username] From 42cb1e4a9abd1cfb43db217801da5f5a3a39d836 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 10:02:13 -0400 Subject: [PATCH 85/87] Use static fields for text compenents I admit that i'm not sure how much this impacts performance, but I made that realization 75% of the way through and couldn't be bothered to stop. --- .../vigilant_eureka/blocks/BlockLeyLine.java | 45 +++++++++++-------- .../blocks/tiles/LeyLineTile.java | 9 ++-- .../vigilant_eureka/items/DimKey.java | 23 +++++----- .../network/PacketSendTime.java | 9 +++- 4 files changed, 50 insertions(+), 36 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java index 4c8d192..638fc58 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/BlockLeyLine.java @@ -17,6 +17,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; @@ -29,6 +30,15 @@ import java.util.ArrayList; public class BlockLeyLine extends BlockTileEntity { + + private static final ITextComponent IT_WORKED = new TextComponentTranslation("message.ley_link_good").setStyle(new Style().setColor(TextFormatting.GREEN)); + private static final ITextComponent ALREADY_EXISTS = new TextComponentTranslation("message.ley_link_doublelink").setStyle(new Style().setColor(TextFormatting.RED)); + private static final ITextComponent TWO_WAY = new TextComponentTranslation("message.ley_link_twoway").setStyle(new Style().setColor(TextFormatting.RED)); + private static final ITextComponent SELF_LINK = new TextComponentTranslation("message.ley_link_selflink").setStyle(new Style().setColor(TextFormatting.RED)); + + private static final ITextComponent LEY_SOLVE_GOOD = new TextComponentTranslation("message.ley_solve_good").setStyle(new Style().setColor(TextFormatting.GREEN)); + private static final ITextComponent LEY_SOLVE_INCOMPLETE = new TextComponentTranslation("message.ley_solve_incomplete").setStyle(new Style().setColor(TextFormatting.RED)); + public BlockLeyLine() { super(Material.ROCK, "leyline"); this.setHardness(Float.POSITIVE_INFINITY); @@ -46,19 +56,20 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, LeyLineTile tile = this.getTileEntity(worldIn, pos); BlockPos p = net.minecraft.nbt.NBTUtil.getPosFromTag(comp.getCompoundTag("tolink")); LeyLineTile.EnumLinkResults results = tile.addLinkOut(p); - if (results.equals(LeyLineTile.EnumLinkResults.SUCCEED)) { - comp.removeTag("tolink"); - playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_good").setStyle(new Style().setColor(TextFormatting.GREEN)), true); - return true; - } else if (results.equals(LeyLineTile.EnumLinkResults.DOUBLELINK)) { - playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_doublelink").setStyle(new Style().setColor(TextFormatting.RED)), true); - return false; - } else if (results.equals(LeyLineTile.EnumLinkResults.TWOWAY)) { - playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_twoway").setStyle(new Style().setColor(TextFormatting.RED)), true); - return false; - } else { - playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_link_selflink").setStyle(new Style().setColor(TextFormatting.RED)), true); - return false; + switch (results) { + case SUCCEED: + comp.removeTag("tolink"); + playerIn.sendStatusMessage(IT_WORKED, true); + return true; + case DOUBLELINK: + playerIn.sendStatusMessage(ALREADY_EXISTS, true); + return false; + case TWOWAY: + playerIn.sendStatusMessage(TWO_WAY, true); + return false; + case SELFLINK: + playerIn.sendStatusMessage(SELF_LINK, true); + return false; } } else { comp.setTag("tolink", net.minecraft.nbt.NBTUtil.createPosTag(pos)); @@ -72,17 +83,15 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, for (BlockPos p : poly) { LeyLineTile te = (LeyLineTile) worldIn.getTileEntity(p); te.setPolygon(poly); - if (!te.isLead()) { - continue; - } else { + if (te.isLead()) { hasLeader = true; } } thisTile.setLead(!hasLeader); - playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_solve_good").setStyle(new Style().setColor(TextFormatting.GREEN)), true); + playerIn.sendStatusMessage(LEY_SOLVE_GOOD, true); return true; } else { - playerIn.sendStatusMessage(new TextComponentTranslation("message.ley_solve_incomplete").setStyle(new Style().setColor(TextFormatting.RED)), true); + playerIn.sendStatusMessage(LEY_SOLVE_INCOMPLETE, true); return false; } } else if (stack.getItem().equals(ModItems.leyRune)) { diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java index 8f704a6..19fc2a1 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/blocks/tiles/LeyLineTile.java @@ -14,6 +14,7 @@ import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; @@ -27,6 +28,8 @@ public class LeyLineTile extends TileEntity implements ITickable { + private static final ITextComponent ENTER_LEY = new TextComponentTranslation("message.enter_ley").setStyle(new Style().setItalic(true).setColor(TextFormatting.AQUA)); + public float ticks = 0; private BlockPos link_out; @@ -180,11 +183,7 @@ public void update() { for (Entity e : lastList) { NBTTagCompound compound = e.getEntityData(); if (!(compound.getBoolean("inPoly")) && e instanceof EntityPlayer) { - ((EntityPlayer) e).sendStatusMessage(new TextComponentTranslation("message.enter_ley") - .setStyle(new Style() - .setItalic(true) - .setColor(TextFormatting.AQUA) - ), true); + ((EntityPlayer) e).sendStatusMessage(ENTER_LEY, true); } compound.setBoolean("inPoly", specialPoly.contains(e)); compound.setTag("masterPos", NBTUtil.createPosTag(this.pos)); diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java index 048322b..343b0d3 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/DimKey.java @@ -20,8 +20,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.*; import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; @@ -33,6 +32,9 @@ public class DimKey extends Item { + private static final ITextComponent DOOR_SUCCESS_MESSAGE = new TextComponentTranslation("message.door_set_success").setStyle(new Style().setColor(TextFormatting.GREEN)); + private static final ITextComponent DOOR_FAIL_MESSAGE = new TextComponentTranslation("message.door_set_fail").setStyle(new Style().setColor(TextFormatting.RED)); + public DimKey() { setRegistryName(Reference.MOD_ID, "dim_key"); setUnlocalizedName(Reference.MOD_ID + ".dim_key"); @@ -73,20 +75,17 @@ public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos System.out.println(worldIn.getBlockState(pos).getBlock()); if (worldIn.getBlockState(pos).getBlock().equals(ModBlocks.movingdoor)) { - MovingCastleDoorTile t; - if (worldIn.getBlockState(pos).getValue(MovingCastleDoor.IS_TOP)) { - t = (MovingCastleDoorTile) worldIn.getTileEntity(pos); - } else { - t = (MovingCastleDoorTile) worldIn.getTileEntity(pos.up()); - } - if (tag != null && t != null && tag.getInteger("y") > 0) { + MovingCastleDoorTile t = worldIn.getBlockState(pos).getValue(MovingCastleDoor.IS_TOP) ? + (MovingCastleDoorTile) worldIn.getTileEntity(pos) : + (MovingCastleDoorTile) worldIn.getTileEntity(pos.up()); + if (t != null && tag.getInteger("y") > 0) { t.setDestination( new BlockPos(tag.getInteger("x"), tag.getInteger("y"), tag.getInteger("z")), - stack.getTagCompound().getInteger("dim")); - playerIn.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "Click."), true); + tag.getInteger("dim")); + playerIn.sendStatusMessage(DOOR_SUCCESS_MESSAGE, true); return EnumActionResult.SUCCESS; } else if (tag.getInteger("y") <= 0) { - playerIn.sendStatusMessage(new TextComponentString(TextFormatting.RED + "It won't turn."), true); + playerIn.sendStatusMessage(DOOR_FAIL_MESSAGE, true); return EnumActionResult.FAIL; } } diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java index 6c84717..51423c8 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/network/PacketSendTime.java @@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -15,12 +16,16 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public class PacketSendTime implements IMessage { private BlockPos look; private BlockPos stand; + private static final ITextComponent EYE_ALREADY_OPEN = new TextComponentTranslation("message.eye_already_open"); + @Override public void fromBytes(ByteBuf buf) { // Encoding the position as a long is more efficient @@ -35,6 +40,8 @@ public void toBytes(ByteBuf buf) { buf.writeLong(stand.toLong()); } + + @SideOnly(Side.CLIENT) public PacketSendTime() { RayTraceResult result = Minecraft.getMinecraft().objectMouseOver; look = result.getBlockPos(); @@ -61,7 +68,7 @@ private void handle(PacketSendTime message, MessageContext ctx) { playerEntity.getCooldownTracker().setCooldown(ModItems.itemTime, 100); ChunkRebuilder.rebuildChunk(world, pos, message.stand); } else if (playerEntity.getCooldownTracker().hasCooldown(ModItems.itemTime)) { - playerEntity.sendStatusMessage(new TextComponentTranslation("message.eye_already_open"), true); + playerEntity.sendStatusMessage(EYE_ALREADY_OPEN, true); } } } From 525881c9cf8e71d37e2dce2ed8c258c2e7163493 Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 10:31:47 -0400 Subject: [PATCH 86/87] Localize door messages --- src/main/resources/assets/vigilant_eureka/lang/en_us.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang index b8a9625..91f9f06 100644 --- a/src/main/resources/assets/vigilant_eureka/lang/en_us.lang +++ b/src/main/resources/assets/vigilant_eureka/lang/en_us.lang @@ -24,6 +24,9 @@ vigilant_eureka.keybind.warp_key=Warp with Warp Boots vigilant_eureka.keybind.time_key=Open the Eye vigilant_eureka.gui.keybinds=Vigilant Eureka +message.door_set_success=Click +message.door_set_fail=It won't turn. + message.ley_link_good=It worked! message.ley_link_selflink=The feedback loop quickly decays to nothing... message.ley_link_doublelink=This link already exists! From 5c936dfba853b15bfa2cc538917e431a20cb9b0f Mon Sep 17 00:00:00 2001 From: Edwan Vi Date: Tue, 19 Jun 2018 10:32:15 -0400 Subject: [PATCH 87/87] Fix time item rendering on invisible players --- .../client/renderer/CustomBipedArmor.java | 4 ++- .../items/baubles/ItemTime.java | 32 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java index 8392c5c..b79751d 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/client/renderer/CustomBipedArmor.java @@ -10,6 +10,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nonnull; + /** * Class to conditionally render armor, allowing full invisibility. Code concept by Paul Fulham, modified by Edwan Vi into a working state. * @@ -26,7 +28,7 @@ public CustomBipedArmor(LayerBipedArmor l) { } @Override - public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float delta, float age, float yaw, float pitch, float scale) { + public void doRenderLayer(@Nonnull EntityLivingBase entity, float limbSwing, float limbSwingAmount, float delta, float age, float yaw, float pitch, float scale) { boolean visible = !entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem().equals(ModItems.invisCap); if (entity instanceof EntityPlayer) { visible = visible && !NBTUtil.getPlayerPersist((EntityPlayer) entity).getBoolean("metaphysical_high_ground"); diff --git a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java index 1ff84de..fc20da7 100644 --- a/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java +++ b/src/main/java/me/itstheholyblack/vigilant_eureka/items/baubles/ItemTime.java @@ -17,6 +17,7 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; @@ -63,21 +64,23 @@ public BaubleType getBaubleType(ItemStack itemStack) { @SideOnly(Side.CLIENT) public void onPlayerBaubleRender(ItemStack itemStack, EntityPlayer entityPlayer, RenderType renderType, float v) { if (renderType.equals(RenderType.BODY)) { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - Helper.rotateIfSneaking(entityPlayer); - Helper.translateToChest(); - Helper.defaultTransforms(); - scale(1.25F); - boolean armor = !entityPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty(); - GlStateManager.translate(-0.5F, -0.7F, armor ? 0.1F : 0F); + if (!entityPlayer.isInvisible()) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + Helper.rotateIfSneaking(entityPlayer); + Helper.translateToChest(); + Helper.defaultTransforms(); + scale(1.25F); + boolean armor = !(entityPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty() || entityPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem().equals(Items.ELYTRA)); + GlStateManager.translate(-0.5F, -0.7F, armor ? 0.1F : 0F); - boolean open = entityPlayer.getCooldownTracker().hasCooldown(this); - TextureAtlasSprite gemIcon = open ? Icons.INSTANCE.time_open : Icons.INSTANCE.time_closed; - float f = gemIcon.getMinU(); - float f1 = gemIcon.getMaxU(); - float f2 = gemIcon.getMinV(); - float f3 = gemIcon.getMaxV(); - RenderHelp.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, gemIcon.getIconWidth(), gemIcon.getIconHeight(), 1F / 32F); + boolean open = entityPlayer.getCooldownTracker().hasCooldown(this); + TextureAtlasSprite gemIcon = open ? Icons.INSTANCE.time_open : Icons.INSTANCE.time_closed; + float f = gemIcon.getMinU(); + float f1 = gemIcon.getMaxU(); + float f2 = gemIcon.getMinV(); + float f3 = gemIcon.getMaxV(); + RenderHelp.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, gemIcon.getIconWidth(), gemIcon.getIconHeight(), 1F / 32F); + } } } @@ -87,6 +90,7 @@ public void addInformation(ItemStack stack, World worldIn, List tooltip, tooltip.add(I18n.format("mouseovertext.time")); } + @SideOnly(Side.CLIENT) private static void scale(float f) { GlStateManager.scale(f, f, f); }