mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
04/12/14
This commit is contained in:
1 parent
46b464caa0
commit
fa0a6bbcd5
51 files changed
+1353
-482
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
+85
-1
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -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);
|
||||
|
||||
+6
-8
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -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;
|
||||
}
|
||||
|
||||
+2
@@ -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);
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+42
-11
@@ -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()
|
||||
}
|
||||
+13
-1
@@ -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();
|
||||
|
||||
|
||||
+90
-4
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
+108
-10
@@ -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<String, Achievement> achievementsList = new HashMap<String, Achievement>();
|
||||
private static HashMap<String, AchievementCondition> achievementItems = new HashMap<String, AchievementCondition>();
|
||||
|
||||
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; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+9
-2
@@ -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();
|
||||
}
|
||||
|
||||
+105
-1
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
+59
-16
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<String> 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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
+64
-90
@@ -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);
|
||||
}
|
||||
}
|
||||
+47
-54
@@ -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;
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<MountUpdatePacket, IMessage> {
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -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);
|
||||
|
||||
+10
-9
@@ -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;
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
|
||||
+92
-18
@@ -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<AchievementPage>());
|
||||
// }
|
||||
// }
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
+66
-93
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-9
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<PotionEffect>) 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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user