From 1a9a69a4bd830bb95751df16e9a72415455da659 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 8 Nov 2016 13:25:36 +0100 Subject: [PATCH] Removed the laser wrench setting Closes #339 --- .../mod/blocks/render/RenderLaserRelay.java | 34 +++++------------- .../mod/booklet/InitBooklet.java | 2 +- .../mod/items/ItemLaserWrench.java | 35 ------------------- .../actuallyadditions/mod/util/AssetUtil.java | 4 +-- .../assets/actuallyadditions/lang/en_US.lang | 1 - 5 files changed, 11 insertions(+), 65 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java index a6a1f76a0..b77a7316b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java @@ -14,17 +14,10 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; -import de.ellpeck.actuallyadditions.mod.data.PlayerData; -import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; -import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench; -import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench.WrenchMode; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; @@ -38,26 +31,15 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer{ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){ if(tile instanceof TileEntityLaserRelay){ TileEntityLaserRelay relay = (TileEntityLaserRelay)tile; + ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getPos(), tile.getWorld()); + if(connections != null && !connections.isEmpty()){ + for(IConnectionPair pair : connections){ + if(!pair.doesSuppressRender() && tile.getPos().equals(pair.getPositions()[0])){ + BlockPos first = tile.getPos(); + BlockPos second = pair.getPositions()[1]; + float[] color = relay.type == LaserType.ITEM ? COLOR_ITEM : (relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR); - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if(player != null){ - PlayerSave data = PlayerData.getDataFromPlayer(player); - WrenchMode mode = WrenchMode.values()[data.theCompound.getInteger("LaserWrenchMode")]; - if(mode != WrenchMode.NO_PARTICLES){ - ItemStack stack = player.getHeldItemMainhand(); - if(mode == WrenchMode.ALWAYS_PARTICLES || (stack != null && stack.getItem() instanceof ItemLaserWrench)){ - ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getPos(), tile.getWorld()); - if(connections != null && !connections.isEmpty()){ - for(IConnectionPair pair : connections){ - if(!pair.doesSuppressRender() && tile.getPos().equals(pair.getPositions()[0])){ - BlockPos first = tile.getPos(); - BlockPos second = pair.getPositions()[1]; - float[] color = relay.type == LaserType.ITEM ? COLOR_ITEM : (relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR); - - AssetUtil.renderLaser(first.getX()+0.5, first.getY()+0.5, first.getZ()+0.5, second.getX()+0.5, second.getY()+0.5, second.getZ()+0.5, 120, 0.5F, 0.05, color); - } - } - } + AssetUtil.renderLaser(first.getX()+0.5, first.getY()+0.5, first.getZ()+0.5, second.getX()+0.5, second.getY()+0.5, second.getZ()+0.5, 120, 0.5F, 0.05, color); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index d49ce543b..9b6704640 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -174,7 +174,7 @@ public final class InitBooklet{ //RF Using Blocks new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFarmer), new PageTextOnly(1).addTextReplacement("", TileEntityFarmer.USE_PER_OPERATION), new PageCrafting(2, BlockCrafting.recipeFarmer).setNoText().setPageStacksWildcard()).setImportant(); new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFireworkBox), new PageTextOnly(1).addTextReplacement("", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial(); - new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLaserRelay), new PageTextOnly(1).addTextReplacement("", TileEntityLaserRelay.MAX_DISTANCE), new PageTextOnly(2).addTextReplacement("", TileEntityLaserRelayEnergy.CAP).addTextReplacement("", TileEntityLaserRelayEnergyAdvanced.CAP).addTextReplacement("", TileEntityLaserRelayEnergyExtreme.CAP), new PagePicture(3, "pageLaserRelay", 0).setNoText(), new PageCrafting(4, BlockCrafting.recipeLaserRelay).setNoText().setPageStacksWildcard(), new PageCrafting(5, BlockCrafting.recipeLaserRelayAdvanced).setNoText().setPageStacksWildcard(), new PageCrafting(6, BlockCrafting.recipeLaserRelayExtreme).setNoText().setPageStacksWildcard(), new PageCrafting(7, ItemCrafting.recipeLaserWrench)).setImportant(); + new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLaserRelay), new PageTextOnly(1).addTextReplacement("", TileEntityLaserRelay.MAX_DISTANCE), new PageTextOnly(2).addTextReplacement("", TileEntityLaserRelayEnergy.CAP).addTextReplacement("", TileEntityLaserRelayEnergyAdvanced.CAP).addTextReplacement("", TileEntityLaserRelayEnergyExtreme.CAP), new PagePicture(3, "pageLaserRelay", 0).setNoText(), new PageCrafting(4, BlockCrafting.recipeLaserRelay).setNoText().setPageStacksWildcard(), new PageCrafting(5, BlockCrafting.recipeLaserRelayAdvanced).setNoText().setPageStacksWildcard(), new PageCrafting(6, BlockCrafting.recipeLaserRelayExtreme).setNoText().setPageStacksWildcard(), new PageCrafting(7, ItemCrafting.recipeLaserWrench).setNoText()).setImportant(); new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockMiner), new PageTextOnly(1).addTextReplacement("", TileEntityMiner.ENERGY_USE_PER_BLOCK).addTextReplacement("", TileEntityMiner.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial(); new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).setStacks(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "pageCoffeeMachine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setNoText().setPageStacksWildcard(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant(); new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("", TileEntityGrinder.ENERGY_USE), new PageCrafting(2, BlockCrafting.recipeCrusher).setNoText().setPageStacksWildcard(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setNoText().setPageStacksWildcard(), new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java index cf9199d40..18c4a4f04 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java @@ -78,29 +78,6 @@ public class ItemLaserWrench extends ItemBase{ return EnumActionResult.FAIL; } - @Override - public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ - if(!world.isRemote && player.isSneaking()){ - PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(player); - - int currMode = save.theCompound.getInteger("LaserWrenchMode"); - if(currMode+1 >= WrenchMode.values().length){ - currMode = 0; - } - else{ - currMode++; - } - save.theCompound.setInteger("LaserWrenchMode", currMode); - - if(player instanceof EntityPlayerMP){ - PacketHandlerHelper.sendPlayerDataToClientPacket(player, save.theCompound, false); - } - - player.addChatComponentMessage(new TextComponentString("Mode changed to "+WrenchMode.values()[currMode].name+"!")); - } - return new ActionResult(EnumActionResult.SUCCESS, stack); - } - @Override public boolean getShareTag(){ return true; @@ -123,16 +100,4 @@ public class ItemLaserWrench extends ItemBase{ public EnumRarity getRarity(ItemStack stack){ return EnumRarity.EPIC; } - - public enum WrenchMode{ - ALWAYS_PARTICLES("always show particles"), - NO_PARTICLES("never show particles"), - HOLDING_PARTICLES("show particles when holding a Laser Wrench"); - - public final String name; - - WrenchMode(String name){ - this.name = name; - } - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 7b44c952b..54f26aaf6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -207,7 +207,7 @@ public final class AssetUtil{ //Thanks to feldim2425 for this. //I can't do rendering code. Ever. @SideOnly(Side.CLIENT) - public static void renderLaser(double firstX, double firstY, double firstZ, double secondX, double secondY, double secondZ, int rotationTime, float alpha, double beamWidth, float[] color){ + public static void renderLaser(double firstX, double firstY, double firstZ, double secondX, double secondY, double secondZ, double rotationTime, float alpha, double beamWidth, float[] color){ Tessellator tessy = Tessellator.getInstance(); VertexBuffer render = tessy.getBuffer(); World world = Minecraft.getMinecraft().theWorld; @@ -222,7 +222,7 @@ public final class AssetUtil{ Vec3d vec2 = new Vec3d(secondX, secondY, secondZ); Vec3d combinedVec = vec2.subtract(vec1); - double rot = rotationTime > 0 ? (360F*(((float)world.getTotalWorldTime()%(float)rotationTime)/(float)rotationTime)) : 0; + double rot = rotationTime > 0 ? (360D*((world.getTotalWorldTime()%rotationTime)/rotationTime)) : 0; double pitch = Math.atan2(combinedVec.yCoord, Math.sqrt(combinedVec.xCoord*combinedVec.xCoord+combinedVec.zCoord*combinedVec.zCoord)); double yaw = Math.atan2(-combinedVec.zCoord, combinedVec.xCoord); diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 2417efd78..8e966de3a 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -918,7 +918,6 @@ booklet.actuallyadditions.chapter.hairBalls.text.2=Balls of Fur are an booklet.actuallyadditions.chapter.laserRelays.name=Energy Laser Relays booklet.actuallyadditions.chapter.laserRelays.text.1=The Energy Laser Relay is a block that can wirelessly transfer RF (or Tesla) just by being connected with a Laser Wrench, generating a network. When placing a Power Generator or Receiver next to the relay, it can receive Power from any other relay in the network. This system always works in both directions simultaneously. Two relays can be at most blocks apart. During an energy transfer, they have a light Energy Loss, but nothing to worry about. booklet.actuallyadditions.chapter.laserRelays.text.2=There are three tiers of Energy Laser Relay. They have different maximum amounts of energy to be transferred through them in one tick. The energy caps are, in order, , , and . Additionally, the energy loss is a bit higher every tier. Interconnecting different tiers is possible, however the lowest cap and highest loss of the two relays connected to the blocks involved in the transfer is considered. -booklet.actuallyadditions.chapter.laserRelays.text.7=The Laser Wrench's mode can be switched by sneak-right-clicking it anywhere. Possible modes are to always show lasers, never show lasers or only show lasers when holding the wrench. booklet.actuallyadditions.chapter.blackLotus.name=Black Lotus booklet.actuallyadditions.chapter.blackLotus.text.1=Think of this: You need to craft black wool, black clay or anything else that needs black dye but you are just guilty about killing so many innocent squids? Well, the Black Lotus is exactly the thing you need! Just look around in the wild a bit, and you will find one, then being able to craft some Black Dye that can be used instead of Ink Sacs so that you don't need to kill poor squids and L any longer.