From fa0a6bbcd53ed395989f136a7ed21b8b6f7290d0 Mon Sep 17 00:00:00 2001 From: brandon3055 Date: Thu, 4 Dec 2014 08:13:10 +1100 Subject: [PATCH] 04/12/14 --- build.gradle | 2 +- .../draconicevolution/DraconicEvolution.java | 2 +- .../draconicevolution/client/ClientProxy.java | 56 +++- .../client/handler/ClientEventHandler.java | 86 +++++- .../client/handler/ToolHudHandler.java | 4 +- .../client/interfaces/GUIEnergyInfuser.java | 7 +- .../client/interfaces/GUITeleporter.java | 14 +- .../interfaces/manual/CraftingInfoPage.java | 4 + .../client/interfaces/manual/IntroPage.java | 2 + .../client/render/entity/RenderDragon.java | 2 +- .../render/tile/RenderTileEnergyPylon.java | 53 +++- .../tile/RenderTileEnergyStorageCore.java | 14 +- .../tile/RenderTileTeleporterStand.java | 94 +++++- .../draconicevolution/common/CommonProxy.java | 11 + .../draconicevolution/common/ModItems.java | 6 +- .../common/achievements/Achievements.java | 118 +++++++- .../common/blocks/CustomSpawner.java | 29 +- .../common/blocks/DraconiumBlock.java | 2 +- .../common/blocks/multiblock/EnergyPylon.java | 2 +- .../multiblock/InvisibleMultiblock.java | 2 +- .../common/entity/EntityDragonHeart.java | 11 +- .../common/entity/EntityPersistentItem.java | 106 ++++++- .../common/handler/ConfigHandler.java | 2 + .../common/handler/CraftingHandler.java | 2 +- .../handler/MinecraftForgeEventHandler.java | 75 ++++- .../common/items/AwakenedCore.java | 2 +- .../common/items/DraconicCore.java | 2 +- .../common/items/DraconicIngot.java | 2 +- .../common/items/DragonHeart.java | 2 +- .../common/items/Tclogo.java | 47 ++- .../common/items/WyvernCore.java | 2 +- .../common/items/armor/WyvernArmor.java | 6 +- .../common/items/tools/TeleporterMKI.java | 154 ++++------ .../common/items/tools/TeleporterMKII.java | 101 +++---- .../common/items/weapons/DraconicBow.java | 5 +- .../common/items/weapons/WyvernBow.java | 5 +- .../common/network/MountUpdatePacket.java | 52 ++++ .../common/network/TeleporterPacket.java | 6 +- .../tileentities/CustomSpawnerBaseLogic.java | 19 +- .../tileentities/TileEnergyInfuser.java | 4 +- .../common/tileentities/TileTestBlock.java | 110 +++++-- .../multiblocktiles/TileEnergyPylon.java | 159 +++++----- .../TileEnergyStorageCore.java | 31 +- .../common/utills/CustomTeleporter.java | 41 --- .../common/utills/Teleporter.java | 275 ++++++++++++++---- .../assets/draconicevolution/lang/en_US.lang | 104 ++++++- .../textures/models/TeleporterStand.png | Bin 4173 -> 3444 bytes .../models/power_sphere_layer_1 - Copy.png | Bin 0 -> 525 bytes .../textures/models/power_sphere_layer_1.png | Bin 525 -> 484 bytes .../models/pylon_sphere_texture - Copy.png | Bin 0 -> 534 bytes .../textures/models/pylon_sphere_texture.png | Bin 534 -> 504 bytes 51 files changed, 1353 insertions(+), 482 deletions(-) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utills/CustomTeleporter.java create mode 100644 src/main/resources/assets/draconicevolution/textures/models/power_sphere_layer_1 - Copy.png create mode 100644 src/main/resources/assets/draconicevolution/textures/models/pylon_sphere_texture - Copy.png diff --git a/build.gradle b/build.gradle index b695e94c..cda342cb 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ repositories { apply plugin: 'forge' -version = "1.7.10-v1.0.0-snapshot_2" //Version System A.B.C A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) +version = "1.7.10-v1.0.0-snapshot_4" //Version System A.B.C A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) group= "com.brandon3055.draconicevolution" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Draconic-Evolution" diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index e84a29d0..fbd42a2f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java +++ b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java @@ -30,7 +30,7 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi public static final String networkChannelName = "DraconicEvolution"; public static SimpleNetworkWrapper network; - public static boolean debug = false; + public static boolean debug = true; public static Enchantment reaperEnchant; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java index 88bd2ed1..c66f5d56 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java @@ -35,6 +35,7 @@ import net.minecraftforge.common.MinecraftForge; public class ClientProxy extends CommonProxy { private final static boolean debug = DraconicEvolution.debug; + public static String downloadLocation; @Override public void preInit(FMLPreInitializationEvent event) @@ -42,6 +43,55 @@ public class ClientProxy extends CommonProxy { System.out.println("on Client side"); super.preInit(event); + + +// downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/mods/derspack"; +// downloadLocation = downloadLocation.replaceAll("\\\\", "/"); + +// File rescourcePack = new File(event.getModConfigurationDirectory().getParentFile(), "/mods/derspack"); +// +// +// //File file = new File(downloadLocation); +// if (!rescourcePack.exists()) rescourcePack.mkdir(); +// +// LogHelper.info("Downloading Images"); +// +// try { +// URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); +// String fileName = url.getFile(); +// //String destName = downloadLocation + fileName.substring(fileName.lastIndexOf("/")); +// File dll = new File(rescourcePack, fileName.substring(fileName.lastIndexOf("/"))); +// +// InputStream is = url.openStream(); +// OutputStream os = new FileOutputStream(dll); +// +// ByteStreams.copy(is, os); +// +// is.close(); +// os.close(); +// }catch (IOException e){ +// LogHelper.info(e); +// } +// +// +// List defaultResourcePacks = Lists.newArrayList(); +// Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao"); +// f.setAccessible(true); +// try { +// defaultResourcePacks = (List)f.get(Minecraft.getMinecraft()); +// defaultResourcePacks.add(new FolderResourcePack(rescourcePack)); +// for (Object o : defaultResourcePacks){ +// if (o instanceof FolderResourcePack) LogHelper.info(((FolderResourcePack) o).getPackName()); +// if (o instanceof FileResourcePack) LogHelper.info(((FileResourcePack)o).getPackName()); +// } +// +// f.set(Minecraft.getMinecraft(), defaultResourcePacks); +// } +// catch (IllegalAccessException e) { +// e.printStackTrace(); +// } + + } @Override @@ -51,6 +101,7 @@ public class ClientProxy extends CommonProxy { FMLCommonHandler.instance().bus().register(new KeyInputHandler()); FMLCommonHandler.instance().bus().register(new ClientEventHandler()); MinecraftForge.EVENT_BUS.register(new ToolHudHandler()); + MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); KeyBindings.init(); registerRenderIDs(); registerRendering(); @@ -80,7 +131,7 @@ public class ClientProxy extends CommonProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileParticleGenerator.class, new RenderTileParticleGen()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyInfuser.class, new RenderTileEnergyInfiser()); ClientRegistry.bindTileEntitySpecialRenderer(TileCustomSpawner.class, new RenderTileCustomSpawner()); - ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileTestBlock()); + //ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileTestBlock()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyStorageCore.class, new RenderTileEnergyStorageCore()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyPylon.class, new RenderTileEnergyPylon()); ClientRegistry.bindTileEntitySpecialRenderer(TilePlacedItem.class, new RenderTilePlacedItem()); @@ -97,4 +148,7 @@ public class ClientProxy extends CommonProxy { References.idTeleporterStand = RenderingRegistry.getNextAvailableRenderId(); } + @Override + public boolean isClientSide() { return true; } + } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java index c80f7641..7c27228a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java @@ -1,7 +1,17 @@ package com.brandon3055.draconicevolution.client.handler; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow; +import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow; +import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; +import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraftforge.client.event.FOVUpdateEvent; /** * Created by Brandon on 28/10/2014. @@ -9,11 +19,85 @@ import cpw.mods.fml.common.gameevent.TickEvent; public class ClientEventHandler { public static int elapsedTicks; + private static float previousFOB = 0f; + public static float previousSensitivity = 0; + public static boolean bowZoom = false; + public static boolean lastTickBowZoom = false; + public static int tickSet = 0; + private static int remountTicksRemaining = 0; + private static int remountEntityID = 0; @SubscribeEvent public void tickEnd(TickEvent event) { + if (event.phase != TickEvent.Phase.START || event.side != Side.CLIENT) return; elapsedTicks++; - ToolHudHandler.clientTick(); + + if (bowZoom && !lastTickBowZoom){ + previousSensitivity = Minecraft.getMinecraft().gameSettings.mouseSensitivity; + Minecraft.getMinecraft().gameSettings.mouseSensitivity = previousSensitivity / 3; + }else if (!bowZoom && lastTickBowZoom){ + Minecraft.getMinecraft().gameSettings.mouseSensitivity = previousSensitivity; + } + + lastTickBowZoom = bowZoom; + if (elapsedTicks - tickSet > 10) bowZoom = false; + + searchForPlayerMount(); + } + + @SubscribeEvent + public void fovUpdate(FOVUpdateEvent event){ + if (event.entity.getItemInUse() != null && (event.entity.getItemInUse().getItem() instanceof WyvernBow || event.entity.getItemInUse().getItem() instanceof DraconicBow)){ + float f = 1f; + int i = event.entity.getItemInUseDuration(); + float f1 = (float)i / 20.0F; + + float zMax = 1f; + + if (ItemNBTHelper.getString(event.entity.getItemInUse(), "mode", "").equals("sharpshooter")){ + if (event.entity.getItemInUse().getItem() instanceof WyvernBow) zMax = 1.35f; + else if (event.entity.getItemInUse().getItem() instanceof DraconicBow) zMax = 2.5f; + bowZoom = true; + tickSet = elapsedTicks; + } + + + if (f1 < zMax) + { + f1 *= (f1*(zMax*2)); + } + else f1 = previousFOB; + + previousFOB = f1; + + f *= 1.0F - f1 * 0.15F; + event.newfov = f; + } + } + + + private void searchForPlayerMount(){ + if (remountTicksRemaining > 0){ + Entity e = Minecraft.getMinecraft().theWorld.getEntityByID(remountEntityID); + if (e != null){ + Minecraft.getMinecraft().thePlayer.mountEntity(e); + LogHelper.info("Successfully placed player on mount after "+(500 - remountTicksRemaining)+" ticks"); + remountTicksRemaining = 0; + return; + } + remountTicksRemaining--; + if (remountTicksRemaining == 0){ + LogHelper.error("Unable to locate player mount after 500 ticks! Aborting"); + DraconicEvolution.network.sendToServer(new MountUpdatePacket(-1)); + } + } + } + + public static void tryRepositionPlayerOnMount(int id){ + if (remountTicksRemaining == 500) return; + remountTicksRemaining = 500; + remountEntityID = id; + LogHelper.info("Started checking for player mount"); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ToolHudHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ToolHudHandler.java index eaab8dd2..2a48a0ce 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ToolHudHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ToolHudHandler.java @@ -40,11 +40,13 @@ public class ToolHudHandler { if (opacity > 0) { GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int color = Color.getHSBColor((float) Math.cos(ClientEventHandler.elapsedTicks / 250D), 0.6F, 1F).getRGB(); var8.drawStringWithShadow(currentTooltip, tooltipStartX, tooltipStartY, color + (opacity << 24)); GL11.glDisable(GL11.GL_BLEND); + GL11.glPopAttrib(); GL11.glPopMatrix(); } } @@ -53,7 +55,7 @@ public class ToolHudHandler { public static void setTooltip(String tooltip) { if (!tooltip.equals(currentTooltip)) { currentTooltip = tooltip; - tooltipDisplayTicks = 900; + tooltipDisplayTicks = 500; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUIEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUIEnergyInfuser.java index 999ec5b4..15ae122d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUIEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUIEnergyInfuser.java @@ -24,7 +24,6 @@ public class GUIEnergyInfuser extends GuiContainer { public EntityPlayer player; private TileEnergyInfuser tile; - private int guiUpdateTick; private float rotation = 0; public GUIEnergyInfuser(InventoryPlayer invPlayer, TileEnergyInfuser tile) { @@ -49,12 +48,12 @@ public class GUIEnergyInfuser extends GuiContainer { float power = (float) tile.energy.getEnergyStored() / (float) tile.energy.getMaxEnergyStored() * -1F + 1F; - drawTexturedModalRect(guiLeft + 49, guiTop + 7 + (int) (power * 45), xSize, 0 + (int) (power * 45), 8, 45 - (int) (power * 45));//Power bar + drawTexturedModalRect(guiLeft + 49, guiTop + 7 + (int) (power * 45), xSize, (int) (power * 45), 8, 45 - (int) (power * 45));//Power bar if (tile.running && tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IEnergyContainerItem) { IEnergyContainerItem item = (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); float charge = (float) item.getEnergyStored(tile.getStackInSlot(0)) / (float) item.getMaxEnergyStored(tile.getStackInSlot(0)) * -1F + 1F; - drawTexturedModalRect(guiLeft + 119, guiTop + 7 + (int) (charge * 45), xSize, 0 + (int) (charge * 45), 8, 45 - (int) (charge * 45));//Item Power bar + drawTexturedModalRect(guiLeft + 119, guiTop + 7 + (int) (charge * 45), xSize, (int) (charge * 45), 8, 45 - (int) (charge * 45));//Item Power bar } drawAnimatedParts(); @@ -122,7 +121,7 @@ public class GUIEnergyInfuser extends GuiContainer { GL11.glTranslatef(-26, -26, 0); drawTexturedModalRect(0, 0, xSize, 63, 52, 52); } - if (tile.running && tile.energy.getEnergyStored() > 0){ + if (tile.running && tile.transfer){ Random rand = tile.getWorldObj().rand; int boltL = rand.nextInt(4); int boltS = rand.nextInt(3); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java index 42164da4..1e94bba8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java @@ -2,14 +2,13 @@ package com.brandon3055.draconicevolution.client.interfaces; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.interfaces.manual.GuiButtonAHeight; -import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation; +import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.TeleporterPacket; import com.brandon3055.draconicevolution.common.utills.GuiHelper; import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; @@ -255,7 +254,6 @@ public class GUITeleporter extends GuiScreen selrctionOffset = 0; DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selrctionOffset, false)); - LogHelper.info("Crash Aborted!"); } if (locations.size() == 0 || locations.get(selected + selrctionOffset).getWriteProtected()) { ((GuiButton) buttonList.get(0)).enabled = false; @@ -339,7 +337,7 @@ public class GUITeleporter extends GuiScreen } if (button.id == 1){ - TeleportLocation location = new TeleportLocation(player.posX, player.posY, player.posZ, player.dimension, player.cameraPitch, player.cameraYaw, locations.get(selected+selrctionOffset).getName()); + TeleportLocation location = new TeleportLocation(player.posX, player.posY-1.62, player.posZ, player.dimension, player.rotationPitch, player.rotationYaw, locations.get(selected+selrctionOffset).getName()); DraconicEvolution.network.sendToServer(new TeleporterPacket(location, TeleporterPacket.UPDATEDESTINATION, selected+selrctionOffset)); locations.set(selected + selrctionOffset, location); } @@ -499,8 +497,8 @@ public class GUITeleporter extends GuiScreen } private void addCurrentLocationToList(String name){ - TeleportLocation currentLocation = new TeleportLocation(player.posX, player.posY, player.posZ, player.dimension, player.rotationPitch, player.rotationYaw, name); - DraconicEvolution.network.sendToServer(new TeleporterPacket(currentLocation, 0)); + TeleportLocation currentLocation = new TeleportLocation(player.posX, player.posY-1.62, player.posZ, player.dimension, player.rotationPitch, player.rotationYaw, name); + DraconicEvolution.network.sendToServer(new TeleporterPacket(currentLocation, TeleporterPacket.ADDDESTINATION)); locations.add(currentLocation); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java index 1f85e3a9..62f393a3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java @@ -112,6 +112,10 @@ public class CraftingInfoPage extends TitledPage { int offset = 0; for (String s : getFormattedText(fontRendererObj)) { if (s == null) break; + if (s.substring(0,2).equals("\\%")){ + s = s.substring(2); + offset += fontRendererObj.FONT_HEIGHT/2; + } fontRendererObj.drawString(s, 0, offset, 0x000000); offset += fontRendererObj.FONT_HEIGHT; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java index 312534d7..a5c22eb8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java @@ -24,6 +24,8 @@ public class IntroPage extends BasePage { @Override public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY); + //ResourceLocation logo = new ResourceLocation(References.RESOURCESPREFIX +"oHRx1.png"); + minecraft.renderEngine.bindTexture(logo); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java index 13aa66d8..c1f009d5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java @@ -174,7 +174,7 @@ public class RenderDragon extends RenderLiving f2 = (f1 - 0.8F) / 0.2F; } - Random random = new Random(432L); + Random random = new Random(1L); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java index 0b14971e..6aea89f4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java @@ -1,10 +1,7 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyPylon; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; -import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; @@ -27,30 +24,52 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer { } @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { + + if (tile == null || !(tile instanceof TileEnergyPylon)) return; TileEnergyPylon pylon = (TileEnergyPylon) tile; if (!pylon.active) return; - float scale = pylon.modelScale + (timeSinceLastTick *= pylon.input ? -0.01F : 0.01F); + float scale = pylon.modelScale + (timeSinceLastTick *= !pylon.reciveEnergy ? -0.01F : 0.01F); float rotation = pylon.modelRotation + (timeSinceLastTick / 2F); + + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + GL11.glTranslated(x+0.5, y+0.5, z+0.5); if (pylon.getWorldObj().getBlockMetadata(pylon.xCoord, pylon.yCoord, pylon.zCoord) == 1) { GL11.glTranslated(0, 1, 0); }else { GL11.glTranslated(0, -1, 0); } - //GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glDepthMask(false); - FMLClientHandler.instance().getClient().getTextureManager().bindTexture(model_texture); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + +// //GL11.glDepthMask(false); +// FMLClientHandler.instance().getClient().getTextureManager().bindTexture(model_texture); +// OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); +// GL11.glEnable(GL11.GL_CULL_FACE); +// //GL11.glEnable(GL11.GL_BLEND); +// //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); +// //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + + bindTexture(model_texture); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glDepthMask(false); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); + + GL11.glPushMatrix(); float scale1 = scale % 1F; GL11.glScalef(scale1, scale1, scale1); - GL11.glRotatef(rotation*0.5F, 0F, -1F, -0.5F); - GL11.glColor4f(1F, 1F, 1F, 1F-(scale1)); + GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F); + GL11.glColor4d(1D, 1D, 1D, 1F - (scale1)); model.renderAll(); GL11.glPopMatrix(); @@ -78,8 +97,20 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer { model.renderAll(); GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDepthMask(true); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); + GL11.glPopAttrib(); GL11.glPopMatrix(); } + + +// private void renderSphere() } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java index 29e2de81..bbe9cf97 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.client.render.tile; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; import cpw.mods.fml.client.FMLClientHandler; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; @@ -60,15 +61,26 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { GL11.glPushMatrix(); GL11.glColor4f(1F, 1F, 1F, 1F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) 100, (float) 100); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 150f, 150f); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslated(x+0.5, y+0.5, z+0.5); FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture); + + //float colour = (float)(Minecraft.getSystemTime()%10000) / 10000f; + //double colour = Math.sin((float)Minecraft.getSystemTime() / 10000f); + double colour = ((TileEnergyStorageCore) tile).getEnergyStored() / ((TileEnergyStorageCore) tile).getMaxEnergyStored(); + float brightness = (float)Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 150f); + + colour = 1f - colour; + //LogHelper.info(colour + " " + ((TileEnergyStorageCore) tile).getEnergyStored() +" "+ ((TileEnergyStorageCore) tile).getMaxEnergyStored()); + //GL11.glColor4d(1F, 0.3F, 0.7f, 1F); GL11.glScalef(scale, scale, scale); GL11.glPushMatrix(); GL11.glRotatef(rotation, 0F, 1F, 0.5F); + GL11.glColor4d(1F, colour * 0.3f, colour * 0.7f, 1F); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 50f + brightness, 50f + brightness); iner_model.renderAll(); GL11.glPopMatrix(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java index b47f2493..4dcd34ec 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java @@ -1,24 +1,35 @@ package com.brandon3055.draconicevolution.client.render.tile; import com.brandon3055.draconicevolution.client.model.ModelTeleporterStand; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; +import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utills.Utills; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import java.awt.*; + /** * Created by Brandon on 25/10/2014. */ -public class RenderTileTeleporterStand extends TileEntitySpecialRenderer{//TODO Render name abouve stand +public class RenderTileTeleporterStand extends TileEntitySpecialRenderer{ ModelTeleporterStand model = new ModelTeleporterStand(); @@ -27,6 +38,7 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer{//TODO @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { + ItemStack item = null; int rotation = 0; if (tileentity instanceof TileTeleporterStand){ @@ -36,9 +48,8 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer{//TODO GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslatef((float) x, (float) y, (float) z); - + GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glTranslatef(0.5F, 0.5F, 0.5F); @@ -46,16 +57,18 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer{//TODO GL11.glRotated(rotation, 0, 1, 0); model.render(); + if (item != null) drawNameString(item, rotation, tileentity, f); GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glTranslatef(0F, 0F, -0.6F); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); if (item != null) renderItem(tileentity, item, f); GL11.glPopMatrix(); + } public void renderItem(TileEntity tile, ItemStack item, float f){ + if (item.getItem() == null) return; GL11.glPushMatrix(); EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, item); @@ -79,4 +92,77 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer{//TODO GL11.glPopMatrix(); } + + private void drawNameString(ItemStack item, float rotation, TileEntity tileentity, float f){ + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + MovingObjectPosition mop = player.rayTrace(10, f); + boolean isCursorOver = mop.blockX == tileentity.xCoord && mop.blockY == tileentity.yCoord && mop.blockZ == tileentity.zCoord; + boolean isSneaking = player.isSneaking(); + + if (!isCursorOver && (isSneaking != ConfigHandler.invertDPDSB)) return; + + + String s = item.hasDisplayName() ? item.getDisplayName() : ""; + if (item.getItem() instanceof TeleporterMKII) + { + short selected = ItemNBTHelper.getShort(item, "Selection", (short) 0); + int selrctionOffset = ItemNBTHelper.getInteger(item, "SelectionOffset", 0); + NBTTagCompound compound = item.getTagCompound(); + if(compound == null) compound = new NBTTagCompound(); + NBTTagList list = (NBTTagList)compound.getTag("Locations"); + if (list == null) list = new NBTTagList(); + s = list.getCompoundTagAt(selected+selrctionOffset).getString("Name"); + } + if (s.isEmpty()) return; + + + FontRenderer fontRenderer = RenderManager.instance.getFontRenderer(); + Tessellator tess = Tessellator.instance; + + GL11.glPushMatrix(); + GL11.glScalef(0.02f, 0.02f, 0.02f); + GL11.glRotated(180, 0, 1, 0); + GL11.glTranslated(0, -40, 0); + + + + Point.Double p1 = new Point.Double(tileentity.xCoord+0.5, tileentity.zCoord+0.5); + Point.Double p2 = new Point.Double(player.posX, player.posZ); + + double xDiff = player.posX - (tileentity.xCoord+0.5); + double yDiff = player.posY - (tileentity.yCoord+0.5); + double zDiff = player.posZ - (tileentity.zCoord+0.5); + double yawAngle = Math.toDegrees(Math.atan2(zDiff, xDiff)); + double pitchAngle = Math.toDegrees(Math.atan2(yDiff, Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, tileentity.xCoord+0.5, tileentity.yCoord+0.5, tileentity.zCoord+0.5))); + + GL11.glRotated(yawAngle + 90 - rotation, 0, 1, 0); + GL11.glRotated(-pitchAngle, 1, 0, 0); + + int xmin = -1 - fontRenderer.getStringWidth(s)/2; + int xmax = 1 + fontRenderer.getStringWidth(s)/2; + int ymin = -1; + int ymax = fontRenderer.FONT_HEIGHT; + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(0f, 0f, 0f, 0.5f); + + tess.startDrawingQuads(); + tess.addVertexWithUV(xmin, ymax, 0, xmin/64, 1); + tess.addVertexWithUV(xmax, ymax, 0, xmax/64, 1); + tess.addVertexWithUV(xmax, ymin, 0, xmax/64, 0.75); + tess.addVertexWithUV(xmin, ymin, 0, xmin/64, 0.75); + tess.draw(); + + GL11.glDisable(GL11.GL_BLEND); + GL11.glTranslated(0, 0, -0.1); + GL11.glColor4f(1f, 1f, 1f, 1f); + GL11.glDisable(GL11.GL_LIGHTING); + + fontRenderer.drawString(s, -fontRenderer.getStringWidth(s)/2, 0, 0xffffff); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java index ae2eaf1f..218f94a8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java @@ -30,6 +30,7 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import net.minecraft.potion.Potion; +import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.MinecraftForge; import java.lang.reflect.Field; @@ -102,6 +103,8 @@ public class CommonProxy { DraconicEvolution.network.registerMessage(PlayerDetectorStringPacket.Handler.class, PlayerDetectorStringPacket.class, 4, Side.SERVER); DraconicEvolution.network.registerMessage(TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER); DraconicEvolution.network.registerMessage(ObjectPacket.Handler.class, ObjectPacket.class, 6, Side.CLIENT); + DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT); + DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER); } public void registerTileEntities() { @@ -132,6 +135,8 @@ public class CommonProxy { public void registerEventListeners(Side s) { MinecraftForge.EVENT_BUS.register(new MinecraftForgeEventHandler()); + MinecraftForge.EVENT_BUS.register(new Achievements()); + FMLCommonHandler.instance().bus().register(new Achievements()); FMLCommonHandler.instance().bus().register(new FMLEventHandler()); } @@ -151,4 +156,10 @@ public class CommonProxy { EntityRegistry.registerModEntity(EntityChaosDrill.class, "Chaos Drill", 4, DraconicEvolution.instance, 10, 5, false); EntityRegistry.registerModEntity(EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true); } + + public boolean isClientSide(){return false;} + + public MinecraftServer getMCServer(){ + return FMLCommonHandler.instance().getMinecraftServerInstance(); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java b/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java index 284d1188..b530c6a5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java @@ -21,9 +21,9 @@ import net.minecraftforge.common.util.EnumHelper; public class ModItems { public static ArmorMaterial DRACONIUMARMOR_T1 = EnumHelper.addArmorMaterial("DRACONIUMARMOR_T1", -1, new int[] { 3, 8, 6, 3 }, 30); public static ArmorMaterial DRACONIUMARMOR_T2 = EnumHelper.addArmorMaterial("DRACONIUMARMOR_T2", -1, new int[] { 3, 8, 6, 3 }, 30); - public static ToolMaterial DRACONIUM_T1 = EnumHelper.addToolMaterial("DRACONIUM_T1", 4, -1, 12.0F, 11.0F, 35); - public static ToolMaterial DRACONIUM_T2 = EnumHelper.addToolMaterial("DRACONIUM_T2", 4, -1, 16.0F, 15.0F, 40); - public static ToolMaterial DRACONIUM_T3 = EnumHelper.addToolMaterial("DRACONIUM_T3", 4, -1, 400.0F, 20.0F, 45); + public static ToolMaterial DRACONIUM_T1 = EnumHelper.addToolMaterial("DRACONIUM_T1", 10, -1, 12.0F, 11.0F, 35); + public static ToolMaterial DRACONIUM_T2 = EnumHelper.addToolMaterial("DRACONIUM_T2", 10, -1, 16.0F, 15.0F, 40); + public static ToolMaterial DRACONIUM_T3 = EnumHelper.addToolMaterial("DRACONIUM_T3", 10, -1, 400.0F, 20.0F, 45); public static Item draconicPickaxe; public static Item draconicShovel; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java b/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java index 7f5b4d71..73793e63 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java @@ -1,10 +1,17 @@ package com.brandon3055.draconicevolution.common.achievements; +import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; import net.minecraft.util.StatCollector; import net.minecraftforge.common.AchievementPage; +import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import java.util.HashMap; @@ -15,10 +22,22 @@ public class Achievements { private static AchievementPage achievementsPage; private static HashMap achievementsList = new HashMap(); + private static HashMap achievementItems = new HashMap(); + + public static void addAchievement (String name, Achievement achievement, ItemStack stack, String triggerCondition) + { + achievementsList.put(name, achievement.registerStat()); + achievementItems.put(stack.getUnlocalizedName(), new AchievementCondition(name, triggerCondition)); + } + + public static void addAchievement (String name, Achievement achievement, String triggerCondition) + { + addAchievement(name, achievement, achievement.theItemStack, triggerCondition); + } public static void addAchievement (String name, Achievement achievement) { - achievementsList.put(name, achievement.registerStat()); + addAchievement(name, achievement, achievement.theItemStack, "null"); } public static Achievement getAchievement (String name) @@ -39,20 +58,58 @@ public class Achievements { public static void addModAchievements() { - addAchievement("draconicevolution.dust", new Achievement("draconicevolution.dust", "draconicevolution.dust", 0, 0, ModItems.draconiumDust, null).initIndependentStat()); //Mine Draconium Ore (pick up dust) - addAchievement("draconicevolution", new Achievement("draconicevolution", "draconicevolution", 2, 1, ModItems.draconiumDust, getAchievement("draconicevolution"))); + int x = 5; + addAchievement("draconicevolution.dust", new Achievement("draconicevolution.dust", "draconicevolution.dust", -10+x, 0, ModItems.draconiumDust, null).initIndependentStat().setSpecial(), "pickup"); + addAchievement("draconicevolution.ingot", new Achievement("draconicevolution.ingot", "draconicevolution.ingot", -8+x, 0, ModItems.draconiumIngot, getAchievement("draconicevolution.dust")), "smelt"); + addAchievement("draconicevolution.core", new Achievement("draconicevolution.core", "draconicevolution.core", -6+x, 0, ModItems.draconicCore, getAchievement("draconicevolution.ingot")), "craft"); + addAchievement("draconicevolution.core2", new Achievement("draconicevolution.core2", "draconicevolution.core2", -4+x, 0, ModItems.wyvernCore, getAchievement("draconicevolution.core")).setSpecial(), "craft"); + addAchievement("draconicevolution.dislocator", new Achievement("draconicevolution.dislocator", "draconicevolution.dislocator", -8+x, 1, ModItems.teleporterMKI, getAchievement("draconicevolution.dust")), "craft"); + addAchievement("draconicevolution.chest", new Achievement("draconicevolution.chest", "draconicevolution.chest", -5+x, 2, ModBlocks.draconiumChest, getAchievement("draconicevolution.core")), "craft"); + addAchievement("draconicevolution.particles", new Achievement("draconicevolution.particles", "draconicevolution.particles", -7+x, 2, ModBlocks.particleGenerator, getAchievement("draconicevolution.core")), "craft"); + addAchievement("draconicevolution.weather", new Achievement("draconicevolution.weather", "draconicevolution.weather", -5+x, -2, ModBlocks.weatherController, getAchievement("draconicevolution.core")), "craft"); + addAchievement("draconicevolution.dissenchanter", new Achievement("draconicevolution.dissenchanter", "draconicevolution.dissenchanter", -7+x, -2, ModBlocks.dissEnchanter, getAchievement("draconicevolution.core")), "craft"); + addAchievement("draconicevolution.ecore", new Achievement("draconicevolution.ecore", "draconicevolution.ecore", -4+x, -6, ModBlocks.energyStorageCore, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.wpick", new Achievement("draconicevolution.wpick", "draconicevolution.wpick", -2+x, 1, ModItems.wyvernPickaxe, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.wshovel", new Achievement("draconicevolution.wshovel", "draconicevolution.wshovel", -2+x, -1, ModItems.wyvernShovel, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.wsword", new Achievement("draconicevolution.wsword", "draconicevolution.wsword", -2+x, 2, ModItems.wyvernSword, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.wbow", new Achievement("draconicevolution.wbow", "draconicevolution.wbow", -2+x, -2, ModItems.wyvernBow, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.whelm", new Achievement("draconicevolution.whelm", "draconicevolution.whelm", -2+x, -4, ModItems.wyvernHelm, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.wchest", new Achievement("draconicevolution.wchest", "draconicevolution.wchest", -2+x, -3, ModItems.wyvernChest, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.wleggs", new Achievement("draconicevolution.wleggs", "draconicevolution.wleggs", -2+x, 3, ModItems.wyvernLeggs, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.wboots", new Achievement("draconicevolution.wboots", "draconicevolution.wboots", -2+x, 4, ModItems.wyvernBoots, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.resurrection", new Achievement("draconicevolution.resurrection", "draconicevolution.resurrection", -4+x, 6, ModBlocks.resurrectionStone, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.dislocator2", new Achievement("draconicevolution.dislocator2", "draconicevolution.dislocator2", -2+x, -5, ModItems.teleporterMKII, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.flux", new Achievement("draconicevolution.flux", "draconicevolution.flux", -2+x, 5, ModItems.wyvernFluxCapacitor, getAchievement("draconicevolution.core2")), "craft"); + addAchievement("draconicevolution.heart", new Achievement("draconicevolution.heart", "draconicevolution.heart", 0+x, 0, ModItems.dragonHeart, getAchievement("draconicevolution.core2")).setSpecial(), "pickup"); + addAchievement("draconicevolution.awakenedblock", new Achievement("draconicevolution.awakenedblock", "draconicevolution.awakenedblock", 2+x, 0, ModBlocks.draconicBlock, getAchievement("draconicevolution.heart")), "pickup"); + addAchievement("draconicevolution.core3", new Achievement("draconicevolution.core3", "draconicevolution.core3", 4+x, 0, ModItems.awakenedCore, getAchievement("draconicevolution.awakenedblock")).setSpecial(), "craft"); + + addAchievement("draconicevolution.dhelm", new Achievement("draconicevolution.dhelm", "draconicevolution.dhelm", 2+x, -3, ModItems.draconicHelm, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.dChest", new Achievement("draconicevolution.dChest", "draconicevolution.dChest", 2+x, -2, ModItems.draconicChest, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.dleggs", new Achievement("draconicevolution.dleggs", "draconicevolution.dleggs", 2+x, 2, ModItems.draconicLeggs, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.dboots", new Achievement("draconicevolution.dboots", "draconicevolution.dboots", 2+x, 3, ModItems.draconicBoots, getAchievement("draconicevolution.core3")), "craft"); + + addAchievement("draconicevolution.dpick", new Achievement("draconicevolution.dpick", "draconicevolution.dpick", 6+x, 0, ModItems.draconicPickaxe, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.dshovel", new Achievement("draconicevolution.dshovel", "draconicevolution.dshovel", 6+x, -1, ModItems.draconicShovel, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.daxe", new Achievement("draconicevolution.daxe", "draconicevolution.daxe", 6+x, 1, ModItems.draconicAxe, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.dsword", new Achievement("draconicevolution.dsword", "draconicevolution.dsword", 6+x, -2, ModItems.draconicSword, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.dbow", new Achievement("draconicevolution.dbow", "draconicevolution.dbow", 6+x, 2, ModItems.draconicBow, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.flux2", new Achievement("draconicevolution.flux2", "draconicevolution.flux2", 6+x, -3, ModItems.draconicFluxCapacitor, getAchievement("draconicevolution.core3")), "craft"); + addAchievement("draconicevolution.dhoe", new Achievement("draconicevolution.dhoe", "draconicevolution.dhoe", 6+x, 3, ModItems.draconicHoe, getAchievement("draconicevolution.core3")), "craft"); + + addAchievement("draconicevolution.dstaff", new Achievement("draconicevolution.dstaff", "draconicevolution.dstaff", 8+x, 0, ModItems.draconicDestructionStaff, getAchievement("draconicevolution.dpick")).setSpecial(), "craft"); + + ItemStack mobSoul = new ItemStack(ModItems.mobSoul); + ItemNBTHelper.setString(mobSoul, "Name", "Any"); + addAchievement("draconicevolution.soul", new Achievement("draconicevolution.soul", "draconicevolution.soul", 0+x, -2, mobSoul, null).initIndependentStat(), "null"); + if (ConfigHandler.disableSunDial == 0)addAchievement("draconicevolution.sundial", new Achievement("draconicevolution.sundial", "draconicevolution.sundial", 4+x, -4, ModBlocks.sunDial, getAchievement("draconicevolution.core3")).setSpecial(), "craft"); + addAchievement("draconicevolution.manual", new Achievement("draconicevolution.manual", "draconicevolution.manual", -8+x, -1, ModItems.infoTablet, getAchievement("draconicevolution.dust")), "craft"); -// addAchievement("tconstruct.pattern", new Achievement("tconstruct.pattern", "tconstruct.pattern", 2, 1, TinkerTools.blankPattern, getAchievement("tconstruct.beginner"))); -// addAchievement("tconstruct.tinkerer", new Achievement("tconstruct.tinkerer", "tconstruct.tinkerer", 2, 2, new ItemStack(TinkerTools.titleIcon, 1, 4096), getAchievement("tconstruct.pattern"))); -// addAchievement("tconstruct.preparedFight", new Achievement("tconstruct.preparedFight", "tconstruct.preparedFight", 1, 3, new ItemStack(TinkerTools.titleIcon, 1, 4097), getAchievement("tconstruct.tinkerer"))); -// addAchievement("tconstruct.proTinkerer", new Achievement("tconstruct.proTinkerer", "tconstruct.proTinkerer", 4, 3, new ItemStack(TinkerTools.titleIcon, 1, 4098), getAchievement("tconstruct.tinkerer"))); -// addAchievement("tconstruct.smelteryMaker", new Achievement("tconstruct.smelteryMaker", "tconstruct.smelteryMaker", -2, -1, TinkerSmeltery.smeltery, getAchievement("tconstruct.beginner"))); -// addAchievement("tconstruct.enemySlayer", new Achievement("tconstruct.enemySlayer", "tconstruct.enemySlayer", 0, 5, new ItemStack(TinkerTools.titleIcon, 1, 4099), getAchievement("tconstruct.preparedFight"))); -// addAchievement("tconstruct.dualConvenience", new Achievement("tconstruct.dualConvenience", "tconstruct.dualConvenience", 0, 7, new ItemStack(TinkerTools.titleIcon, 1, 4100), getAchievement("tconstruct.enemySlayer")).setSpecial()); } + public static void registerAchievementPane () { Achievement[] achievements = new Achievement[achievementsList.size()]; @@ -61,4 +118,45 @@ public class Achievements { achievementsPage = new AchievementPage(StatCollector.translateToLocal("draconicevolution.achievementPage.name"), achievements); AchievementPage.registerAchievementPage(achievementsPage); } + + @SubscribeEvent + public void entityPickupEvent(EntityItemPickupEvent event){ + ItemStack stack = event.item.getEntityItem().copy(); + stack.stackSize = 1; + if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("pickup")){ + triggerAchievement(event.entityPlayer, achievementItems.get(stack.getUnlocalizedName()).getName()); + } + } + + @SubscribeEvent + public void craftEvent(PlayerEvent.ItemCraftedEvent event){ + ItemStack stack = event.crafting.copy(); + stack.stackSize = 1; + if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("craft")){ + triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); + } + } + + @SubscribeEvent + public void smeltEvent(PlayerEvent.ItemSmeltedEvent event){ + ItemStack stack = event.smelting.copy(); + stack.stackSize = 1; + if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("smelt")){ + triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); + } + } + + private static class AchievementCondition { + private final String name; + public final String condition; + public AchievementCondition(String name, String condition){ + this.name = name; + this.condition = condition; + } + + public boolean isCorrectCondition(String s) { return s.equals(condition); } + + public String getName() { return name; } + } + } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java index 4f44008d..56b52f09 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java @@ -2,18 +2,17 @@ package com.brandon3055.draconicevolution.common.blocks; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; +import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; 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; @@ -63,17 +62,12 @@ public class CustomSpawner extends BlockDE{ world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; - }else if (item != null && item.getItem().equals(ModItems.wyvernCore) && spawner.getBaseLogic().spawnSpeed == 0){ - spawner.getBaseLogic().setSpawnRate(1); - world.markBlockForUpdate(x, y, z); - item.splitStack(1); - return true; - }else if (item != null && item.getItem().equals(ModItems.awakenedCore) && spawner.getBaseLogic().spawnSpeed == 1){ + }else if (item != null && item.getItem().equals(ModItems.wyvernCore) && spawner.getBaseLogic().spawnSpeed == 1){ spawner.getBaseLogic().setSpawnRate(2); world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; - }else if (item != null && item.getItem().equals(Item.getItemFromBlock(Blocks.dragon_egg)) && spawner.getBaseLogic().spawnSpeed == 2){ + }else if (item != null && item.getItem().equals(ModItems.awakenedCore) && spawner.getBaseLogic().spawnSpeed == 2){ spawner.getBaseLogic().setSpawnRate(3); world.markBlockForUpdate(x, y, z); item.splitStack(1); @@ -100,7 +94,6 @@ public class CustomSpawner extends BlockDE{ player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo7.txt")); player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo8.txt")); player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo9.txt")); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo10.txt")); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); } return true; @@ -172,6 +165,8 @@ public class CustomSpawner extends BlockDE{ return new ItemStack(ModBlocks.customSpawner); } + + @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) { TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner)world.getTileEntity(x, y, z) : null; @@ -187,7 +182,7 @@ public class CustomSpawner extends BlockDE{ item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; world.spawnEntityInWorld(item); } - if (spawner.getBaseLogic().spawnSpeed > 0) + if (spawner.getBaseLogic().spawnSpeed > 1) { EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.wyvernCore)); item.motionX = (-0.5F + world.rand.nextFloat()) * multiplyer; @@ -195,17 +190,9 @@ public class CustomSpawner extends BlockDE{ item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; world.spawnEntityInWorld(item); } - if (spawner.getBaseLogic().spawnSpeed > 1) - { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.awakenedCore)); - item.motionX = (-0.5F + world.rand.nextFloat()) * multiplyer; - item.motionY = (4 + world.rand.nextFloat()) * multiplyer; - item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; - world.spawnEntityInWorld(item); - } if (spawner.getBaseLogic().spawnSpeed > 2) { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(Item.getItemFromBlock(Blocks.dragon_egg))); + EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.awakenedCore)); item.motionX = (-0.5F + world.rand.nextFloat()) * multiplyer; item.motionY = (4 + world.rand.nextFloat()) * multiplyer; item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java index 9688d691..03aad30a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java @@ -23,7 +23,7 @@ import java.util.List; /** * Created by Brandon on 25/07/2014. */ -public class DraconiumBlock extends BlockDE {//todo new description +public class DraconiumBlock extends BlockDE { private final int DRACONIUM_META = 0; private final int SUMMON_BLOCK_META = 1; private final int CHARGED_DRACONIUM_META = 2; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java index 9af8257e..8ba9bdcd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java @@ -81,7 +81,7 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer return icon_active_face; TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; if (thisTile == null) return icon_input; - return thisTile.input ? icon_output : icon_input; + return !thisTile.reciveEnergy ? icon_output : icon_input; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java index 8df1b3e7..a6346070 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java @@ -110,7 +110,7 @@ public class InvisibleMultiblock extends BlockDE { } else if (meta == 2) { TileEnergyPylon pylon = (world.getTileEntity(x, y+1, z) != null && world.getTileEntity(x, y+1, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y+1, z) : (world.getTileEntity(x, y-1, z) != null && world.getTileEntity(x, y-1, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y-1, z) : null; if (pylon == null) return false; - pylon.input = !pylon.input; + pylon.reciveEnergy = !pylon.reciveEnergy; world.markBlockForUpdate(pylon.xCoord, pylon.yCoord, pylon.zCoord); pylon.onActivated(); return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java index 04b5bbfe..419e4e26 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java @@ -61,7 +61,7 @@ public class EntityDragonHeart extends Entity { @Override public boolean attackEntityFrom(DamageSource damageSource, float dmg) { - setDead(); + return false; } @@ -75,6 +75,9 @@ public class EntityDragonHeart extends Entity { rotationInc = getDataWatcher().getWatchableObjectFloat(12); coresConsumed = getDataWatcher().getWatchableObjectInt(13); opPhase = getDataWatcher().getWatchableObjectInt(14); + motionX = 0; + motionZ = 0; + motionY = 0; age++; @@ -100,7 +103,11 @@ public class EntityDragonHeart extends Entity { age = 1240; opPhase = 3; if (coresConsumed < 4){ - if (!worldObj.isRemote) worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart))); + EntityPersistentItem item = new EntityPersistentItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart)); + item.motionX = 0; + item.motionY = 0; + item.motionZ = 0; + if (!worldObj.isRemote) worldObj.spawnEntityInWorld(item); this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); this.setDead(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java index 80346209..c31eb5a8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java @@ -1,11 +1,16 @@ package com.brandon3055.draconicevolution.common.entity; import com.brandon3055.draconicevolution.common.items.DragonHeart; +import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.item.ItemExpireEvent; /** * Created by Brandon on 15/08/2014. @@ -58,6 +63,105 @@ public class EntityPersistentItem extends EntityItem { @Override public void onUpdate() { if (age+10 >= lifespan) age = 0; - super.onUpdate(); + boolean flag2 = false; + if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY-1), MathHelper.floor_double(this.posZ)) == Blocks.end_portal) flag2 = true; + ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); + if (stack != null && stack.getItem() != null) + { + if (stack.getItem().onEntityItemUpdate(this)) + { + return; + } + } + + if (this.getEntityItem() == null) + { + this.setDead(); + } + else + { + super.onEntityUpdate(); + + if (this.delayBeforeCanPickup > 0) + { + --this.delayBeforeCanPickup; + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + if (flag2) + { + motionX = 0; + motionY = 0; + motionZ = 0; + } + this.noClip = this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + boolean flag = (int)this.prevPosX != (int)this.posX || (int)this.prevPosY != (int)this.posY || (int)this.prevPosZ != (int)this.posZ; + + if (flag || this.ticksExisted % 25 == 0) + { + if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) + { + this.motionY = 0.20000000298023224D; + this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); + } + } + + float f = 0.98F; + + if (this.onGround) + { + f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F; + } + + this.motionX *= (double)f; + this.motionY *= 0.9800000190734863D; + this.motionZ *= (double)f; + if (flag2) + { + motionX = 0; + motionY = 0; + motionZ = 0; + } + + if (this.onGround) + { + this.motionY *= -0.5D; + } + + ++this.age; + + ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); + + if (!this.worldObj.isRemote && this.age >= lifespan) + { + if (item != null) + { + ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); + if (MinecraftForge.EVENT_BUS.post(event)) + { + lifespan += event.extraLife; + } + else + { + this.setDead(); + } + } + else + { + this.setDead(); + } + } + + if (item != null && item.stackSize <= 0) + { + this.setDead(); + } + } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java index d8f83474..5570274b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java @@ -23,6 +23,7 @@ public class ConfigHandler { public static boolean bowBlockDamage; public static boolean showUnlocalizedNames; public static boolean disableLore; + public static boolean invertDPDSB; //spawner public static String[] spawnerList; @@ -70,6 +71,7 @@ public class ConfigHandler { generateChaosIslands = config.get(Configuration.CATEGORY_GENERAL, "Generate Chaos Islands", true, "Should Chaos Islands be generated").getBoolean(true); pigmenBloodRage = config.get(Configuration.CATEGORY_GENERAL, "Pigmen Blood Rage", true, "Is Pigmen blood rage active").getBoolean(true); disableLore = config.get(Configuration.CATEGORY_GENERAL, "Disable Item Lore", false, "Set to true to disable all item lore").getBoolean(false); + invertDPDSB = config.get(Configuration.CATEGORY_GENERAL, "InvertDPDSB", false, "Invert Dislocator Pedestal display name shift behavior").getBoolean(false); //Spawner spawnerListType = config.get("spawner", "listType", false, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)").getBoolean(false); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java index 7c786a0d..e86d61f9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java @@ -81,7 +81,7 @@ public class CraftingHandler { //machines adv add(ModBlocks.resurrectionStone, "CSC", "SMS", "CSC", 'C', mobSoul, 'S', ModItems.wyvernCore, 'M', new ItemStack(ModBlocks.draconiumBlock, 1, 0)); - add(ModBlocks.energyStorageCore, "CSC", "SMS", "CSC", 'C', ModItems.draconiumIngot, 'S', ModItems.wyvernEnergyCore, 'M', ModItems.wyvernCore); + add(ModBlocks.energyStorageCore, "CCC", "SMS", "CCC", 'C', ModItems.draconiumIngot, 'S', ModItems.wyvernEnergyCore, 'M', ModItems.wyvernCore); add(ModBlocks.weatherController, "RIR", "TPT", "IEI", 'R', Items.blaze_rod, 'T', Blocks.tnt, 'P', ModItems.draconicCore, 'I', ModItems.draconiumIngot, 'E', Blocks.enchanting_table); add(ModBlocks.playerDetectorAdvanced, "ISI", "EDE", "ICI", 'I', ModItems.draconiumIngot, 'E', Items.ender_eye, 'S', new ItemStack(Items.skull, 1, 1), 'C', Items.compass, 'D', ModBlocks.playerDetector); add(ModBlocks.energyInfuser, "IPI", "CEC", "ICI", 'I', ModItems.draconiumIngot, 'P', ModBlocks.particleGenerator, 'C', ModItems.draconicCore, 'E', Blocks.enchanting_table); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java index 22c99330..9e5a3879 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java @@ -1,15 +1,23 @@ package com.brandon3055.draconicevolution.common.handler; +import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.achievements.Achievements; import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon; +import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart; import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler; +import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.ReflectionHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -24,18 +32,22 @@ import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.List; import java.util.Random; @@ -43,6 +55,7 @@ import java.util.Random; public class MinecraftForgeEventHandler { Random random = new Random(); + private static Method becomeAngryAt; @SubscribeEvent public void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) { @@ -71,7 +84,6 @@ public class MinecraftForgeEventHandler { if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && (ArmorEffectHandler.isWyvernArmor(player, 4) || ArmorEffectHandler.isDraconicArmor(player, 4))) { if (event.ammount <= 2f) event.setCanceled(true); - LogHelper.info("drown"+event.ammount); } } @@ -79,9 +91,18 @@ public class MinecraftForgeEventHandler { public void onDropEvent(LivingDropsEvent event) { if (event.entity instanceof EntityDragon && !event.entity.worldObj.isRemote) { EntityItem item = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(ModItems.dragonHeart)); - event.entity.worldObj.spawnEntityInWorld(item); + //event.entity.worldObj.spawnEntityInWorld(item); + event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart(event.entity.worldObj, ((int) event.entity.posX) + 0.5, event.entity.posY, ((int) event.entity.posZ) + 0.5)); if (event.entity instanceof EntityCustomDragon && ((EntityCustomDragon) event.entity).getIsUber()) - event.entity.worldObj.spawnEntityInWorld(item); + event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart(event.entity.worldObj, event.entity.posX, event.entity.posY+2, event.entity.posZ)); + //event.entity.worldObj.spawnEntityInWorld(item); + + for (Object o : event.entity.worldObj.playerEntities) + { + LogHelper.info(o); + if (o instanceof EntityPlayer) ((EntityPlayer)o).addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt"))); + + } int count = 30 + event.entity.worldObj.rand.nextInt(30); for (int i = 0; i < count; i++) { @@ -120,6 +141,7 @@ public class MinecraftForgeEventHandler { ItemNBTHelper.setString(soul, "Name", name); if (entity instanceof EntitySkeleton) ItemNBTHelper.setInteger(soul, "SkeletonType", ((EntitySkeleton)entity).getSkeletonType()); world.spawnEntityInWorld(new EntityItem(world, entity.posX, entity.posY, entity.posZ, soul)); + Achievements.triggerAchievement((EntityPlayer) attacker, "draconicevolution.soul"); } } @@ -207,23 +229,44 @@ public class MinecraftForgeEventHandler { boolean flag = false; - for (int i = 0; i < list.size(); ++i) {//TODO tidy up and use for each aswell as reflection to access becomeAngryAt - Entity entity1 = (Entity) list.get(i); + for (Object o : list) { + if (o instanceof EntityPigZombie) + { + EntityPigZombie zombie = (EntityPigZombie) o; + if (becomeAngryAt == null) + { + becomeAngryAt = ReflectionHelper.findMethod(EntityPigZombie.class, zombie, new String[]{"becomeAngryAt", "func_70835_c"}, Entity.class); + becomeAngryAt.setAccessible(true); + } - if (entity1 instanceof EntityPigZombie) { - EntityPigZombie entitypigzombie = (EntityPigZombie) entity1; - NBTTagCompound compound = new NBTTagCompound(); - entitypigzombie.writeEntityToNBT(compound); - compound.setShort("Anger", (short) 1000); - entitypigzombie.readEntityFromNBT(compound); - if (Math.abs(entitypigzombie.posX - player.posX) < 14 && Math.abs(entitypigzombie.posY - player.posY) < 14 && Math.abs(entitypigzombie.posZ - player.posZ) < 14) - flag = true; - entitypigzombie.addPotionEffect(new PotionEffect(5, 10000, 3)); - entitypigzombie.addPotionEffect(new PotionEffect(11, 10000, 2)); + try + { + becomeAngryAt.invoke(zombie, player); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (InvocationTargetException e) + { + e.printStackTrace(); + } + + if (Math.abs(zombie.posX - player.posX) < 14 && Math.abs(zombie.posY - player.posY) < 14 && Math.abs(zombie.posZ - player.posZ) < 14) flag = true; + zombie.addPotionEffect(new PotionEffect(5, 10000, 3)); + zombie.addPotionEffect(new PotionEffect(11, 10000, 2)); } } if (flag) player.addPotionEffect(new PotionEffect(2, 500, 3)); } } + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public void joinWorld(EntityJoinWorldEvent event){ + if (event.entity instanceof EntityPlayerSP) { + DraconicEvolution.network.sendToServer(new MountUpdatePacket(0)); + } + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java index 6ebe9a69..78c15a7d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java @@ -5,7 +5,7 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; import net.minecraft.item.ItemStack; -public class AwakenedCore extends ItemDE {//todo new description +public class AwakenedCore extends ItemDE { public AwakenedCore() { this.setUnlocalizedName(Strings.draconicCompoundName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java index 20d0a379..55d85e7f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java @@ -15,7 +15,7 @@ import net.minecraft.world.World; import java.util.List; -public class DraconicCore extends ItemDE {//todo new description +public class DraconicCore extends ItemDE { public DraconicCore() { this.setUnlocalizedName(Strings.draconicCoreName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java index b84f0fe2..406df654 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java @@ -7,7 +7,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; /** * Created by Brandon on 21/11/2014. */ -public class DraconicIngot extends ItemDE {//todo new description +public class DraconicIngot extends ItemDE { public DraconicIngot() { this.setUnlocalizedName(Strings.draconicIngotName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java index b6308424..92374724 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java @@ -8,7 +8,7 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class DragonHeart extends ItemDE {//todo new description +public class DragonHeart extends ItemDE { public DragonHeart() { this.setUnlocalizedName(Strings.dragonHeartName); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java index c56909a0..067246e0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java @@ -1,14 +1,18 @@ package com.brandon3055.draconicevolution.common.items; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.ClientProxy; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.achievements.Achievements; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityZombie; 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.item.EnumAction; @@ -21,6 +25,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; import java.util.List; public class Tclogo extends ItemDE { @@ -81,7 +90,43 @@ public class Tclogo extends ItemDE { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - + LogHelper.info(player.ridingEntity); + if (!world.isRemote)DraconicEvolution.network.sendTo(new MountUpdatePacket(player.ridingEntity.getEntityId()), (EntityPlayerMP)player); + if (1==1) return stack; +// Set set = Achievements.achievementsList.keySet(); +// for (String s : set) Achievements.triggerAchievement(player, s); + + + + LogHelper.info("Downloading Image"); + + try { + URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); + String fileName = url.getFile(); + String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/")); + System.out.println(destName); + + InputStream is = url.openStream(); + OutputStream os = new FileOutputStream(destName); + + byte[] b = new byte[2048]; + int length; + + while ((length = is.read(b)) != -1) { + os.write(b, 0, length); + } + + is.close(); + os.close(); + }catch (IOException e){ + LogHelper.info(e); + } + + + + + + if (world.isRemote) return stack; if (1 == 1) return stack; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java index 09e971f0..f2768e63 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java @@ -4,7 +4,7 @@ import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; -public class WyvernCore extends ItemDE {//todo new description +public class WyvernCore extends ItemDE { public WyvernCore() { this.setUnlocalizedName(Strings.infusedCompoundName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java index 1e370162..9355635b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java @@ -29,7 +29,7 @@ import java.util.List; /** * Created by Brandon on 3/07/2014. */ -public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem{//TODO reconsider fall damage energy adjust fall damage from jumping and jump energy usage +public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem{ private IIcon helmIcon; private IIcon chestIcon; private IIcon leggsIcon; @@ -147,7 +147,9 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont @Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - return (int)(getAbsorptionPercent() * 20D); + return this.getEnergyStored(armor) > 10000 ? (int)(getAbsorptionPercent() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getAbsorptionPercent() * 20D)); + + // return (int)(getAbsorptionPercent() * 20D); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java index b25b5e40..81c18cdb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java @@ -7,11 +7,13 @@ import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.utills.Teleporter; +import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -25,8 +27,10 @@ import net.minecraft.world.WorldProvider; import java.util.List; -public class TeleporterMKI extends ItemDE -{ +public class TeleporterMKI extends ItemDE { + + public TeleporterMKI(boolean MKII) { + } public TeleporterMKI() { this.setUnlocalizedName(Strings.teleporterMKIName); @@ -34,71 +38,49 @@ public class TeleporterMKI extends ItemDE this.setMaxDamage(19); this.setMaxStackSize(1); ModItems.register(this); - //this.setContainerItem(this); - //GameRegistry.registerItem(this, Strings.teleporterMKIName); } @Override @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister iconRegister) - { + public void registerIcons(final IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + Strings.teleporterMKIName); } @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { - boolean isSet = ItemNBTHelper.getBoolean(stack, "IsSet", false); - double x = ItemNBTHelper.getDouble(stack, "X", 0); - double y = ItemNBTHelper.getDouble(stack, "Y", 0); - double z = ItemNBTHelper.getDouble(stack, "Z", 0); - int dim = ItemNBTHelper.getInteger(stack, "Dimension", 0); - - if (!(entity instanceof EntityPlayer) && !(entity instanceof IBossDisplayData)) + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { + if (getLocation(stack) == null) { - if (entity.dimension == dim) - { - if (isSet) - { - if (player.getHealth() > 2 || player.capabilities.isCreativeMode) - { - stack.damageItem(1, player); - if (!player.capabilities.isCreativeMode) - player.setHealth(player.getHealth() - 2); - travelEffect(player.worldObj, entity); - entity.setPosition(x, y, z); - travelEffect(player.worldObj, entity); - if (player.worldObj.isRemote) - player.addChatMessage(new ChatComponentText(new ChatComponentTranslation("msg.teleporterSentMob.txt").getFormattedText() + "x:" + (int) x + " y:" + (int) y + " z:" + (int) z)); - } else if (player.worldObj.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); - } else if (player.worldObj.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.teleporterUnSet.txt")); - - } else if (player.worldObj.isRemote) - { - player.addChatMessage(new ChatComponentTranslation("msg.teleporterEntityDimensional.txt")); - } + if (player.worldObj.isRemote) + player.addChatMessage(new ChatComponentTranslation("msg.teleporterUnSet.txt")); + return true; } + if (entity instanceof EntityPlayer) + { + if (player.worldObj.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterPlayerT1.txt")); + return true; + } + + if (entity instanceof IBossDisplayData || !(entity instanceof EntityLiving)) return true; + + if (player.getHealth() > 2 || player.capabilities.isCreativeMode) + { + stack.damageItem(1, player); + if (!player.capabilities.isCreativeMode) player.setHealth(player.getHealth() - 2); + getLocation(stack).sendEntityToCoords(entity); + if (player.worldObj.isRemote) player.addChatMessage(new ChatComponentText(new ChatComponentTranslation("msg.teleporterSentMob.txt").getFormattedText() + " x:" + (int) getLocation(stack).getXCoord() + " y:" + (int) getLocation(stack).getYCoord() + " z:" + (int) getLocation(stack).getZCoord() + " Dimension: " + getLocation(stack).getDimensionName())); + } + else if (player.worldObj.isRemote) + player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); + return true; } @Override - public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) - { - boolean isSet = ItemNBTHelper.getBoolean(stack, "IsSet", false); - double x = ItemNBTHelper.getDouble(stack, "X", 0); - double y = ItemNBTHelper.getDouble(stack, "Y", 0); - double z = ItemNBTHelper.getDouble(stack, "Z", 0); - float yaw = ItemNBTHelper.getFloat(stack, "Yaw", 0); - float pitch = ItemNBTHelper.getFloat(stack, "Pitch", 0); - int dim = ItemNBTHelper.getInteger(stack, "Dimension", 0); - boolean onStand = !(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof TeleporterMKI); - + public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) { if (player.isSneaking()) { - if (!isSet) + if (getLocation(stack) == null) { ItemNBTHelper.setDouble(stack, "X", player.posX); ItemNBTHelper.setDouble(stack, "Y", player.posY); @@ -109,36 +91,35 @@ public class TeleporterMKI extends ItemDE ItemNBTHelper.setBoolean(stack, "IsSet", true); if (world.isRemote) player.addChatMessage(new ChatComponentText(new ChatComponentTranslation("msg.teleporterBound.txt").getFormattedText() + "{X:" + (int) player.posX + " Y:" + (int) player.posY + " Z:" + (int) player.posZ + " Dim:" + player.worldObj.provider.getDimensionName() + "}")); - + return stack; } else if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterAlreadySet.txt")); + + return stack; } else { - if (isSet) + if (getLocation(stack) == null) { - if ((player.getHealth() > 2 || player.capabilities.isCreativeMode || onStand) && !player.isRiding()) - { - if (!onStand)stack.damageItem(1, player); - if (!player.capabilities.isCreativeMode && !onStand) - player.setHealth(player.getHealth() - 2); + if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterUnSet.txt")); + return stack; + } - travelEffect(world, player); - Teleporter.teleport(player, x, y+0.3, z, yaw, pitch, dim); - travelEffect(world, player); - - } else if (world.isRemote && player.getHealth() <= 2 && !player.capabilities.isCreativeMode) - player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); + if (player.getHealth() > 2 || player.capabilities.isCreativeMode) + { + getLocation(stack).sendEntityToCoords(player); + LogHelper.info(getLocation(stack).getYCoord()); + stack.damageItem(1, player); + if (!player.capabilities.isCreativeMode) player.setHealth(player.getHealth() - 2); } else if (world.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.teleporterUnSet.txt")); + player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); + return stack; } - return stack; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override - public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) - { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { if (!ItemNBTHelper.getBoolean(stack, "IsSet", false)) { list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("info.teleporterInfUnset1.txt")); @@ -154,28 +135,8 @@ public class TeleporterMKI extends ItemDE } } - public void travelEffect(World world, Entity entity) - { - entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "portal.travel", 0.1F, entity.worldObj.rand.nextFloat() * 0.1F + 0.9F); - /* - for (int i = 0; i < 100; i++) - { - if (entity instanceof EntityPlayer) - { - world.spawnParticle("portal", entity.posX + (world.rand.nextFloat() - 0.5), entity.posY + (world.rand.nextFloat() - 0.5), entity.posZ + (world.rand.nextFloat() - 0.5), 0D, 0D, 0D); - world.spawnParticle("portal", entity.posX + (world.rand.nextFloat() - 0.5), entity.posY - 1 + (world.rand.nextFloat() - 0.5), entity.posZ + (world.rand.nextFloat() - 0.5), 0D, 0D, 0D); - } else - { - world.spawnParticle("portal", entity.posX + (world.rand.nextFloat() - 0.5), entity.posY + (world.rand.nextFloat() - 0.5), entity.posZ + (world.rand.nextFloat() - 0.5), 0D, 0D, 0D); - world.spawnParticle("portal", entity.posX + (world.rand.nextFloat() - 0.5), entity.posY + 1 + (world.rand.nextFloat() - 0.5), entity.posZ + (world.rand.nextFloat() - 0.5), 0D, 0D, 0D); - } - } - */ - } - @Override - public EnumRarity getRarity(ItemStack stack) - { + public EnumRarity getRarity(ItemStack stack) { return EnumRarity.uncommon; } @@ -188,4 +149,17 @@ public class TeleporterMKI extends ItemDE public Entity createEntity(World world, Entity location, ItemStack itemstack) { return new EntityPersistentItem(world, location, itemstack); } + + public TeleportLocation getLocation(ItemStack stack) { + double x = ItemNBTHelper.getDouble(stack, "X", 0); + double y = ItemNBTHelper.getDouble(stack, "Y", 0); + double z = ItemNBTHelper.getDouble(stack, "Z", 0); + float yaw = ItemNBTHelper.getFloat(stack, "Yaw", 0); + float pitch = ItemNBTHelper.getFloat(stack, "Pitch", 0); + int dim = ItemNBTHelper.getInteger(stack, "Dimension", 0); + + if (!ItemNBTHelper.getBoolean(stack, "IsSet", false)) return null; + + return new TeleportLocation(x, y, z, dim, pitch, yaw); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java index 06721637..659d31c8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java @@ -5,7 +5,6 @@ import com.brandon3055.draconicevolution.client.handler.ToolHudHandler; import com.brandon3055.draconicevolution.client.interfaces.GuiHandler; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; -import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.InfoHelper; @@ -16,7 +15,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -29,15 +28,15 @@ import net.minecraft.world.World; import java.util.List; -public class TeleporterMKII extends ItemDE +public class TeleporterMKII extends TeleporterMKI { public TeleporterMKII() { + super(true); this.setUnlocalizedName(Strings.teleporterMKIIName); this.setCreativeTab(DraconicEvolution.tabToolsWeapons); this.setMaxStackSize(1); ModItems.register(this); - //GameRegistry.registerItem(this, Strings.teleporterMKIIName); } @Override @@ -48,20 +47,16 @@ public class TeleporterMKII extends ItemDE } @Override - public boolean onLeftClickEntity(ItemStack teleporter, EntityPlayer player, Entity entity) + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { World world = player.worldObj; - short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0); - int selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0); - int fuel = ItemNBTHelper.getInteger(teleporter, "Fuel", 0); + int fuel = ItemNBTHelper.getInteger(stack, "Fuel", 0); - NBTTagCompound compound = teleporter.getTagCompound(); - if(compound == null) compound = new NBTTagCompound(); - NBTTagList list = (NBTTagList)compound.getTag("Locations"); - if (list == null) list = new NBTTagList(); - - TeleportLocation destination = new TeleportLocation(); - destination.readFromNBT(list.getCompoundTagAt(selected+selrctionOffset)); + if (getLocation(stack) == null) { + if (world.isRemote) + FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_TELEPORTER, world, (int) player.posX, (int) player.posY, (int) player.posZ); + return true; + } if (!player.capabilities.isCreativeMode && fuel <= 0) { if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterOutOfFuel.txt")); @@ -70,38 +65,24 @@ public class TeleporterMKII extends ItemDE if (entity instanceof EntityPlayer){ if (entity.isSneaking()){ - destination.sendEntityToCoords((EntityPlayer) entity); - if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1); + getLocation(stack).sendEntityToCoords(entity); + if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setInteger(stack, "Fuel", fuel - 1); }else{ if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterPlayerConsent.txt")); } return true; - } - - if (entity instanceof EntityLivingBase){ - destination.sendEntityToCoords((EntityLivingBase) entity); - if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1); + }else if (entity instanceof EntityLiving){ + getLocation(stack).sendEntityToCoords(entity); + if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setInteger(stack, "Fuel", fuel - 1); } return true; } @Override - public ItemStack onItemRightClick(final ItemStack teleporter, final World world, final EntityPlayer player) + public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) { - short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0); - int selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0); - int fuel = ItemNBTHelper.getInteger(teleporter, "Fuel", 0); - - NBTTagCompound compound = teleporter.getTagCompound(); - if(compound == null) compound = new NBTTagCompound(); - NBTTagList list = (NBTTagList)compound.getTag("Locations"); - if (list == null) list = new NBTTagList(); - - TeleportLocation destination = new TeleportLocation(); - destination.readFromNBT(list.getCompoundTagAt(selected+selrctionOffset)); - - boolean onStand = !(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof TeleporterMKII); + int fuel = ItemNBTHelper.getInteger(stack, "Fuel", 0); if (player.isSneaking()) { @@ -111,27 +92,24 @@ public class TeleporterMKII extends ItemDE } } else { - if (player.isRiding() && player.dimension != destination.getDimension()) return teleporter; - if (destination.getName().isEmpty() && !onStand){ + if (getLocation(stack) == null){ if (world.isRemote) FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_TELEPORTER, world, (int) player.posX, (int) player.posY, (int) player.posZ); - return teleporter; + return stack; } - if (destination.getName().isEmpty()) return teleporter; - - if (!player.capabilities.isCreativeMode && fuel <= 0 && !onStand) + if (!player.capabilities.isCreativeMode && fuel <= 0) { if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterOutOfFuel.txt")); - return teleporter; + return stack; } - if (!player.capabilities.isCreativeMode && fuel > 0 && !onStand) ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1); + if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setInteger(stack, "Fuel", fuel - 1); - destination.sendEntityToCoords(player); + getLocation(stack).sendEntityToCoords(player); } - return teleporter; + return stack; } @@ -175,14 +153,29 @@ public class TeleporterMKII extends ItemDE @SideOnly(Side.CLIENT) @Override public String getItemStackDisplayName(ItemStack teleporter) { - short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0); - int selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0); - NBTTagCompound compound = teleporter.getTagCompound(); - if(compound == null) compound = new NBTTagCompound(); - NBTTagList list = (NBTTagList)compound.getTag("Locations"); - if (list == null) list = new NBTTagList(); - String selectedDest = list.getCompoundTagAt(selected+selrctionOffset).getString("Name"); - ToolHudHandler.setTooltip(selectedDest); return super.getItemStackDisplayName(teleporter); } + + @Override + public void onUpdate(ItemStack stack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) { + if (world.isRemote && entity instanceof EntityPlayer && ((EntityPlayer) entity).getHeldItem() != null && ((EntityPlayer) entity).getHeldItem().getItem() instanceof TeleporterMKII){ + if (getLocation(((EntityPlayer) entity).getHeldItem()) != null) ToolHudHandler.setTooltip(getLocation(((EntityPlayer) entity).getHeldItem()).getName()); + } + } + + @Override + public TeleportLocation getLocation(ItemStack stack) { + short selected = ItemNBTHelper.getShort(stack, "Selection", (short) 0); + int selrctionOffset = ItemNBTHelper.getInteger(stack, "SelectionOffset", 0); + NBTTagCompound compound = stack.getTagCompound(); + if(compound == null) return null; + NBTTagList list = (NBTTagList)compound.getTag("Locations"); + if (list == null) return null; + + TeleportLocation destination = new TeleportLocation(); + destination.readFromNBT(list.getCompoundTagAt(selected+selrctionOffset)); + if (destination.getName().isEmpty()) return null; + + return destination; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java index e7b60fd9..0f2390d4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java @@ -16,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; @@ -85,8 +84,8 @@ public class DraconicBow extends ItemBow if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "ender"; if (currentMode.equals("rapidfire")) BowHandler.rapidFire(player, count, 4); - else if (currentMode.equals("sharpshooter")) - player.addPotionEffect(new PotionEffect(2, 2, 10, true)); +// else if (currentMode.equals("sharpshooter")) +// player.addPotionEffect(new PotionEffect(2, 2, 10, true)); else if (currentMode.equals("devistation")) BowHandler.rapidFire(player, count, 2); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java index 015d9c14..6980eb1b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java @@ -16,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; @@ -81,8 +80,8 @@ public class WyvernBow extends ItemBow { if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "ender"; if (currentMode.equals("rapidfire")) BowHandler.rapidFire(player, count, 18); - else if (currentMode.equals("sharpshooter")) - player.addPotionEffect(new PotionEffect(2, 2, 10, true)); +// else if (currentMode.equals("sharpshooter")) +// player.addPotionEffect(new PotionEffect(2, 2, 10, true)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java new file mode 100644 index 00000000..8a088649 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java @@ -0,0 +1,52 @@ +package com.brandon3055.draconicevolution.common.network; + +import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.relauncher.Side; +import io.netty.buffer.ByteBuf; + +/** + * Created by Brandon on 1/12/2014. + */ +public class MountUpdatePacket implements IMessage { + + public int entityID; + + public MountUpdatePacket(){} + + public MountUpdatePacket(int id){ + this.entityID = id; + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(entityID); + } + + @Override + public void fromBytes(ByteBuf buf) { + entityID = buf.readInt(); + } + + public static class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(MountUpdatePacket message, MessageContext ctx) { + if (ctx.side.equals(Side.SERVER)){ + if (message.entityID == -1){ + ctx.getServerHandler().playerEntity.mountEntity(null); + return null; + } + else if (ctx.getServerHandler().playerEntity.ridingEntity != null){ + return new MountUpdatePacket(ctx.getServerHandler().playerEntity.ridingEntity.getEntityId()); + } + return null; + } + + ClientEventHandler.tryRepositionPlayerOnMount(message.entityID); + return null; + } + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java index 17d9f7bd..b464acde 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java @@ -1,10 +1,9 @@ package com.brandon3055.draconicevolution.common.network; -import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation; +import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -167,7 +166,6 @@ public class TeleporterPacket implements IMessage } if (message.function == UPDATEDESTINATION){ - LogHelper.info("setHere "+message.data); NBTTagCompound tag = list.getCompoundTagAt(message.data); message.location.writeToNBT(tag); list.func_150304_a(message.data, tag); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java index c1be0a1b..39868588 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java @@ -35,7 +35,7 @@ public abstract class CustomSpawnerBaseLogic { /** * A counter for spawn tries. */ - private int spawnCount = 4; + private int spawnCount = 6; private Entity renderedEntity; private int maxNearbyEntities = 20; /** @@ -53,7 +53,7 @@ public abstract class CustomSpawnerBaseLogic { /** * Spawn Speed */ - public int spawnSpeed = 0; + public int spawnSpeed = 1; /** * The distance from which a player activates the spawner. */ @@ -143,9 +143,6 @@ public abstract class CustomSpawnerBaseLogic { flag = true; - if (spawnCount > 4) spawnCount --; - }else if (spawnCount < 10){ - spawnCount ++; } } @@ -160,8 +157,12 @@ public abstract class CustomSpawnerBaseLogic { if (par1Entity instanceof EntityLivingBase && par1Entity.worldObj != null) { if (par1Entity instanceof EntitySkeleton) { ((EntitySkeleton)par1Entity).setSkeletonType(skeletonType); - par1Entity.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword)); - ((EntitySkeleton) par1Entity).setEquipmentDropChance(0, 0f); + if (skeletonType == 1) { + par1Entity.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword)); + ((EntitySkeleton) par1Entity).setEquipmentDropChance(0, 0f); + }else{ + par1Entity.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); + } } else ((EntityLiving) par1Entity).onSpawnWithEgg(null); this.getSpawnerWorld().spawnEntityInWorld(par1Entity); } @@ -189,11 +190,9 @@ public abstract class CustomSpawnerBaseLogic { ignoreSpawnRequirements = par1NBTTagCompound.getBoolean("IgnoreSpawnRequirements"); skeletonType = par1NBTTagCompound.getInteger("SkeletonType"); - if (par1NBTTagCompound.hasKey("MinSpawnDelay", 99)) { this.minSpawnDelay = par1NBTTagCompound.getShort("MinSpawnDelay"); this.maxSpawnDelay = par1NBTTagCompound.getShort("MaxSpawnDelay"); this.spawnCount = par1NBTTagCompound.getShort("SpawnCount"); - } if (par1NBTTagCompound.hasKey("MaxNearbyEntities", 99)) { this.maxNearbyEntities = par1NBTTagCompound.getShort("MaxNearbyEntities"); @@ -263,9 +262,11 @@ public abstract class CustomSpawnerBaseLogic { spawnSpeed = i; minSpawnDelay = 400 - (i * 150); maxSpawnDelay = 600 - (i * 200); + spawnCount = 4 + (i*2); if (i == 3){ minSpawnDelay = 40; maxSpawnDelay = 40; + spawnCount = 12; } if (minSpawnDelay < 0) minSpawnDelay = 0; if (maxSpawnDelay < 1) maxSpawnDelay = 1; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java index 71ddea53..9298e72a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java @@ -22,7 +22,7 @@ import java.util.Random; /** * Created by Brandon on 27/06/2014. */ -public class TileEnergyInfuser extends TileObjectSync implements IEnergyHandler, ISidedInventory {//todo fix display not working when buffer is empty +public class TileEnergyInfuser extends TileObjectSync implements IEnergyHandler, ISidedInventory { ItemStack[] items = new ItemStack[1]; public EnergyStorage energy = new EnergyStorage(1000000); public int maxInput = 81920; @@ -30,6 +30,7 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyHandler, public boolean runningCach = false; private int tick = 0; public float rotation = 0; + /**True is energy was transferred this tick*/ public boolean transfer = false; public boolean transferCach = false; @@ -46,7 +47,6 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyHandler, if(worldObj.isRemote) return; - if (tick % 100 == 0) tryStartOrStop(); if (tick % 400 == 0) detectAndSendChanges(true); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java index cbfd69c9..4053b1bc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java @@ -1,13 +1,20 @@ package com.brandon3055.draconicevolution.common.tileentities; -import static net.minecraftforge.common.util.ForgeDirection.UP; - -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import cofh.api.energy.IEnergyHandler; +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; +import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utills.Utills; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; +import static net.minecraftforge.common.util.ForgeDirection.UP; + /** * Created by Brandon on 24/06/2014. */ @@ -18,31 +25,68 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { @Override public void updateEntity() { + if (worldObj.isRemote) return; + for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { + if (worldObj.getTileEntity(xCoord+d.offsetX, yCoord+d.offsetY, zCoord+d.offsetZ) instanceof IEnergyHandler) ((IEnergyHandler)worldObj.getTileEntity(xCoord+d.offsetX, yCoord+d.offsetY, zCoord+d.offsetZ)).receiveEnergy(ForgeDirection.DOWN, Integer.MAX_VALUE, false); + } +// LogHelper.info(Integer.MAX_VALUE); + //if (1==1)return; - if (worldObj.isRemote) modelRotation += 0.5; +// for (Field f : StatList.class.getDeclaredFields()) { +// f.setAccessible(true); +// +// try { +// if (f.getName().equals("oneShotStats")) { +// f.set(null, new HashMap()); +// } +// } +// catch (Exception e) { +// LogHelper.error("Severe error, please report this to the mod author:"); +// LogHelper.error(e); +// } +// } + +// for (Field f : AchievementPage.class.getDeclaredFields()) {// +// f.setAccessible(true); +// +// try { +// if (f.getName().equals("achievementPages")) { +// f.set(null, new LinkedList()); +// } +// } +// catch (Exception e) { +// LogHelper.error("Severe error, please report this to the mod author:"); +// LogHelper.error(e); +// } +// } + +// Achievements.addModAchievements(); +// Achievements.registerAchievementPane(); + +// if (worldObj.isRemote) modelRotation += 0.5; //LogHelper.info(modelRotation); - int test = 4; - //if (!worldObj.isRemote) - //System.out.println(energy.getEnergyStored()); - - if ((this.energy.getEnergyStored() > 0)) { - - TileEntity tile = worldObj.getTileEntity(xCoord + UP.offsetX, yCoord + UP.offsetY, zCoord + UP.offsetZ); - - if ((tile instanceof IEnergyHandler)) { - this.energy.extractEnergy(((IEnergyHandler)tile).receiveEnergy(UP.getOpposite(), this.energy.extractEnergy(maxInput, true), false), false); - } - } +// int test = 4; +// //if (!worldObj.isRemote) +// //System.out.println(energy.getEnergyStored()); +// +// if ((this.energy.getEnergyStored() > 0)) { +// +// TileEntity tile = worldObj.getTileEntity(xCoord + UP.offsetX, yCoord + UP.offsetY, zCoord + UP.offsetZ); +// +// if ((tile instanceof IEnergyHandler)) { +// this.energy.extractEnergy(((IEnergyHandler)tile).receiveEnergy(UP.getOpposite(), this.energy.extractEnergy(maxInput, true), false), false); +// } +// } } @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { if(from != UP) - return this.energy.receiveEnergy(Math.min(maxInput, maxReceive), simulate); + return 0;//this.energy.receiveEnergy(Math.min(maxInput, maxReceive), simulate); else return 0; } @@ -50,7 +94,7 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {; if (from == UP) - return this.energy.extractEnergy(maxExtract, simulate); + return 0;//return this.energy.extractEnergy(maxExtract, simulate); else return 0; } @@ -74,4 +118,34 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } + + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeToNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + readFromNBT(pkt.func_148857_g()); + } + + + @Override + public void readFromNBT(NBTTagCompound p_145839_1_) { + super.readFromNBT(p_145839_1_); + EntityPlayer player = null; + if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); + if (player != null) LogHelper.info("Read: "+Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + LogHelper.info(worldObj+" "+player); + } + + @Override + public void writeToNBT(NBTTagCompound p_145841_1_) { + super.writeToNBT(p_145841_1_); + EntityPlayer player = null; + if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); + if (player != null) LogHelper.info("Write: "+Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java index 5e90baec..18ef535c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import cofh.api.energy.IEnergyHandler; import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; import com.brandon3055.draconicevolution.common.handler.ParticleHandler; +import com.brandon3055.draconicevolution.common.network.ObjectPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; +import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.nbt.NBTTagCompound; @@ -21,37 +23,43 @@ import java.util.Random; /** * Created by Brandon on 28/07/2014. */ -public class TileEnergyPylon extends TileEntity implements IEnergyHandler {//todo optimize packets - - protected EnergyStorage storage = new EnergyStorage(500000, 0, 0); +public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {//todo make it possible to select which core to to link to +//todo make core change color as it fuills + //protected EnergyStorage storage = new EnergyStorage(500000, 0, 0); public boolean active = false; - public boolean input = false; + public boolean lastTickActive = false; + public boolean reciveEnergy = false; //Power Flow to system + public boolean lastTickReciveEnergy = false; public float modelRotation = 0; public float modelScale = 0; private TileLocation masterLocation = new TileLocation(); - private int particleRate = 0; - private int updateDelay = 0; - private boolean nextUpdate = false; + private byte particleRate = 0; + private byte lastTickParticleRate = 0; @Override public void updateEntity() { - if (nextUpdate) { - updateDelay = 0; - nextUpdate = false; - } if (active && worldObj.isRemote) { modelRotation += 1.5; - modelScale += input ? -0.01F : 0.01F; - if ((modelScale < 0 && input)) modelScale = 10000F; - if ((modelScale < 0 && !input)) modelScale = 0F; + modelScale += !reciveEnergy ? -0.01F : 0.01F; + if ((modelScale < 0 && !reciveEnergy)) modelScale = 10000F; + if ((modelScale < 0 && reciveEnergy)) modelScale = 0F; spawnParticles(); } else if (worldObj.isRemote) modelScale = 0.5F; - if (active && input){ - updateInput(); - }else if (active){ - updateOutput(); + + if (worldObj.isRemote) return; + + if (active && !reciveEnergy){ + for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { + TileEntity tile = worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ); + if (tile != null && tile instanceof IEnergyHandler) { + extractEnergy(d, ((IEnergyHandler)tile).receiveEnergy(d.getOpposite(), extractEnergy(d, Integer.MAX_VALUE, true), false), false); + } + } } + + detectAndSendChanges(); + if (particleRate > 0) particleRate--; } public void onActivated(){ @@ -59,60 +67,6 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {//tod active = isValidStructure(); } findMaster(); - - if (input){ - storage.setMaxReceive(0); - storage.setMaxExtract(500000); - }else{ - storage.setMaxReceive(500000); - storage.setMaxExtract(0); - } - } - //input from core out to acceptors - private void updateInput(){ - if (updateDelay > 0){ - updateDelay--; - if (particleRate > 0) particleRate--; - }else if (getMaster() != null && getMaster().isOnline() && storage.getEnergyStored() < storage.getMaxEnergyStored() && getMaster().getEnergyStored() > 0) { - int maxRecived = (int)Math.min(storage.getMaxEnergyStored() - storage.getEnergyStored(), getMaster().getEnergyStored()); - storage.modifyEnergyStored(maxRecived); - getMaster().extractEnergy(maxRecived, false); - particleRate = maxRecived / 80; - if (particleRate > 100) particleRate = 100; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - }else { - if (particleRate > 0) particleRate--; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - updateDelay = 20; - } - if (worldObj.isRemote) return; - if ((storage.getEnergyStored() > 0)) { - for (int i = 0; i < 6; i++){ - TileEntity tile = worldObj.getTileEntity(xCoord + ForgeDirection.getOrientation(i).offsetX, yCoord + ForgeDirection.getOrientation(i).offsetY, zCoord + ForgeDirection.getOrientation(i).offsetZ); - if (tile != null && tile instanceof IEnergyHandler) { - storage.extractEnergy(((IEnergyHandler)tile).receiveEnergy(ForgeDirection.getOrientation(i).getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), false); - } - } - } - } - //output to core in from generators - private void updateOutput(){ - if (getMaster() == null || !getMaster().isOnline()) return; - if (updateDelay > 0){ - updateDelay--; - if (particleRate > 0) particleRate--; - }else if (storage.getEnergyStored() > 0 && getMaster().getEnergyStored() < getMaster().getMaxEnergyStored()){ - int maxSent = (int)Math.min(getMaster().getMaxEnergyStored() - getMaster().getEnergyStored(), storage.getEnergyStored()); - storage.modifyEnergyStored(-maxSent); - getMaster().receiveEnergy(maxSent, false); - particleRate = maxSent / 80; - if (particleRate > 100) particleRate = 100; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - }else { - if (particleRate > 0) particleRate--; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - updateDelay = 20; - } } private TileEnergyStorageCore getMaster(){ @@ -152,7 +106,7 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {//tod double targetY; double targetZ; if (particleRate > 20) particleRate = 20; - if (input){ + if (!reciveEnergy){ spawnX = x+0.5 - disMod + (rand.nextFloat() * (disMod*2)); spawnY = y+0.5 - disMod + (rand.nextFloat() * (disMod*2)); spawnZ = z+0.5 - disMod + (rand.nextFloat() * (disMod*2)); @@ -224,29 +178,20 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {//tod @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); - storage.readFromNBT(compound); active = compound.getBoolean("Active"); - input = compound.getBoolean("Input"); + reciveEnergy = compound.getBoolean("Input"); masterLocation.readFromNBT(compound, "Master"); - particleRate = compound.getShort("ParticleRate"); - if (input){ - storage.setMaxReceive(0); - storage.setMaxExtract(500000); - }else{ - storage.setMaxReceive(500000); - storage.setMaxExtract(0); - } + particleRate = compound.getByte("ParticleRate"); } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); - storage.writeToNBT(compound); compound.setBoolean("Active", active); - compound.setBoolean("Input", input); + compound.setBoolean("Input", reciveEnergy); masterLocation.writeToNBT(compound, "Master"); - compound.setShort("ParticleRate", (short)particleRate); + compound.setByte("ParticleRate", particleRate); } @Override @@ -269,28 +214,56 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {//tod @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - nextUpdate = true; - return storage.receiveEnergy(maxReceive, simulate); + if (getMaster() == null) return 0; + int received = reciveEnergy ? getMaster().receiveEnergy(maxReceive, simulate) : 0; + if (!simulate && received > 0) particleRate = (byte)Math.min(20, received < 500 && received > 0 ? 1 : received/500); + return received; } @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - nextUpdate = true; - return storage.extractEnergy(maxExtract, simulate); + if (getMaster() == null) return 0; + int extracted = reciveEnergy ? 0 : getMaster().extractEnergy(maxExtract, simulate); + if (!simulate && extracted > 0) particleRate = (byte)Math.min(20, extracted < 500 && extracted > 0 ? 1 : extracted/500); + return extracted; } @Override public int getEnergyStored(ForgeDirection from) { - return storage.getEnergyStored(); + if (getMaster() == null) return 0; + return (int)Math.min(Integer.MAX_VALUE, getMaster().getEnergyStored()); } @Override public int getMaxEnergyStored(ForgeDirection from) { - return storage.getMaxEnergyStored(); + if (getMaster() == null) return 0; + return (int)Math.min(Integer.MAX_VALUE, getMaster().getMaxEnergyStored()); } @Override public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } + + private void detectAndSendChanges(){ + if (lastTickActive != active) lastTickActive = (Boolean) sendObject(ObjectPacket.BOOLEAN, 0, active, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); + if (lastTickReciveEnergy != reciveEnergy) lastTickReciveEnergy = (Boolean) sendObject(ObjectPacket.BOOLEAN, 1, reciveEnergy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); + if (lastTickParticleRate != particleRate) lastTickParticleRate = (Byte) sendObject(ObjectPacket.BYTE, 2, particleRate); + } + + @SideOnly(Side.CLIENT) + @Override + public void receiveObject(int index, Object object) { + switch (index) { + case 0: + active = (Boolean) object; + break; + case 1: + reciveEnergy = (Boolean) object; + break; + case 2: + particleRate = (Byte) object; + break; + } + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java index 79e88446..f79cdef6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java @@ -2,20 +2,21 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.network.ObjectPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; /** * Created by Brandon on 25/07/2014. */ -public class TileEnergyStorageCore extends TileEntity { +public class TileEnergyStorageCore extends TileObjectSync { protected TileLocation[] stabilizers = new TileLocation[4]; protected int tier = 0; @@ -23,9 +24,8 @@ public class TileEnergyStorageCore extends TileEntity { public float modelRotation = 0; private double energy = 0; private double capacity = 0; - private int maxReceive = 1000000; - private int maxExtract = 1000000; - private boolean loaded = false; + private double lastTickCapacity = 0; + private int tick = 0; public TileEnergyStorageCore(){ for (int i = 0; i < stabilizers.length; i++) @@ -38,6 +38,8 @@ public class TileEnergyStorageCore extends TileEntity { public void updateEntity() { if (!online) return; if (worldObj.isRemote) modelRotation += 0.5; + detectAndRendChanges(); + tick++; } @@ -748,7 +750,8 @@ public class TileEnergyStorageCore extends TileEntity { /* EnergyHandler */ public int receiveEnergy(int maxReceive, boolean simulate) { - double energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + int maxReceive1 = Integer.MAX_VALUE; + double energyReceived = Math.min(capacity - energy, Math.min(maxReceive1, maxReceive)); if (!simulate) { energy += energyReceived; @@ -757,8 +760,8 @@ public class TileEnergyStorageCore extends TileEntity { } public int extractEnergy(int maxExtract, boolean simulate) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - double energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + int maxExtract1 = Integer.MAX_VALUE; + double energyExtracted = Math.min(energy, Math.min(maxExtract1, maxExtract)); if (!simulate) { energy -= energyExtracted; @@ -778,4 +781,14 @@ public class TileEnergyStorageCore extends TileEntity { public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } + + private void detectAndRendChanges(){ + int diff = (int)Math.abs(lastTickCapacity - energy); + if (diff > 100000) lastTickCapacity = (Double)sendObject(ObjectPacket.DOUBLE, 0, energy); + } + + @Override + public void receiveObject(int index, Object object) { + energy = (Double) object; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/CustomTeleporter.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/CustomTeleporter.java deleted file mode 100644 index 05b46a8f..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/CustomTeleporter.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.brandon3055.draconicevolution.common.utills; - -import net.minecraft.entity.Entity; -import net.minecraft.world.Teleporter; -import net.minecraft.world.WorldServer; - -public class CustomTeleporter extends Teleporter -{ - private double tX; - private double tY; - private double tZ; - private float yaw; - private float pitch; - - public CustomTeleporter(WorldServer worldServer, double tX, double tY, double tZ, float yaw, float pitch) { - super(worldServer); - - this.tX = tX; - this.tY = tY; - this.tZ = tZ; - this.yaw = yaw; - this.pitch = pitch; - } - - @Override - public void placeInPortal(Entity entity, double x, double y, double z, float r) - { - entity.setLocationAndAngles(this.tX, this.tY, this.tZ, this.yaw, this.pitch); - } - - @Override - public void removeStalePortalLocations(long par1) - { - } - - @Override - public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8) - { - return false; - } -} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/Teleporter.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/Teleporter.java index 11598c47..ecbb0979 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/Teleporter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/Teleporter.java @@ -1,55 +1,68 @@ package com.brandon3055.draconicevolution.common.utills; -import net.minecraft.entity.EntityLivingBase; +import com.brandon3055.draconicevolution.DraconicEvolution; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.potion.PotionEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; public class Teleporter { - public static void teleport(EntityLivingBase entity, double x, double y, double z, float yaw, float pitch, int dim) - { - if (entity.worldObj.isRemote) return; - if (entity instanceof EntityPlayerMP) - { - EntityPlayerMP thePlayer = (EntityPlayerMP) entity; - - if (thePlayer.dimension == dim) - { - entity.setLocationAndAngles(x, y, z, yaw, pitch); - entity.setPositionAndUpdate(x, y, z); - } else - { - if (thePlayer.isRiding()) - thePlayer.dismountEntity(thePlayer.ridingEntity); - thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, dim, new CustomTeleporter(thePlayer.mcServer.worldServerForDimension(dim), x, y, z, yaw, pitch)); - } - } else if (dim == entity.dimension) - { - entity.setLocationAndAngles(x, y, z, yaw, pitch); - entity.setPositionAndUpdate(x, y, z); - } - } - - public static void teleport(EntityPlayer player, double x, double y, double z) - { - if (player instanceof EntityPlayerMP) - { - EntityPlayerMP thePlayer = (EntityPlayerMP) player; - - if (thePlayer.dimension == 1) - { - if (thePlayer.isRiding()) - thePlayer.dismountEntity(thePlayer.ridingEntity); - thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, thePlayer.dimension, new CustomTeleporter(thePlayer.mcServer.worldServerForDimension(thePlayer.dimension), x, y, z, 0, 0)); - } else - { - if (thePlayer.isRiding()) - thePlayer.dismountEntity(thePlayer.ridingEntity); - thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, thePlayer.dimension, new CustomTeleporter(thePlayer.mcServer.worldServerForDimension(thePlayer.dimension), x, y, z, 0, 0)); - } - } - } +// public static void teleport(EntityLivingBase entity, double x, double y, double z, float yaw, float pitch, int dim) +// { +// //if (entity.worldObj.isRemote) return; +// if (entity instanceof EntityPlayerMP) +// { +// EntityPlayerMP thePlayer = (EntityPlayerMP) entity; +// LogHelper.info(dim +" "+thePlayer.dimension); +// +// if (thePlayer.dimension == dim) +// { +// entity.setLocationAndAngles(x, y, z, yaw, pitch); +// entity.setPositionAndUpdate(x, y, z); +// } else +// { +// if (thePlayer.isRiding()) +// thePlayer.dismountEntity(thePlayer.ridingEntity); +// // if (thePlayer.dimension == 1) thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, dim, new CustomTeleporter(thePlayer.mcServer.worldServerForDimension(dim), x, y, z, yaw, pitch)); +// thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, dim, new CustomTeleporter(thePlayer.mcServer.worldServerForDimension(dim), x, y, z, yaw, pitch)); +// +// } +// } else if (dim == entity.dimension) +// { +// entity.setLocationAndAngles(x, y, z, yaw, pitch); +// entity.setPositionAndUpdate(x, y, z); +// } +// LogHelper.info(entity.dimension); +// } +// +// public static void teleport(EntityPlayer player, double x, double y, double z) +// { +// if (player instanceof EntityPlayerMP) +// { +// EntityPlayerMP thePlayer = (EntityPlayerMP) player; +// +// if (thePlayer.dimension == 1) +// { +// if (thePlayer.isRiding()) +// thePlayer.dismountEntity(thePlayer.ridingEntity); +// thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, thePlayer.dimension, new CustomTeleporter(thePlayer.mcServer.worldServerForDimension(thePlayer.dimension), x, y, z, 0, 0)); +// } else +// { +// if (thePlayer.isRiding()) +// thePlayer.dismountEntity(thePlayer.ridingEntity); +// thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, thePlayer.dimension, new CustomTeleporter(thePlayer.mcServer.worldServerForDimension(thePlayer.dimension), x, y, z, 0, 0)); +// } +// } +// } public static class TeleportLocation { protected double xCoord; @@ -65,6 +78,24 @@ public class Teleporter } + public TeleportLocation(double x, double y, double z, int dimension){ + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + this.dimension = dimension; + this.pitch = 0; + this.yaw = 0; + } + + public TeleportLocation(double x, double y, double z, int dimension, float pitch, float yaw){ + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + this.dimension = dimension; + this.pitch = pitch; + this.yaw = yaw; + } + public TeleportLocation(double x, double y, double z, int dimension, float pitch, float yaw, String name){ this.xCoord = x; this.yCoord = y; @@ -89,6 +120,10 @@ public class Teleporter public int getDimension() {return dimension;} + public String getDimensionName() { + return MinecraftServer.getServer().worldServerForDimension(dimension).provider.getDimensionName(); + } + public float getPitch() {return pitch;} public float getYaw() {return yaw;} @@ -141,14 +176,154 @@ public class Teleporter writeProtected = compound.getBoolean("WP"); } - public void sendEntityToCoords(EntityLivingBase entity){ + public void sendEntityToCoords(Entity entity){ entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "portal.travel", 0.1F, entity.worldObj.rand.nextFloat() * 0.1F + 0.9F); - if (entity.isRiding() && entity.dimension == getDimension()){ - sendEntityToCoords((EntityLivingBase)entity.ridingEntity); - } - Teleporter.teleport(entity, getXCoord(), getYCoord(), getZCoord(), getYaw(), getPitch(), getDimension()); - entity.fallDistance = 0; + + teleportEntity(entity, this); +// boolean dimensional = false; +// +// if (entity.dimension != dimension) dimensional = true; +// +// if (entity instanceof EntityPlayerMP){ +// EntityPlayerMP player = (EntityPlayerMP)entity; +// Entity ridingEntity = player.ridingEntity; +// +// if (dimensional)transferPlayerToDimension(player, dimension, player.mcServer.getConfigurationManager()); +// player.rotationPitch = pitch; +// player.rotationYaw = yaw; +// player.setPositionAndUpdate(xCoord, yCoord+0.3, zCoord); +// +// if (ridingEntity != null){ +// if (dimensional)transferEntityToWorld(ridingEntity, (WorldServer)entity.worldObj, MinecraftServer.getServer().worldServerForDimension(dimension)); +// ridingEntity.setPosition(xCoord, yCoord + 0.3, zCoord); +// } +// } +// else { +// LogHelper.info("current dimension "+MinecraftServer.getServer().worldServerForDimension(entity.dimension).provider.getDimensionName()); +// LogHelper.info("new dimension "+MinecraftServer.getServer().worldServerForDimension(dimension).provider.getDimensionName()); +// //entity.setPosition(xCoord, yCoord + 0.3, zCoord); +// //entity.setLocationAndAngles(xCoord, yCoord + 0.3, zCoord, yaw, pitch); +// LogHelper.info(dimensional); +// if (dimensional) travelEntity(entity.worldObj, entity);//transferEntityToWorld(entity, MinecraftServer.getServer().worldServerForDimension(entity.dimension), MinecraftServer.getServer().worldServerForDimension(dimension)); +// } +// +// entity.fallDistance = 0; entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "portal.travel", 0.1F, entity.worldObj.rand.nextFloat() * 0.1F + 0.9F); } } + + + + @SuppressWarnings("unchecked") + private static Entity teleportEntity(Entity entity, TeleportLocation destination) + { + if (entity == null || entity.worldObj.isRemote) return entity; + + World startWorld = entity.worldObj; + World destinationWorld =DraconicEvolution.proxy.getMCServer().worldServerForDimension(destination.dimension); + + if (destinationWorld == null){ + LogHelper.error("Destination world dose not exist!"); + return entity; + } + + Entity mount = entity.ridingEntity; + if (entity.ridingEntity != null) + { + entity.mountEntity(null); + mount = teleportEntity(mount, destination); + } + + boolean interDimensional = startWorld.provider.dimensionId != destinationWorld.provider.dimensionId; + + //startWorld.updateEntityWithOptionalForce(entity, false); + + if ((entity instanceof EntityPlayerMP) && interDimensional) + { + EntityPlayerMP player = (EntityPlayerMP)entity; + player.dimension = destination.dimension; + player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, destinationWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType())); + ((WorldServer)startWorld).getPlayerManager().removePlayer(player); + + startWorld.playerEntities.remove(player); + startWorld.updateAllPlayersSleepingFlag(); + int i = entity.chunkCoordX; + int j = entity.chunkCoordZ; + if ((entity.addedToChunk) && (startWorld.getChunkProvider().chunkExists(i, j))) + { + startWorld.getChunkFromChunkCoords(i, j).removeEntity(entity); + startWorld.getChunkFromChunkCoords(i, j).isModified = true; + } + startWorld.loadedEntityList.remove(entity); + startWorld.onEntityRemoved(entity); + } + + entity.setLocationAndAngles(destination.xCoord, destination.yCoord, destination.zCoord, destination.yaw, destination.pitch); + + ((WorldServer)destinationWorld).theChunkProviderServer.loadChunk((int)destination.xCoord >> 4, (int)destination.zCoord >> 4); + + destinationWorld.theProfiler.startSection("placing"); + if (interDimensional) + { + if (!(entity instanceof EntityPlayer)) + { + NBTTagCompound entityNBT = new NBTTagCompound(); + entity.isDead = false; + entityNBT.setString("id", EntityList.getEntityString(entity)); + entity.writeToNBT(entityNBT); + entity.isDead = true; + entity = EntityList.createEntityFromNBT(entityNBT, destinationWorld); + if (entity == null) + { + LogHelper.error("Failed to teleport entity to new location"); + return null; + } + entity.dimension = destinationWorld.provider.dimensionId; + } + destinationWorld.spawnEntityInWorld(entity); + entity.setWorld(destinationWorld); + } + entity.setLocationAndAngles(destination.xCoord, destination.yCoord, destination.zCoord, destination.yaw, entity.rotationPitch); + + destinationWorld.updateEntityWithOptionalForce(entity, false); + entity.setLocationAndAngles(destination.xCoord, destination.yCoord, destination.zCoord, destination.yaw, entity.rotationPitch); + + if ((entity instanceof EntityPlayerMP)) + { + EntityPlayerMP player = (EntityPlayerMP)entity; + if (interDimensional) { + player.mcServer.getConfigurationManager().func_72375_a(player, (WorldServer) destinationWorld); + } + player.playerNetServerHandler.setPlayerLocation(destination.xCoord, destination.yCoord, destination.zCoord, player.rotationYaw, player.rotationPitch); + } + + destinationWorld.updateEntityWithOptionalForce(entity, false); + + if (((entity instanceof EntityPlayerMP)) && interDimensional) + { + EntityPlayerMP player = (EntityPlayerMP)entity; + player.theItemInWorldManager.setWorld((WorldServer) destinationWorld); + player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer) destinationWorld); + player.mcServer.getConfigurationManager().syncPlayerInventory(player); + + for (PotionEffect potionEffect : (Iterable) player.getActivePotionEffects()) + { + player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potionEffect)); + } + + player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); + } + entity.setLocationAndAngles(destination.xCoord, destination.yCoord, destination.zCoord, destination.yaw, entity.rotationPitch); + + if (mount != null) + { + entity.mountEntity(mount); + if ((entity instanceof EntityPlayerMP)) { + destinationWorld.updateEntityWithOptionalForce(entity, true); + } + } + destinationWorld.theProfiler.endSection(); + entity.fallDistance = 0; + return entity; + } } diff --git a/src/main/resources/assets/draconicevolution/lang/en_US.lang b/src/main/resources/assets/draconicevolution/lang/en_US.lang index 3556b109..b04bd765 100644 --- a/src/main/resources/assets/draconicevolution/lang/en_US.lang +++ b/src/main/resources/assets/draconicevolution/lang/en_US.lang @@ -1,3 +1,4 @@ +//Description format \n=Force new line \% at start of line=add half line space above line //Tile Information ---------------------------------------------------------------------------------------------------------------------------------------- tile.draconicevolution:xRayBlock.name=Distortion Flame tile.draconicevolution:xRayBlock.description=Many of you have probably seen a graphical glitch that sometimes occurs when chunks load that allows you to see through the world and see all of the cave caves and tunnels bellow. This block replicates that effect. When you place it next to another block the face of the block it is touching becomes transparent allowing you to see through the world. This can be very useful for finding cave systems and dungeons maby even things other players don’t want you to find. Such a block dose not come cheap. It will cost you several Nether Stars and it is so fragile that once placed it can not be collected without destroying it. (not even with silk touch) @@ -33,7 +34,7 @@ tile.draconicevolution:energyInfuser.name=Energy Infuser tile.draconicevolution:energyInfuser.description=Seeing the need for faster energy transfer you have found a way to bring the infuser to being. Has a faster transfer rate than most other mod’s RF recharge stations (and cool particle effects to boot!) tile.draconicevolution:customSpawner.name=Stabilized Mob Spawner -tile.draconicevolution:customSpawner.description=To get started, right click any vanilla spawner with a draconic core to stabilize it. You now have a empty transportable spawner (pick up with draconic tools) Use any mob soul (new drop, random 1 in 1000 chance to get one when you kill a mob with a draconic or wyvern weapon) on the spawner to change it to that type. You can upgrade using the infused compound, draconic compound, nether star, Notch Apple and a secret very rare item (tool tips in game give more info) When broken you get back everything except the mob soul (it is to fragile and is destroyed when the spawner is broken) +tile.draconicevolution:customSpawner.description=To get started, right click any vanilla spawner with a draconic core to stabilize it. You now have a empty transportable spawner (pick up with draconic tools) Use any mob soul on the spawner to change it to that type. There are several items you can use to upgrade the spawner:\n\%-Wyvern Core: Upgrades to tier 2 (increases spawn count and speed)\n\%-Awakened Core: Upgrades to tier 3 (further increases spawn count and speed)\n\%-Nether Star: Removes the requirement for a player to be within 16 blocks for the spawner to function.\n\%-Notch Apple: Makes the spawner ignore spawn requirements for the mob it is spawning e.g. Will make monsters spawn even if the light level is to high.\n\%When broken you get back everything except the mob soul (it is to fragile and is destroyed when the spawner is broken) tile.draconicevolution:longRangeDislocator1.name=Admin Dislocator tile.draconicevolution:longRangeDislocator1.description=If you are a server admin or map creator this block is for you! (creative or op only as there is no recipe on purpose) Created at the behest of GreatOrator, it allows for a configurable range for teleporting. What makes this different is it is purely random. Nearest player to the block when activated with redstone will be teleported to a random location (default is 1000 minimum and 10,000 maximum) from the block. If that spot would place the player in water or in the air, a block is generated below them. @@ -62,11 +63,11 @@ tile.draconicevolution:draconium2.description=Used in the Ritual of Draconic Res tile.draconicevolution:cKeyStone.name=Creative Key Stone tile.draconicevolution:cKeyStone.description=Description -tile.draconicevolution:dissEnchanter.name=Diss-Enchanter +tile.draconicevolution:dissEnchanter.name=Disenchanter tile.draconicevolution:dissEnchanter.description=With this device you are now able to transfer enchantments from your items to books at the cost of experience. The cost is determined by the repair cost of the item and the repair cost of the item is decreased slightly each time. To use it simply place the enchanted item in the first slot a regular book in the center slot and press the transfer button. One enchantment (the first one) will be stripped from the item and applied to the book. When you strip an enchant the item will loos a percentage of its total durability this percentage is shown in the gui. You can decrease the damage bu placing book shelves around it or other enchanting boosters (It takes a total of 20 book shelves to prevent all damage). WARNING Items that use energy instead of durability will also be damaged and destroyed but will not show their damage value. tile.draconicevolution:teleporterStand.name=Dislocator Pedestal -tile.draconicevolution:teleporterStand.description=You have figured out how to create a simple pedestal on which you can place you basic or advanced charms of dislocation. Simply right click with a charm in your hand to place it on the pedestal then right click the pedestal to teleport. The advantage of this is the charms wont take damage or use fuel. The disadvantage is you can bring them with you to your destination. To remove the charm from the pedestal simply shift right click with an empty hand. +tile.draconicevolution:teleporterStand.description=You have figured out how to create a simple pedestal on which you can place you basic or advanced charms of dislocation. Simply right click with a charm in your hand to place it on the pedestal then right click the pedestal to teleport. The advantage of this is the charms wont take damage or use fuel. The disadvantage is you can bring them with you to your destination. To remove the charm from the pedestal simply shift right click with an empty hand\n\nWhen holding basic dislocator that has been renamed in an anvil or an enhanced dislocator with a destination set the name or destination will be displayed above the pedestal. If you hold shift all names will be hidden except the one you are looking at. (Shift behavior can be reversed in the config) tile.draconicevolution:draconiumChest.name=Draconic Chest tile.draconicevolution:draconiumChest.description=Using your draconic knowledge you have learned how to create the ultimate chest. With a massive 234 slot storage capacity a built in crafting table and 5 slot RF furnace capable of doubling ore as well as the ability to keep its contents when harvested this chest is the most powerful most versatile storage device in existence! It also comes in a variety of every colour you can imagine gust shift right click it with empty hand for details. @@ -224,11 +225,12 @@ msg.bowoutofgunpowder.txt=§4You need 4 gunpowder to use explosive mode msg.teleporterUnSet.txt=§cYou must first set the destination before you can teleport (Shift + Right click) msg.teleporterBound.txt=§aTeleporter bound to: msg.teleporterLowHealth.txt= §cYou are to low on health! -msg.teleporterSentMob.txt=The mob has been sent to +msg.teleporterSentMob.txt=The entity has been sent to msg.teleporterEntityDimensional.txt=§cYou can not send mobs across dimensions! msg.teleporterAlreadySet.txt=§cError this charm can only be bound to one location msg.teleporterOutOfFuel.txt=§cOUT OF FUEL!!! msg.teleporterOutOfPearls.txt=§cOut of Ender Pearls!!! +msg.teleporterPlayerT1.txt=You need a more powerful dislocator to do that msg.teleporterPlayerConsent.txt=The player must give their consent by sneaking msg.spawnerInfo1.txt=Mob Type msg.spawnerInfo2.txt=Requires Player @@ -237,9 +239,8 @@ msg.spawnerInfo4.txt=Spawner Tier msg.spawnerInfo5.txt=Shift Right click for upgrade info msg.spawnerInfo6.txt=Requires players : Nether Star msg.spawnerInfo7.txt=Ignore Spawn Requirements : Notch Apple -msg.spawnerInfo8.txt=Tier 1 : Infused Compound -msg.spawnerInfo9.txt=Tier 2 : Draconic Compound -msg.spawnerInfo10.txt=Tier 3 : ???... +msg.spawnerInfo8.txt=Tier 2 : Wyvern Core +msg.spawnerInfo9.txt=Tier 3 : Awakened Core msg.dislocatorUnsafe.txt=Destination Unsafe Please Try Again msg.dislocatorNoGround.txt=Error world not found msg.range.txt=Range: @@ -259,6 +260,7 @@ msg.draconiumChestEditL2.txt=Click the top half of the chest to increase the val msg.draconiumChestEditL3.txt=Or the bottom half of the chest to decrease the value msg.draconiumChestEditL4.txt=Right click with paper to copy the colour to other chests msg.draconiumChestEdit2.txt=Please use a single peace of paper +msg.de.dragonDeath.txt=§5The heart is temporarily awakened by the dragons explosive §5death //Tool Tips ---------------------------------------------------------------------------------------------------------------------------------------- info.teleporterInfUnset1.txt=Unbound @@ -312,6 +314,94 @@ info.de.changwMode.txt=Shift Right click to change mode enchantment.draconicevolution.reaperEnchant=Reaper +//Achievements ---------------------------------------------------------------------------------------------------------------------------------------- +draconicevolution.achievementPage.name=Draconic Evolution + +achievement.draconicevolution.dust=The Start of something BIG! +achievement.draconicevolution.dust.desc=Collect Draconium dust +achievement.draconicevolution.ingot=Better then Diamond! +achievement.draconicevolution.ingot.desc=Refine 4 Draconium dust into 2 Draconium Ingots +achievement.draconicevolution.core=This is where it begins +achievement.draconicevolution.core.desc=Craft a Draconic Core +achievement.draconicevolution.core2=Not Good Enough! +achievement.draconicevolution.core2.desc=Upgrade Draconic Core to Wyvern + +achievement.draconicevolution.dislocator=Endermen got nothin’ +achievement.draconicevolution.dislocator.desc=Create a dislocator +achievement.draconicevolution.chest=Never enough Storage! +achievement.draconicevolution.chest.desc=Craft a Draconic Chest +achievement.draconicevolution.particles=OOOOH Sparkles! +achievement.draconicevolution.particles.desc=Create a particle generator +achievement.draconicevolution.weather=Who Needs Mother Nature +achievement.draconicevolution.weather.desc=Craft a weather controller +achievement.draconicevolution.dissenchanter=Only What I Want! +achievement.draconicevolution.dissenchanter.desc=Create a disenchanter. +achievement.draconicevolution.ecore=It keeps going, and going, and going +achievement.draconicevolution.ecore.desc=Build the Energy Core +achievement.draconicevolution.wpick= +achievement.draconicevolution.wpick.desc= +achievement.draconicevolution.wshovel= +achievement.draconicevolution.wshovel.desc= +achievement.draconicevolution.wsword= +achievement.draconicevolution.wsword.desc= +achievement.draconicevolution.wbow= +achievement.draconicevolution.wbow.desc= +achievement.draconicevolution.whelm= +achievement.draconicevolution.whelm.desc= +achievement.draconicevolution.wchest= +achievement.draconicevolution.wchest.desc= +achievement.draconicevolution.wleggs= +achievement.draconicevolution.wleggs.desc= +achievement.draconicevolution.wboots= +achievement.draconicevolution.wboots.desc= +achievement.draconicevolution.resurrection=Brimming with Antici-pation! +achievement.draconicevolution.resurrection.desc=Craft the Resurrection Stone +achievement.draconicevolution.dislocator2=Ender-ruler! +achievement.draconicevolution.dislocator2.desc=Craft the Advanced Dislocator +achievement.draconicevolution.flux=1.21 jiggawatts! +achievement.draconicevolution.flux.desc=Craft the Wyvern Flux Capacitor + +achievement.draconicevolution.heart=Heart of the Dragon! +achievement.draconicevolution.heart.desc=Kill a Dragon and claim it’s heart. +achievement.draconicevolution.awakenedblock=It’s all in the ritual! +achievement.draconicevolution.awakenedblock.desc=Create Awakened Draconium +achievement.draconicevolution.core3=Expense vs. Power +achievement.draconicevolution.core3.desc=Upgrade Wyvern Core to Awakened + +achievement.draconicevolution.dhelm= +achievement.draconicevolution.dhelm.desc= +achievement.draconicevolution.dChest=Fly like an eagle! +achievement.draconicevolution.dChest.desc=Craft the Draconic Chest Plate +achievement.draconicevolution.dleggs= +achievement.draconicevolution.dleggs.desc= +achievement.draconicevolution.dboots= +achievement.draconicevolution.dboots.desc= + +achievement.draconicevolution.dpick=Mine With Authority! +achievement.draconicevolution.dpick.desc=Craft a Draconic Pick +achievement.draconicevolution.dshovel= +achievement.draconicevolution.dshovel.desc= +achievement.draconicevolution.daxe= +achievement.draconicevolution.daxe.desc= +achievement.draconicevolution.dsword= +achievement.draconicevolution.dsword.desc= +achievement.draconicevolution.dbow= +achievement.draconicevolution.dbow.desc= +achievement.draconicevolution.flux2=Phenomenal Cosmic Power! itty bitty living space. +achievement.draconicevolution.flux2.desc=Craft the Draconic Flux Capacitor +achievement.draconicevolution.dhoe=Kick it up a Notch! -BAM- +achievement.draconicevolution.dhoe.desc=Craft the Draconic Hoe + +achievement.draconicevolution.dstaff=With your powers combined! +achievement.draconicevolution.dstaff.desc=Create the Draconic Staff + +achievement.draconicevolution.soul= +achievement.draconicevolution.soul.desc= +achievement.draconicevolution.sundial= +achievement.draconicevolution.sundial.desc= +achievement.draconicevolution.manual= +achievement.draconicevolution.manual.desc= + //InfoHelper ---------------------------------------------------------------------------------------------------------------------------------------- info.de.charge.txt=Charge info.de.hold.txt=Hold diff --git a/src/main/resources/assets/draconicevolution/textures/models/TeleporterStand.png b/src/main/resources/assets/draconicevolution/textures/models/TeleporterStand.png index fb9ca84be67d2b9902d3b6230f9d1e2ff6e513c1..98ba56e065a3425766652bca345c6b05044f6426 100644 GIT binary patch delta 3395 zcmV-J4ZQNrAoLoLQhy5_0t+bQhRpK-01W|2L_t(|+U;6xj2p!nerDHq>tt>0I;R-U zr3F-U5K4*y32+qhK~&TtHISepJU?s+T1N?pYcwAtY>y+ckT04{eOp7vUcB{@$S6e&->02 z3SjAyB~;Tiym0UpQiB3o|2>r4NGB#H5DJCBjzl7Xd_E5VXf(EAa&y|K3g zkBw4(|AoP2G#ZTp0LI3~5Rb=+NUz%Yk@O4-B0N`x_#XR5r2CAQnrj{GT3LSUtyEQ2 zoI7_8i+dMRaetDo>xjqWn3$M=uIor75-1jn&~?4(n44*FA&-qx{HT}k@n|%Pd_IqS zK95i+^XtIy!HD6`u+VV6bgvP<1`wL()IiM zX`xV{OMjL;Lr>;zpr>++=t~>I)L~dQ^E;R9@U;-PRojAa+=UCkFbxM?%L zG))tQLZRuHU$ChOKL5~lNqqlL{gTf=bX^i#PwbTFP$+~aR^*V+=lOif*Q(Z;u%A0+ z!4(MogRo--wgm(npOuAR)dkSg(}R3IFPVEHk$=G0*jU3cienyMWIyKPKVOuTeBL-Z zf?apo%>MMqh-W-NSWNhj#MJwPa}kY3@f30xn>Pk#Q9@Snp+isroE#eiF${y2%Vl(T zcf&MIR4Nq!fTn4vR4Vv?kA3jL2YgZMp6f^Q$_^(=>#`VSgx!!UZrnISEx&Q7)G$yS{tj1z0t|18Z)) z06+L<#Fb*4{7f5w7m+!478y7^BAtzeNdQ1<-bM@@9M_(K3%9Y;iQU-GST|7D#8-Q>k0ex9sBf7dUjpQgj>e-nSb+m zGd)+r1B}6KD|0}x$Tb51k1iVoOcPJ9%wg;E{V0A8Y`xx&1$rbn7ak3*7@B0vZ~63g)at3#ft@OUhH-j3jPhP={Hh(fQ&-&wbVpGr6rAxz zn^7nfkS*+iX_}mN=XU@+3x6=}_q}2urQPk&#V3*KStpOzX~kZgjf(!2Hu2?5h%eL< zKm!#7Kn2*$gjIurMVa#$P0vLn5^+^+PM}OA62O%gB2`-x*kilE8C=X6WPerDC7B@pmt(Z< z^REvtL+_T?q!N_5%UgqA=V_4T_C~a!Jqx3PPn# zpTx$(V$V1k9v;T(Eq}l9MC+G+y&lUq?S=({KNu^ZX&Sxs(n|q=2c}>!h;q3M0H{{0 zICbh2G)+T`^N5HF*YEGggI8>j=!cgW*nG&q6Dx8Y%I@5`6S-Ut{r&v_fWg5*v}#d) zbf8kHpauny>UO&q!2DQTJOFfdcA{FXavA`_;qZ*-d5WPUBY$|RC&%ePxy*|pRv!RB z-{fxe{p50xU!Fw&UxyGNz>ZgkQNkw^rwSPUH<9q8!jko>-*qXSb@Qz)0qGoI%zhMp3NApnR(BA#NXcnd(%@1peP zNq(OpM6n(A;D3?_U0F!15}mB1n5M}Q9E{}7obs4T_f=0XQDK_41nr9!U_s>z7tMKm zd>rHBkI>P%6i9`Yuivfl8W4b~B zwLCE_K;Y88f7?tcl}dH(6DfC#_f6A8sZ_$$)D+hyGxLs)4$PS|2jOsd#`C5thL|;p z#ZW$<$F4han0<(W5(^;SUZCR^?$(&xEKwqnh^tR#U)x~DHkVSVgh(WU&dyGZkB>`% z&NNMw%YS8*%jFr*bGOtUU1mr0r&s2%_1FkXr4k=!#ZV%VK!1NfKDil~SPXzD_{DDr zJZ1Q~akJiqa<|B3bgMYXPOj;h3)DcQ#fpB-n5$N+2nK^Qo+q}{?ti{tq6e-`@_CFl zjy#NfK9A3r0&_yMpwFJ=%e(~z(Eu9m2}rI|see@PjIl!M;IQL>u}lItr%s*no#zHY ztn?_p$t29rCNVTL z1b=i#Jy4t12wfrHpl9(K#=Z^=(7ogxW46?`vY_BaV=0ZrV!oK4)zy(mgu~Va#u#z8 zzgA`5#=cEApbH8pO864%;Z5#F>ilgIRQ>S750Q->#J1X63>0@GRa=3xXV2Qj(An*P z7Q{x}grB`Vg4wUy>zF)zvH^n%&>d~q6@O+m4~2rj-_o<|^?XD!kytE-1)Kg%#D^Rl zxSDo%ccW+1AtIv2*9R`4vIYq5%Djzz=^H!?C>Dz_uoAis-j-rQ-8O5jJsw;Q9Y8jA z5JoW$Be)u<06jfX%--oJV%E2=hIPolMnEL!*#>jB=qMDB z=iltvR)Y;vh2_S>={dMQbKVCEt5P$=&KgAM^e7T&V$3(%uY=Sm@tUVQP1z>foY`i~ zTRs6$#0v@)g2HGzj^51290*x;e}55oi*0};`9;6(iE;* z)68jP1+^wLj{$~Z@J$hS-WHo1EX9>dCExtsXeTJX~K`X5zOXc_UJ0M3u~odNl3Nl*MBKX{yn+H$8w|Z#?d+QNJLECSQZdE@7`b z;1od)L+--CyHM3tTRT;x=wp_T={xa*G_eF{UQofbrcbA_hGzc@P|tS(q-g_z3SDGb z>#9o-iu9F;`->4d#d$4^`hQ@0_bzrTF@rWe69l{^BJpTk)Ef2q@2$*1)f2t-F~fK7mjbm>?b~%rL!QH^)zibQ+Dj;}bcEJ6#V_rJ}|SYUBlrT9z%x zi{?lJT;3QL%p~u(PRnpRKs}Mw-5(^re(lW)4)Zn1H06%7_oE3i?RS5T{CFmave7&O zfZ_{$DENXOZ2`0e&^#7ETL5hVv<1)>KwAK90kj3s7C>77Z2`0e&=x>j0Br%Z1@Hws Z{tI*AYAqxlM=AgS002ovPDHLkV1gggVP^mU delta 4130 zcmV+-5Z&+e8qFY(Qhy2>1pq2cgmahx01w(pL_t(|+O1oEtXtK6|D1d8dv^V_P zpVtl0s#nsIR-p+H*5(IjRg2U>QVofJ&}dUgyVCcV&0egDci*)6W%zZDMuD`MKop6I zb?cxbqLEe>s*;j~pjH*AuTipr<`6TI*?sRe_H%vD{A?c+zaJ^?r_0OBNTpI>uR@`Kdc6(+h^u>G;V21U zfxW5legC#GeCq_|zrQrQi)OP~0KnqnBJ%k>5zBiIzb9RTf(X~OA>Jo^6X|z0mY&iN z_T9Suw%e#}+kd!p=@PbY+d{=guInP7&trLc8LsQ1P$;0;Y{GTjfpzMj#g2UI1jV0j zBfLJF&7xkfqh7Bgl}c%4stwQ<-s(Nr;E8nK9*8i3tZ!i(=ih$xBhtl~VRmfzz7GIM zrBd*HpO?j#sV;!cSBiB=y#ApR7QV5qhi{&6xHYNP#ed2H{)2a#8Z1h!GyNtGII^Jd z(*mH(j?Ejel@?#F>+)5Ps|%DHn>zQ+6AAp;wvJ{&YMK47*MA4vO6tG&3~j_ki7bhP z6A=9%`j8Dmh_o7oLID7f&*ul$1=5Y=ReNc67rkM}tMv8S7wD!dh(HrPkCSM{vg8Zt^`nk&nP4> zzR2Fp$Ny?;QSy23^a76D6%O_-Y;!yT0BMrXVcm}2Xy?-ba3b1b9I!Os3NF)+Sr_-=3i%-CnD_3CK zHrnkrW#8}KauxP&8pFM}T!kr_&MSt=8 za`^H2@Z;y@wf$8l+%j&eT*gn!8zer!26$*s4QMv`$^gJ)yJi93$FqBCIQWBUG=B>m zyeY(jtiw2lY+Wi3F_lZHdr@6H0zcu0W&aLT-}F$L+y`AnZ|lQa`I@<=gaN-QQWOdWOubp*|1T5@m^%Nr z@N)M>pe26Mdim$^0&CJMd#E1!eB?`s~Mf7-X?MuIweg z53jRFs&}U^5HY%(FRpNZZ!{V_J$GFf-uWjuKQPrd8V!*7`FV+`xUP!}7cNL7rVoU4 z#CD@zkBrjp>H`;Jvwy$<7P_?@r{j#dn#xnn?_hspyH-!;=jU7WM-kbm;_PzzvwEOs6M#>dCe z?RI$?0MhC7s@rMF(5VGHJz3*rr`_hs5X%n$VCu?KnELaNfc(u_O#k~F90EM~>O8tw zK@u+K980iZVLi8&ORx|i#ogxuY*@Km4ivUPX`?8>upyJlAeYNwY-|i;V`GxvkByCC zWn~5Jc6-(B)PH2?X(1T`fJ`Q%B}2{60Hpj2w0?S)|IQeqD2F|?;~^yqiCJP4l`P-) zIfG+}-|L4q_6KIp;wzm_Bb`ojKw+=dwA=T>v?Q)Ds#@DQ%h@5TKXPXc&1REZfkPs) zgY_vz(}>bzD*bM2TB5~PIuKT0w15CM@3?5rOG`^wT7OzXx7&s9`{;JNt8V9QDRSys z+PELS@AEQCvs0-QyweL@ZzvQBSl$j;OpjTg0%)LNm_wkfzF9W2TCG-p^@$X_#ovA3 zN2}Gs%E}5~O=jj}V`EsiZXMF;^s3tpONN*=iOEpCUdNF;Ygl`nk&*x)x)vC@g({87 zVu_W>WPcQ$Ec_mlnb2HXtrjww493UDv9z=#0iEyrXt&#Fx7(|3r%Gy%?Fte7**!HJ zJhOmStHtYCGE^uOFg-nu4?YbnZwEju{PlNdv^4zElHXUMREb<>w^qdLpz&5$}=|>c{^72PJca$dcBU{?gZAQ*1%o6#yI!@7P1av z_XH$Y>2x~yp0`_4aMC+$GJkaO2_TWge%y+`d}9G?Uk&?l<>c9z0b0OB zHdYm8IS+*e=V#@${d_(nnMf{|!{!J7m53KPHgf}=n3%xigU5-;8h{5A>zpFD7eh}QDf z{3iO*18v1SX2Oo6XiU%Ro>@BDCql( zxLX_&B-!Ue(m}AdavJ~GAG~?@)*i5mktPvHyEk(DrXx&7F9!9+9Dq$Mc^%s&?LL5w z&s6F-NbaGk$f$y##Nz04Br21DA!SwU|=nPY(Gd3;kujepysxWPhP ztJN~b_qd&){DJog)%N#E>;?*389JhAk5U&1`-y5jc@4KKW@74)yb&o6#Fos9YAbCX zRKT%-3|!IsZv6(1y!NEUvO_IXasoF}ysU7px}kk6xDPwnH^!RrNt)^lLpTM1${1 zrYS4V`k@Ij^xR*ZAAhfgQO31%)R0G&!;Mr4S9(aaVo;vM9Frl6E2vz-7TnCz&M?ZP z${sj@bij#K2?PV9>6>Vz>fbWhiS>aJw{@_L&k@Y1ZfhVK=lem-u~?HOIN~78es3%B z*ETRfTS;Y!!uD()cTFfB3@n?O<1l=nLypo4E?^1BFNZ@jQh&#v$~KXxz7L$+px%SOXIu{gWu}LX@yPm;nZc6gbWzoInX@ zK`iAp`KHR?h~}3OpvAFETN$uwJtP*`=m^@tu;&FFxpPFz3j*V|k{I`G<5_*Gt(;{D zpQDGw-UzEsV}I&;!!SVhWn$P$GMT*!OePj-DHEhd5KAIeA_fHmvOd$`blqQ|(*rEV z(UI2H$WEY8z6?T*H9{5X|ZmE}j3)*OBFkSHA`&_xq-dmR`p z!;>Sr3&iCRYGP$dh=!%W!*m13oFtetFa7+l93Fd`d4JmmEFi}8+RXfj@v#?k6tRtZ z!Z1<9iB{RxNRXPQ#wSU(#?VCSOEs=R22f@_-kV%5?wO!rVbPEa#HEzFD?nj*Y6zpT zh;Cw&gEfOd(mMhKA_6V$~E^XgIw^~nI1W^0eB==eZ}D7cJH%Mn9lkv#)O znC`CvvVTKkWH9-rx&%%YiJ5AyWR}jU!P-pjrwXQK-O|#mqc`A4jLCW&6A01RY>F6Y zu5GlMKvR!(*9l^Q(hRmiteM+J@E-PDp`ZuIKB;qYOFM@b#OQ~nSWJzBGm#!*Fnvqf z&u5z-RC&}dE`kl+7l< z;1L*d{~$(+qecl#KijBJ6dAg6?C2XD`XH#0kf^&taStrpMowVL2IDLuFkp!eY&t;- gh8sLkO=01G0XCPUBX*hp-~a#s07*qoM6N<$g3JN{_y7O^ diff --git a/src/main/resources/assets/draconicevolution/textures/models/power_sphere_layer_1 - Copy.png b/src/main/resources/assets/draconicevolution/textures/models/power_sphere_layer_1 - Copy.png new file mode 100644 index 0000000000000000000000000000000000000000..cfb628b83c4fd465cd74b4bb0a8a7167ecaa1944 GIT binary patch literal 525 zcmV+o0`mQdP)G3on%F=Mw+`0h&of zK~y-)rIJ04(@+#f&+~h>W5;pqiIXtlrx{TMs*xfnC}06BfE}?9RzS-J*a*#llnjXy z|2#kYQlwyDfB|y*b98m|!3noaR-#UU0n{n*e+h2F|15YqdM<-7#%P1<9JMX~UT`^i zC3#X{Oo&pTwc+#n6Z$Uj?VI;rx!(4Z@ja3_BML|4>6Er@Xr0B}0h^CB**Qga zpYbrm_Xjv-Qe@{mm^~&4hS;t_%CBhc<0+4>ckIe*_T@F# zyDR#>`z}}}D+&FGba=+@upzJ|M*9Ht($P9c-&ywMj_v*nRkH^;3U1DGci0fN6-I{` zZ9pkRj=`+0*&f!^wnXHJs9W1s9)Uk#;Kvx_qm;sREw!z%wxXBrhi2aZVEMKYg++}B P00000NkvXXu0mjfixB2e literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/draconicevolution/textures/models/power_sphere_layer_1.png b/src/main/resources/assets/draconicevolution/textures/models/power_sphere_layer_1.png index cfb628b83c4fd465cd74b4bb0a8a7167ecaa1944..b17669a117e8846c4aa2bc8d9d94418589b98374 100644 GIT binary patch delta 452 zcmV;#0XzPU1mpvdDu4d~{{a7>y{D4^000SaNLh0L01m+b01m+cxRGn^00007bV*G` z2i^<=6F3!DhtMei00D7HL_t(I%cYXduA(p)Ku;+IEQlbu;8_SOUHW!Dk56QBjR7L1 zw4H^CbDh6CGj@MY`kn8CH(uMeUc3VXh z&vT+E0zgX1<#IuO1)ff)KnUT=vLsDYR;v}8%?4u(%d!xD0f*=F+3a>Z%CbZ$MI6U` ze0&fD0bv;a`3G5+*}AT2nuek%P)cEpL2HfHnrWH{eg_|qM_&{LbzPHX8A>UH5D4+e z=A2_$mR}3@`+vR9^PD`-QA&{{3C=mZe{9fuk1>X6ntpE3b)B!OimIwe)08NRFvj4$ z$9s>p_8CxX{VHhN)^E34nx-L15|(9Q97m*-1VMmvj$s%WhJow#inaE;plw?p$1&^m znqe3o_Aq>z*ILUsj@)iH?)N*uL-6@L`@UzM=f{eqL_G-coOzyS`o2eN{p=xryzL+e uh@yx%jtRpMAq2~^FwZkuYn*d0&AtImhPot42ES_n0000e3;;A8Jp0=K000SaNLh0L01m+b01m+cxRGn^00007bV*G` z2i^x55(_Vs>gN*x00EjwL_t(I%cYV%j?+*SM$hwmwqwU}?1_^w;inl<1geoDC@5e7 zEPx%c4^}|S2G|JAfRqf068}6u`%a8 zcshD6gD}QugXp2RLUzKoDGKX+VSkXoj3E=fx-11Vg$_&Ve`FNRTHnUMu8mD2z!Vc&@OPZHsG?8H`M_9onUBd zU0;Ul<2EzLuV*CZ}Wa6x*=a73}FK}wcOiYM|#D`VMV zFp{3}@rod0z2N?iB&mnC%9-CXyJh}`Di<|BMv1X#OnOu&MKg+|=JmTEU$R~@|IX|y ztNZpP=E&MH&Tm*f5)bLejml+BdG*Mj8}eD(bzpE^J%8~Ly-}@ql++hg%NktF>gjjv YA6wjtLG$8T>i_@%07*qoM6N<$f+;oVNB{r; literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/draconicevolution/textures/models/pylon_sphere_texture.png b/src/main/resources/assets/draconicevolution/textures/models/pylon_sphere_texture.png index 0efaa8911238faceff9568db1bdca8ef5aab4dd6..e56569263f945ca5ba311067ffe0dff7b3aa2898 100644 GIT binary patch delta 432 zcmV;h0Z;yx1o#7xQhy8r78EV`!={%200D(bL_t(I%azhiPZLoX#qr;~(l$)dp%TLa z2@66D3)Zas8h&e+#)UD27-K*y#ikvnGcImBZNVr$$>h#W?*H89Jm*IGZ{8viYPGH^ zT7Ka?;@~`a?7!&*iqp*Kl=7V6A;W_J=1Zil z`8C}VSl^tL!GClAh~gzhNmDa#f=Js?-BW$*EHvw+)6Cv$_RlE}8SGL|1EgU#qrRt_ zb}_bF@1i*4)g@8MV#>{Ddc82TdBx4gIOx+8zKWeHOiy4zI zj6X8J>0aUjJ6#WxE9Q6P1G0Si&YIBj{EnYjRO8Ndx+w+McOm0sH{_l6fBd1IeD|hD7P{I00001r#nz)W1KV&tx2Pb z14SGVLL4}A;{Ts|ta_*_giuvMn-Ur&u4DIL$1#D9wA%6Pyq!1m)`7wG9byE{4q@}X zSydCSuttF#(+GQr8qh9qvo_$elQ-1>`<-BDYh7Q51&lXNgn!;EbOSGK6B~AeQF9P> zlB)kyEd@~`&In?voP5^y-US3Z;0l%gB#|D|8`292V;(+MxGm50<^}8TnvR*R(&g?6z`$zUA=E&MH&Tm*f5)bLejml+B zdG*Mj8}eD(bzpE^J%8~Ly-}@ql++hg%NktF>gjjvA6wjtLG$8T>i_@%07*qoM6N<$ Ef;8XQEC2ui