mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
Commit 17/11/2014
This commit is contained in:
1 parent
4d645d235f
commit
5831031d42
99 files changed
+2042
-1576
No files matched your search
@@ -11,10 +11,11 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION, canBeDeactivated = false, guiFactory = References.GUIFACTORY, dependencies = "after:NotEnoughItems;after:NotEnoughItems;after:ThermalExpansion;after:ThermalFoundation")
|
||||
@Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION, canBeDeactivated = false, guiFactory = References.GUIFACTORY, dependencies = "after:NotEnoughItems;after:NotEnoughItems;after:ThermalExpansion;after:ThermalFoundation;")
|
||||
public class DraconicEvolution {
|
||||
|
||||
@Mod.Instance(References.MODID)
|
||||
@@ -25,9 +26,13 @@ public class DraconicEvolution {
|
||||
|
||||
public static CreativeTabs tolkienTabToolsWeapons = new DETab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons", 0);
|
||||
public static CreativeTabs tolkienTabBlocksItems = new DETab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems", 1);
|
||||
|
||||
public static final String networkChannelName = "DraconicEvolution";
|
||||
public static SimpleNetworkWrapper network;
|
||||
|
||||
public static boolean debug = false;
|
||||
|
||||
public static Enchantment reaperEnchant;
|
||||
|
||||
public DraconicEvolution()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client.creativetab;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -16,7 +16,7 @@ public class DETab extends CreativeTabs {
|
||||
static ItemStack iconStackStaff;
|
||||
|
||||
public static void initialize() {
|
||||
iconStackStaff = EnergyHelper.setDefaultEnergyTag(new ItemStack(ModItems.draconicDistructionStaff), 100000000);
|
||||
iconStackStaff = ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDistructionStaff), "Energy", 100000000);
|
||||
}
|
||||
|
||||
public DETab(int id, String modid, String label, int tab) {
|
||||
|
||||
+2
-3
@@ -32,7 +32,6 @@ import java.util.List;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
|
||||
public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler {
|
||||
//todo unify gui headings
|
||||
public EntityPlayer player;
|
||||
private TileDraconiumChest tile;
|
||||
private static final ResourceLocation textureLeft = new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DraconicChestLeft.png");
|
||||
@@ -60,7 +59,7 @@ public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler {
|
||||
drawTexturedModalRect(guiLeft+387, guiTop+236, 44, 177, 90, 16);
|
||||
drawTexturedModalRect(guiLeft+387, guiTop+180, 44, 177, 90, 16);
|
||||
|
||||
int arrowHight = (int)(((float)tile.smeltingProgressTime / (float)tile.smeltingCompleateTime) * 22f);//todo maby need adjustment
|
||||
int arrowHight = (int)(((float)tile.smeltingProgressTime / (float)tile.smeltingCompleateTime) * 22f);
|
||||
drawTexturedModalRect(guiLeft+140, guiTop+192+22-arrowHight, 140, 216+22-arrowHight, 16, arrowHight);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(textureRight);
|
||||
@@ -74,7 +73,7 @@ public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("tile.draconicevolution:draconiumChest.name"), 4, 4, 0x00FFFF);
|
||||
fontRendererObj.drawString(tile.getInventoryName(), 4, 4, 0x222222);
|
||||
//fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("button.de.chestAutoFeed.txt"), 4, 180, 0x00FFFF);
|
||||
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
|
||||
+10
-2
@@ -7,6 +7,7 @@ import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.network.TeleporterPacket;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -249,6 +250,13 @@ public class GUITeleporter extends GuiScreen
|
||||
else maxOffset = 0;
|
||||
if (selrctionOffset > maxOffset) selrctionOffset = maxOffset;
|
||||
if (selected > locations.size() || selected < 0) selected = Math.max(locations.size() - 1, 0);
|
||||
if ((selected + selrctionOffset)+1 > locations.size()){
|
||||
selected = 0;
|
||||
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;
|
||||
((GuiButton) buttonList.get(1)).enabled = false;
|
||||
@@ -472,8 +480,8 @@ public class GUITeleporter extends GuiScreen
|
||||
|
||||
private void readDataFromItem(ItemStack teleporter){
|
||||
this.selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0);
|
||||
this.selrctionOffset = ItemNBTHelper.getIntager(teleporter, "SelectionOffset", 0);
|
||||
this.fuel = ItemNBTHelper.getIntager(teleporter, "Fuel", 0);
|
||||
this.selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0);
|
||||
this.fuel = ItemNBTHelper.getInteger(teleporter, "Fuel", 0);
|
||||
|
||||
locations.clear();
|
||||
|
||||
|
||||
+30
-22
@@ -1,40 +1,48 @@
|
||||
package com.brandon3055.draconicevolution.client.render.block;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ICustomItemData;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 25/10/2014.
|
||||
* Created by Brandon on 16/11/2014.
|
||||
*/
|
||||
public class RenderDraconiumChest implements ISimpleBlockRenderingHandler {
|
||||
public class RenderDraconiumChest implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileDraconiumChest(), 0.0D, 0.0D, 0.0D, 0.0F);//todo find a way to render the block the correct colour
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
ModelChest chest;
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
public RenderDraconiumChest() {
|
||||
chest = new ModelChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return References.idDraconiumChest;
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
TileDraconiumChest tile = new TileDraconiumChest();
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey(ICustomItemData.tagName)) tile.readDataFromItem(item.getTagCompound().getCompoundTag(ICustomItemData.tagName), item);
|
||||
|
||||
if (type == ItemRenderType.ENTITY)
|
||||
{
|
||||
GL11.glTranslated(-0.5D, 0, -0.5D);
|
||||
}
|
||||
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
+7
-15
@@ -1,21 +1,19 @@
|
||||
package com.brandon3055.draconicevolution.client.render.block;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderEnergyInfuser implements IItemRenderer
|
||||
{
|
||||
TileEntitySpecialRenderer render;
|
||||
private TileEnergyInfuser dummytile;
|
||||
private TileEnergyInfuser tile;
|
||||
|
||||
public RenderEnergyInfuser(TileEntitySpecialRenderer render, TileEnergyInfuser dummy) {
|
||||
this.render = render;
|
||||
this.dummytile = dummy;
|
||||
public RenderEnergyInfuser() {
|
||||
this.tile = new TileEnergyInfuser();
|
||||
this.tile.rotation = 0f;
|
||||
this.tile.running = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,13 +33,7 @@ public class RenderEnergyInfuser implements IItemRenderer
|
||||
{
|
||||
if (type == ItemRenderType.ENTITY)
|
||||
GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
|
||||
dummytile.xCoord = 0;
|
||||
dummytile.yCoord = 0;
|
||||
dummytile.zCoord = 0;
|
||||
dummytile.setWorldObj(Minecraft.getMinecraft().theWorld);
|
||||
dummytile.rotation = 0F;
|
||||
dummytile.running = false;
|
||||
render.renderTileEntityAt(this.dummytile, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-15
@@ -1,23 +1,18 @@
|
||||
package com.brandon3055.draconicevolution.client.render.block;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderParticleGen implements IItemRenderer
|
||||
{
|
||||
TileEntitySpecialRenderer render;
|
||||
private TileEntity dummytile;
|
||||
private TileEntity tile;
|
||||
|
||||
public RenderParticleGen(TileEntitySpecialRenderer render, TileEntity dummy) {
|
||||
this.render = render;
|
||||
this.dummytile = dummy;
|
||||
public RenderParticleGen() {
|
||||
this.tile = new TileParticleGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,11 +34,7 @@ public class RenderParticleGen implements IItemRenderer
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY)
|
||||
GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
|
||||
this.dummytile.xCoord = 0;
|
||||
this.dummytile.yCoord = 0;
|
||||
this.dummytile.zCoord = 0;
|
||||
this.dummytile.setWorldObj(Minecraft.getMinecraft().theWorld);
|
||||
this.render.renderTileEntityAt(this.dummytile, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
+2
-3
@@ -18,7 +18,7 @@ import static org.lwjgl.opengl.GL11.*;
|
||||
public class RenderTileDraconiumChest extends TileEntitySpecialRenderer{
|
||||
|
||||
ModelChest model;
|
||||
private ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/DraconiumChest.png");//todo make final
|
||||
private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/DraconiumChest.png");
|
||||
private Random random;
|
||||
|
||||
public RenderTileDraconiumChest()
|
||||
@@ -37,7 +37,7 @@ public class RenderTileDraconiumChest extends TileEntitySpecialRenderer{
|
||||
return;
|
||||
}
|
||||
int facing = 3;
|
||||
if (tile != null && tile.hasWorldObj()) {
|
||||
if (tile.hasWorldObj()) {
|
||||
facing = tile.getFacing();
|
||||
}
|
||||
bindTexture(texture);
|
||||
@@ -71,7 +71,6 @@ public class RenderTileDraconiumChest extends TileEntitySpecialRenderer{
|
||||
lidangle = 1.0F - lidangle;
|
||||
lidangle = 1.0F - lidangle * lidangle * lidangle;
|
||||
model.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F);
|
||||
// Render the chest itself
|
||||
model.renderAll();
|
||||
glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glPopAttrib();
|
||||
|
||||
+5
-10
@@ -2,8 +2,6 @@ package com.brandon3055.draconicevolution.client.render.tile;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
@@ -13,7 +11,6 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer
|
||||
@@ -30,23 +27,21 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
TileEnergyInfuser tile = (TileEnergyInfuser) tileEntity;
|
||||
renderBlock(tile, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity.getWorldObj().getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
renderBlock(tile);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderBlock(TileEnergyInfuser tile, World world, int x, int y, int z, Block block)
|
||||
public void renderBlock(TileEnergyInfuser tile)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
bindTexture(texture);
|
||||
|
||||
tessellator.setColorRGBA(255, 255, 255, 255);
|
||||
tessellator.setBrightness(200);
|
||||
int l = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
|
||||
int l1 = l % 65536;
|
||||
int l2 = l / 65536;
|
||||
//tessellator.setBrightness(200);
|
||||
|
||||
tessellator.setColorOpaque_F(1f, 1f, 1f);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2);
|
||||
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2);
|
||||
|
||||
drawBase(tessellator);
|
||||
drawWings(tessellator, tile);
|
||||
|
||||
+10
-22
@@ -1,25 +1,21 @@
|
||||
package com.brandon3055.draconicevolution.client.render.tile;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderTileParticleGen extends TileEntitySpecialRenderer
|
||||
@@ -43,12 +39,13 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
TileParticleGenerator tileEntityGen = (TileParticleGenerator) tileEntity;
|
||||
renderBlock(tileEntityGen, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity.getWorldObj().getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord), f);
|
||||
|
||||
renderBlock(tileEntityGen, f);
|
||||
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderBlock(TileParticleGenerator tl, World world, int x, int y, int z, Block block, float f3) {
|
||||
public void renderBlock(TileParticleGenerator tl, float f3) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
boolean inverted = tl.inverted;
|
||||
@@ -56,23 +53,13 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
//GL11.glDisable(GL11.GL_LIGHTING);
|
||||
bindTexture(texture);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
tessellator.setColorRGBA(255, 255, 255, 255);
|
||||
//tessellator.setBrightness(200);
|
||||
|
||||
int l = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
|
||||
int l1 = l % 65536;
|
||||
int l2 = l / 65536;
|
||||
tessellator.setColorOpaque_F(1f, 1f, 1f);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2);
|
||||
|
||||
//tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1F);
|
||||
|
||||
|
||||
{//Draw Corners
|
||||
float f = 0.4F;
|
||||
drawCornerCube(tessellator, f, f, f, 1F - f, inverted, stabilizerMode);
|
||||
@@ -104,7 +91,7 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
//GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (stabilizerMode)
|
||||
@@ -195,7 +182,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer
|
||||
GL11.glDepthMask(true);
|
||||
OpenGlHelper.glBlendFunc(770, 1, 1, 0);
|
||||
|
||||
float time = (float)tile.getWorldObj().getTotalWorldTime() + f;
|
||||
//float time = (float)tile.getWorldObj().getTotalWorldTime() + f;
|
||||
float time = tile.rotation + f;
|
||||
float upMot = -time * 0.2F - (float) MathHelper.floor_float(-time * 0.1F);
|
||||
byte scaleMult = 1;
|
||||
double rotation = (double)time * 0.025D * (1.0D - (double)(scaleMult & 1) * 2.5D);
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InventoryUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/11/2014.
|
||||
*/
|
||||
public abstract class BlockCustomDrop extends BlockContainerDE {
|
||||
public BlockCustomDrop(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
/**If true the tile will drop its inventory when broken*/
|
||||
protected abstract boolean dropInventory();
|
||||
|
||||
/**If true the tile will a custom block with custom data when broken
|
||||
* use getCustomTileEntityCrop to specify the lock that should be dropped*/
|
||||
protected abstract boolean hasCustomDropps();
|
||||
|
||||
/**Use to specify custom drops*/
|
||||
protected abstract void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes);
|
||||
|
||||
private void getCustomDrops(TileEntity te, List<ItemStack> droppes){
|
||||
if (te == null) return;
|
||||
if (hasCustomDropps()){
|
||||
getCustomTileEntityDrops(te, droppes);
|
||||
}
|
||||
if (dropInventory() && te instanceof IInventory){
|
||||
droppes.addAll(InventoryUtils.getInventoryContents((IInventory)te));
|
||||
for (int i = 0; i < ((IInventory)te).getSizeInventory(); i++) ((IInventory)te).setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
if (willHarvest) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
boolean result = super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
|
||||
if (result) {
|
||||
List<ItemStack> teDrops = Lists.newArrayList();
|
||||
getCustomDrops(te, teDrops);
|
||||
for (ItemStack drop : teDrops)
|
||||
dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> result = Lists.newArrayList();
|
||||
if (!hasCustomDropps()) result.addAll(super.getDrops(world, x, y, z, metadata, fortune));
|
||||
if (hasCustomDropps() || dropInventory()) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
getCustomDrops(te, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,16 @@ public class BlockDE extends Block {
|
||||
|
||||
public BlockDE(final Material material) {
|
||||
super(material);
|
||||
|
||||
this.setHardness(5F);
|
||||
this.setResistance(10.0F);
|
||||
}
|
||||
|
||||
public BlockDE() {
|
||||
super(Material.rock);
|
||||
super(Material.iron);
|
||||
this.setHardness(5F);
|
||||
this.setResistance(10.0F);
|
||||
}
|
||||
//todo unify block resistance and hardness
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
|
||||
@@ -26,8 +26,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
public class CKeyStone extends BlockDE {
|
||||
private IIcon blockIcon1;
|
||||
public CKeyStone(){
|
||||
this.setHardness(10F);
|
||||
this.setResistance(100F);
|
||||
this.setBlockUnbreakable();
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setBlockName(Strings.cKeyStoneName);
|
||||
ModBlocks.register(this, CKeyStoneItemBlock.class);
|
||||
@@ -103,10 +102,10 @@ public class CKeyStone extends BlockDE {
|
||||
TileCKeyStone tile = world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null;
|
||||
if (tile != null) {
|
||||
ItemStack key = new ItemStack(ModItems.key);
|
||||
ItemNBTHelper.setIntager(key, "KeyCode", tile.getKeyCode());
|
||||
ItemNBTHelper.setIntager(key, "X", x);
|
||||
ItemNBTHelper.setIntager(key, "Y", y);
|
||||
ItemNBTHelper.setIntager(key, "Z", z);
|
||||
ItemNBTHelper.setInteger(key, "KeyCode", tile.getKeyCode());
|
||||
ItemNBTHelper.setInteger(key, "X", x);
|
||||
ItemNBTHelper.setInteger(key, "Y", y);
|
||||
ItemNBTHelper.setInteger(key, "Z", z);
|
||||
return key;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -6,14 +6,10 @@ import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockMobSpawner;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -37,10 +33,10 @@ import java.util.Random;
|
||||
public class CustomSpawner extends BlockDE{
|
||||
public CustomSpawner()
|
||||
{
|
||||
super(Material.rock);
|
||||
this.setBlockName(Strings.customSpawnerName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setHardness(10F);
|
||||
this.setResistance(2000F);
|
||||
this.setHarvestLevel("pickaxe", 3);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -29,9 +28,8 @@ public class Draconium extends BlockDE {
|
||||
private final int CHARGED_DRACONIUM_META = 2;
|
||||
IIcon icons[] = new IIcon[3];
|
||||
public Draconium() {
|
||||
super(Material.iron);
|
||||
this.setHardness(10F);
|
||||
this.setResistance(100F);
|
||||
this.setResistance(20F);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setBlockName(Strings.draconiumName);
|
||||
ModBlocks.register(this, DraconiumItemBlock.class);
|
||||
|
||||
+17
-123
@@ -3,11 +3,10 @@ package com.brandon3055.draconicevolution.common.blocks;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumChestItemBlock;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InventoryUtils;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ICustomItemData;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -38,15 +37,14 @@ import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
/**
|
||||
* Created by Brandon on 28/10/2014.
|
||||
*/
|
||||
public class DraconiumChest extends BlockContainerDE {
|
||||
public class DraconiumChest extends BlockCustomDrop {
|
||||
public DraconiumChest() {
|
||||
super(Material.iron);
|
||||
this.setBlockName(Strings.draconiumChestName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
this.setHardness(3f);
|
||||
this.setResistance(200.0f);
|
||||
this.setResistance(2000.0f);
|
||||
|
||||
ModBlocks.register(this, DraconiumChestItemBlock.class);
|
||||
}
|
||||
@@ -187,6 +185,7 @@ public class DraconiumChest extends BlockContainerDE {
|
||||
{
|
||||
TileDraconiumChest tedc = (TileDraconiumChest) te;
|
||||
tedc.setFacing(chestFacing);
|
||||
if (itemStack.hasDisplayName()) tedc.setCustomName(itemStack.getDisplayName());
|
||||
world.markBlockForUpdate(i, j, k);
|
||||
}
|
||||
}
|
||||
@@ -233,131 +232,26 @@ public class DraconiumChest extends BlockContainerDE {
|
||||
blockIcon = par1IconRegister.registerIcon(References.RESOURCESPREFIX + "draconiumChest");
|
||||
}
|
||||
|
||||
|
||||
//TODO Tidy up the crazy mess!!!! and make a block class to handle this type of block also create an interface for tiles that keep their data when harvested similar to openblocks but simpler (two methods one to write to item one to read from item)
|
||||
// public boolean hasTileEntityDrops() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public boolean hasNormalDrops() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public void getTileEntityDrops(TileEntity te, List<ItemStack> result, int fortune) {
|
||||
// ItemStack stack = new ItemStack(ModBlocks.draconiumChest);
|
||||
// if (te instanceof TileDraconiumChest){
|
||||
// TileDraconiumChest chest = (TileDraconiumChest)te;
|
||||
// NBTTagCompound tileTag = new NBTTagCompound();
|
||||
// NBTTagCompound itemTag = new NBTTagCompound();
|
||||
// chest.writeToItem(tileTag);
|
||||
// itemTag.setTag("TileCompound", tileTag);
|
||||
// stack.setTagCompound(itemTag);
|
||||
// }
|
||||
// result.add(stack);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
// LogHelper.info(willHarvest);
|
||||
// if (willHarvest && hasTileEntityDrops() && !player.capabilities.isCreativeMode) {
|
||||
// final TileEntity te = world.getTileEntity(x, y, z);
|
||||
//
|
||||
// boolean result = super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
//
|
||||
// if (result) {
|
||||
// List<ItemStack> teDrops = Lists.newArrayList();
|
||||
// getTileEntityDrops(te, teDrops, 0);
|
||||
// for (ItemStack drop : teDrops)
|
||||
// dropBlockAsItem(world, x, y, z, drop);
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
// }
|
||||
//
|
||||
public static boolean getTileInventoryDrops(TileEntity tileEntity, List<ItemStack> drops) {
|
||||
if (tileEntity == null) return false;
|
||||
|
||||
if (tileEntity instanceof IInventory) {
|
||||
drops.addAll(InventoryUtils.getInventoryContents((IInventory) tileEntity));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
// ArrayList<ItemStack> result = Lists.newArrayList();
|
||||
// return result;
|
||||
// }
|
||||
private void getTileEntityDrops(TileEntity te, List<ItemStack> result, int fortune) {
|
||||
if (te != null) {
|
||||
//getTileInventoryDrops(te, result);
|
||||
//if (te instanceof ISpecialDrops) ((ISpecialDrops)te).addDrops(result, fortune);
|
||||
getCustomTileEntityDrops(te, result, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> result, int fortune) {
|
||||
ItemStack stack = new ItemStack(ModBlocks.draconiumChest);
|
||||
if (te instanceof TileDraconiumChest){
|
||||
TileDraconiumChest chest = (TileDraconiumChest)te;
|
||||
NBTTagCompound tileTag = new NBTTagCompound();
|
||||
NBTTagCompound itemTag = new NBTTagCompound();
|
||||
chest.writeToItem(tileTag);
|
||||
itemTag.setTag("TileCompound", tileTag);
|
||||
stack.setTagCompound(itemTag);
|
||||
}
|
||||
result.add(stack);
|
||||
}
|
||||
|
||||
protected boolean hasNormalDrops() {
|
||||
@Override
|
||||
protected boolean dropInventory() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean hasTileEntityDrops() {
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
// This is last place we have TE, before it's removed,
|
||||
// When removed by player, it will be already unavailable in
|
||||
// getBlockDropped
|
||||
// TODO: evaluate, if new behaviour can be used
|
||||
if (willHarvest && hasTileEntityDrops() && !player.capabilities.isCreativeMode) {
|
||||
final TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
boolean result = super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
|
||||
if (result) {
|
||||
List<ItemStack> teDrops = Lists.newArrayList();
|
||||
getTileEntityDrops(te, teDrops, 0);
|
||||
for (ItemStack drop : teDrops)
|
||||
dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
|
||||
return result;
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
ItemStack stack = new ItemStack(ModBlocks.draconiumChest);
|
||||
if (te instanceof ICustomItemData){
|
||||
ICustomItemData chest = (ICustomItemData)te;
|
||||
NBTTagCompound tileTag = new NBTTagCompound();
|
||||
if (!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound());
|
||||
chest.writeDataToItem(tileTag, stack);
|
||||
stack.getTagCompound().setTag(ICustomItemData.tagName, tileTag);
|
||||
}
|
||||
|
||||
return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
droppes.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> result = Lists.newArrayList();
|
||||
if (hasNormalDrops()) result.addAll(super.getDrops(world, x, y, z, metadata, fortune));
|
||||
if (hasTileEntityDrops()) {
|
||||
final TileEntity te = world.getTileEntity(x, y, z);
|
||||
getTileEntityDrops(te, result, fortune);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,8 +25,9 @@ public class DraconiumOre extends BlockDE {
|
||||
super(Material.rock);
|
||||
this.setBlockName(Strings.draconiumOreName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setHardness(5f);
|
||||
this.setHardness(10f);
|
||||
this.setResistance(20.0f);
|
||||
this.setHarvestLevel("pickaxe", 4);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
|
||||
+11
-15
@@ -1,38 +1,34 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ParticleGenerator extends BlockDE
|
||||
{
|
||||
public static Block instance;
|
||||
|
||||
public ParticleGenerator() {
|
||||
super(Material.rock);
|
||||
this.setBlockName(Strings.particleGeneratorName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
this.setLightOpacity(0);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -17,12 +17,8 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
public class Potentiometer extends BlockDE
|
||||
{
|
||||
@@ -38,7 +34,7 @@ public class Potentiometer extends BlockDE
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RainSensor extends BlockDE
|
||||
{
|
||||
@@ -21,11 +21,11 @@ public class RainSensor extends BlockDE
|
||||
IIcon icon_side;
|
||||
|
||||
protected RainSensor() {
|
||||
super(Material.iron);
|
||||
super(Material.circuits);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setBlockBounds(0, 0, 0, 1, 0.125F, 1);
|
||||
this.setHardness(5f);
|
||||
this.setResistance(10f);
|
||||
this.setHardness(0.3f);
|
||||
this.setResistance(0.5f);
|
||||
this.setTickRandomly(true);
|
||||
this.setBlockName(Strings.rainSensorName);
|
||||
ModBlocks.register(this);
|
||||
|
||||
+15
-30
@@ -14,23 +14,24 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 27/06/2014.
|
||||
*/
|
||||
public class TeleporterStand extends BlockContainerDE {
|
||||
public class TeleporterStand extends BlockCustomDrop {
|
||||
public TeleporterStand() {
|
||||
super(Material.iron);
|
||||
super(Material.rock);
|
||||
this.setBlockName(Strings.teleporterStandName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
this.setHardness(1.5f);
|
||||
this.setResistance(10.0f);
|
||||
this.setBlockBounds(0.35f, 0f, 0.35f, 0.65f, 0.8f, 0.65f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
@@ -99,34 +100,18 @@ public class TeleporterStand extends BlockContainerDE {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
|
||||
|
||||
float multiplier = 0.05F;
|
||||
|
||||
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * multiplier;
|
||||
droppedItem.motionY = (4 + world.rand.nextFloat()) * multiplier;
|
||||
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * multiplier;
|
||||
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -21,13 +20,11 @@ import java.util.Random;
|
||||
public class XRayBlock extends BlockDE {
|
||||
|
||||
protected XRayBlock() {
|
||||
super(Material.rock);
|
||||
this.setBlockName(Strings.xrayBlockName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setBlockBounds(0.4F, 0.4F, 0.4F, 0.6F, 0.6F, 0.6F);
|
||||
this.setHardness(7f);
|
||||
this.setHardness(10f);
|
||||
this.setHarvestLevel("pickaxe", 4);
|
||||
this.setResistance(200.0f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
|
||||
+8
-44
@@ -1,22 +1,19 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.itemblocks;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 31/10/2014.
|
||||
*/
|
||||
public class DraconiumChestItemBlock extends ItemBlock {
|
||||
public class DraconiumChestItemBlock extends ItemBlockCustomData {
|
||||
public DraconiumChestItemBlock(Block block) {
|
||||
super(block);
|
||||
}
|
||||
@@ -29,45 +26,12 @@ public class DraconiumChestItemBlock extends ItemBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
if (stack.stackSize <= 0) return false;
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new EntityPersistentItem(world, location, itemstack);
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if (block == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1) side = 1;
|
||||
|
||||
ForgeDirection sideDir = ForgeDirection.getOrientation(side);
|
||||
|
||||
if (!(block != null && block.isReplaceable(world, x, y, z))) {
|
||||
x += sideDir.offsetX;
|
||||
y += sideDir.offsetY;
|
||||
z += sideDir.offsetZ;
|
||||
}
|
||||
|
||||
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) return false;
|
||||
|
||||
Block ownBlock = this.field_150939_a;
|
||||
if (y == 255 && ownBlock.getMaterial().isSolid()) return false;
|
||||
|
||||
if (!world.canPlaceEntityOnSide(this.field_150939_a, x, y, z, false, side, player, stack)) return false;
|
||||
|
||||
int newMeta = getMetadata(stack.getItemDamage());
|
||||
newMeta = ownBlock.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, newMeta);
|
||||
|
||||
if (!placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, newMeta)) return false;
|
||||
|
||||
TileDraconiumChest te = world.getTileEntity(x, y, z) instanceof TileDraconiumChest ? (TileDraconiumChest)world.getTileEntity(x, y, z) : null;
|
||||
|
||||
if (te != null){
|
||||
NBTTagCompound itemTag = stack.getTagCompound();
|
||||
if (itemTag != null && itemTag.hasKey("TileCompound")) {
|
||||
te.readFromItem(itemTag.getCompoundTag("TileCompound"));
|
||||
}
|
||||
}
|
||||
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, ownBlock.stepSound.getBreakSound(), (ownBlock.stepSound.getVolume() + 1.0F) / 2.0F, ownBlock.stepSound.getPitch() * 0.8F);
|
||||
stack.stackSize--;
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.itemblocks;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ICustomItemData;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/11/2014.
|
||||
*/
|
||||
public class ItemBlockCustomData extends ItemBlock {
|
||||
|
||||
public ItemBlockCustomData(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
if (stack.stackSize <= 0) return false;
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if (block == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1) side = 1;
|
||||
|
||||
ForgeDirection sideDir = ForgeDirection.getOrientation(side);
|
||||
|
||||
if (!(block != null && block.isReplaceable(world, x, y, z))) {
|
||||
x += sideDir.offsetX;
|
||||
y += sideDir.offsetY;
|
||||
z += sideDir.offsetZ;
|
||||
}
|
||||
|
||||
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) return false;
|
||||
|
||||
Block ownBlock = this.field_150939_a;
|
||||
if (y == 255 && ownBlock.getMaterial().isSolid()) return false;
|
||||
|
||||
if (!world.canPlaceEntityOnSide(this.field_150939_a, x, y, z, false, side, player, stack)) return false;
|
||||
|
||||
int newMeta = getMetadata(stack.getItemDamage());
|
||||
newMeta = ownBlock.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, newMeta);
|
||||
|
||||
if (!placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, newMeta)) return false;
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z) instanceof TileDraconiumChest ? (TileDraconiumChest)world.getTileEntity(x, y, z) : null;
|
||||
|
||||
if (te instanceof ICustomItemData){
|
||||
NBTTagCompound itemTag = stack.getTagCompound();
|
||||
if (itemTag != null && itemTag.hasKey(ICustomItemData.tagName)) {
|
||||
((ICustomItemData)te).readDataFromItem(itemTag.getCompoundTag(ICustomItemData.tagName), stack);
|
||||
}
|
||||
}
|
||||
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, ownBlock.stepSound.getBreakSound(), (ownBlock.stepSound.getVolume() + 1.0F) / 2.0F, ownBlock.stepSound.getPitch() * 0.8F);
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+38
-26
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockContainerDE;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
@@ -10,21 +10,22 @@ import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 27/06/2014.
|
||||
*/
|
||||
public class DissEnchanter extends BlockContainerDE {
|
||||
public class DissEnchanter extends BlockCustomDrop {
|
||||
IIcon top;
|
||||
IIcon bottom;
|
||||
public DissEnchanter() {
|
||||
@@ -32,8 +33,6 @@ public class DissEnchanter extends BlockContainerDE {
|
||||
this.setBlockName(Strings.dissEnchanterName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
@@ -82,33 +81,46 @@ public class DissEnchanter extends BlockContainerDE {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
|
||||
}
|
||||
|
||||
float multiplier = 0.05F;
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * multiplier;
|
||||
droppedItem.motionY = (4 + world.rand.nextFloat()) * multiplier;
|
||||
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * multiplier;
|
||||
for (int x1 = x - 2; x1 <= x + 2; ++x1) {
|
||||
for (int z1 = z - 2; z1 <= z + 2; ++z1) {
|
||||
if (x1 > x - 2 && x1 < x + 2 && z1 == z - 1) {
|
||||
z1 = z + 2;
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
if (rand.nextInt(16) == 0) {
|
||||
for (int y1 = y; y1 <= y + 1; ++y1) {
|
||||
if (world.getBlock(x1, y1, z1) == Blocks.bookshelf) {
|
||||
if (!world.isAirBlock((x1 - x) / 2 + x, y1, (z1 - z)
|
||||
/ 2 + z)) {
|
||||
break;
|
||||
}
|
||||
|
||||
//world.spawnParticle("enchantmenttable", x + 0.5D, y + 2.0D, z + 0.5D, l - x + rand.nextFloat() - 0.5D, j1 - y - rand.nextFloat() - 1.0F, i1 - z + rand.nextFloat() - 0.5D);
|
||||
world.spawnParticle("enchantmenttable", x1+0.4+(rand.nextFloat()*0.2), y1+0.8, z1+0.4+(rand.nextFloat()*0.2), x - x1+rand.nextFloat()-0.5, y - y1+rand.nextFloat(), z - z1+rand.nextFloat()-0.5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
}
|
||||
+13
-34
@@ -2,37 +2,32 @@ package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockContainerDE;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 27/06/2014.
|
||||
*/
|
||||
public class EnergyInfuser extends BlockContainerDE {
|
||||
public class EnergyInfuser extends BlockCustomDrop {
|
||||
public EnergyInfuser() {
|
||||
super(Material.iron);
|
||||
this.setBlockName(Strings.energyInfuserName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.375f, 1f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
@@ -74,33 +69,17 @@ public class EnergyInfuser extends BlockContainerDE {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
|
||||
|
||||
float multiplier = 0.05F;
|
||||
|
||||
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * multiplier;
|
||||
droppedItem.motionY = (4 + world.rand.nextFloat()) * multiplier;
|
||||
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * multiplier;
|
||||
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
}
|
||||
+14
-36
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockContainerDE;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -10,18 +10,14 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -37,7 +33,7 @@ import java.util.Random;
|
||||
/**
|
||||
* Created by Brandon on 23/07/2014.
|
||||
*/
|
||||
public class Generator extends BlockContainerDE {
|
||||
public class Generator extends BlockCustomDrop {
|
||||
|
||||
public IIcon icon_front;
|
||||
public IIcon icon_side;
|
||||
@@ -47,12 +43,10 @@ public class Generator extends BlockContainerDE {
|
||||
public IIcon icon_top[] = new IIcon[4];
|
||||
|
||||
public Generator() {
|
||||
super(Material.rock);
|
||||
super(Material.iron);
|
||||
this.setBlockName(Strings.generatorName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(2000.0f);
|
||||
ModBlocks.register(this);
|
||||
|
||||
}
|
||||
@@ -89,7 +83,7 @@ public class Generator extends BlockContainerDE {
|
||||
LogHelper.error("Missing Tile Entity (Generator)");
|
||||
return 0;
|
||||
}
|
||||
return tile.burnTimeRemaining > 0 && tile.getEnergyStored(ForgeDirection.UP) < tile.getMaxEnergyStored(ForgeDirection.UP) ? 13 : 0;
|
||||
return tile.isBurning ? 13 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,7 +107,7 @@ public class Generator extends BlockContainerDE {
|
||||
IIcon back;
|
||||
IIcon front;
|
||||
|
||||
if (tile.burnTimeRemaining > 0 && tile.getEnergyStored(ForgeDirection.UP) < tile.getMaxEnergyStored(ForgeDirection.UP))
|
||||
if (tile.isBurning)
|
||||
{
|
||||
back = icon_back;
|
||||
front = icon_front;
|
||||
@@ -256,34 +250,18 @@ public class Generator extends BlockContainerDE {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
|
||||
|
||||
float mult = 0.05F;
|
||||
|
||||
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionY = (4 + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+26
-48
@@ -1,18 +1,21 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockContainerDE;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -20,17 +23,10 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
|
||||
|
||||
public class Grinder extends BlockContainerDE
|
||||
import java.util.List;
|
||||
|
||||
public class Grinder extends BlockCustomDrop
|
||||
{
|
||||
public IIcon icon_front;
|
||||
public IIcon icon_side;
|
||||
@@ -40,11 +36,10 @@ public class Grinder extends BlockContainerDE
|
||||
public IIcon icon_top[] = new IIcon[4];
|
||||
|
||||
public Grinder() {
|
||||
super(Material.rock);
|
||||
super(Material.iron);
|
||||
this.setBlockName(Strings.grinderName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(2000.0f);
|
||||
ModBlocks.register(this);
|
||||
|
||||
@@ -90,7 +85,7 @@ public class Grinder extends BlockContainerDE
|
||||
IIcon back;
|
||||
IIcon front;
|
||||
|
||||
if (!tile.disabled && tile.getActiveBuffer().getEnergyStored() >= tile.energyPerKill)
|
||||
if (!tile.disabled && tile.hasPower)
|
||||
{
|
||||
back = icon_back;
|
||||
front = icon_front;
|
||||
@@ -231,36 +226,19 @@ public class Grinder extends BlockContainerDE
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
|
||||
if (stack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
|
||||
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
|
||||
|
||||
float mult = 0.05F;
|
||||
|
||||
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionY = (4 + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
}
|
||||
}
|
||||
-2
@@ -36,8 +36,6 @@ public class LongRangeDislocator extends BlockDE {
|
||||
public LongRangeDislocator() {
|
||||
this.setBlockName(Strings.longRangeDislocatorName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setHardness(5f);
|
||||
this.setResistance(20.0f);
|
||||
ModBlocks.register(this, LRDItemBlock.class);
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -28,8 +28,6 @@ public class PlayerDetector extends BlockDE
|
||||
this.setBlockName(Strings.playerDetectorName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
|
||||
+13
-38
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockContainerDE;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
@@ -13,9 +13,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -24,7 +22,9 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PlayerDetectorAdvanced extends BlockContainerDE
|
||||
import java.util.List;
|
||||
|
||||
public class PlayerDetectorAdvanced extends BlockCustomDrop
|
||||
{
|
||||
IIcon side_inactive;
|
||||
IIcon side_active;
|
||||
@@ -36,8 +36,6 @@ public class PlayerDetectorAdvanced extends BlockContainerDE
|
||||
this.setBlockName(Strings.playerDetectorAdvancedName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@@ -164,41 +162,18 @@ public class PlayerDetectorAdvanced extends BlockContainerDE
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
|
||||
|
||||
float mult = 0.05F;
|
||||
|
||||
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionY = (4 + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
|
||||
world.notifyBlocksOfNeighborChange(x - 1, y, z, world.getBlock(x, y, z));
|
||||
world.notifyBlocksOfNeighborChange(x + 1, y, z, world.getBlock(x, y, z));
|
||||
world.notifyBlocksOfNeighborChange(x, y - 1, z, world.getBlock(x, y, z));
|
||||
world.notifyBlocksOfNeighborChange(x, y + 1, z, world.getBlock(x, y, z));
|
||||
world.notifyBlocksOfNeighborChange(x, y, z - 1, world.getBlock(x, y, z));
|
||||
world.notifyBlocksOfNeighborChange(x, y, z + 1, world.getBlock(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,8 +27,6 @@ public class SunDial extends BlockDE {
|
||||
this.setBlockName(Strings.blockSunDialName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
|
||||
+22
-44
@@ -1,34 +1,30 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockContainerDE;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
|
||||
|
||||
public class WeatherController extends BlockContainerDE {
|
||||
import java.util.List;
|
||||
|
||||
public class WeatherController extends BlockCustomDrop {
|
||||
|
||||
public boolean blockState = true;
|
||||
public IIcon icon_top;
|
||||
@@ -41,12 +37,10 @@ public class WeatherController extends BlockContainerDE {
|
||||
public IIcon icon_side_sun_off;
|
||||
|
||||
public WeatherController() {
|
||||
super(Material.rock);
|
||||
super(Material.iron);
|
||||
this.setBlockName(Strings.blockWeatherControllerName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(200.0f);
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@@ -144,34 +138,18 @@ public class WeatherController extends BlockContainerDE {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) te;
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
float spawnX = x + world.rand.nextFloat();
|
||||
float spawnY = y + world.rand.nextFloat();
|
||||
float spawnZ = z + world.rand.nextFloat();
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
|
||||
|
||||
float mult = 0.05F;
|
||||
|
||||
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionY = (4 + world.rand.nextFloat()) * mult;
|
||||
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * mult;
|
||||
|
||||
world.spawnEntityInWorld(droppedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class EnergyPylon extends BlockDE {
|
||||
|
||||
public EnergyPylon() {
|
||||
super(Material.iron);
|
||||
this.setHardness(5F);
|
||||
this.setHardness(10F);
|
||||
this.setResistance(20F);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setBlockName(Strings.energyPylonName);
|
||||
|
||||
+5
-3
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -29,7 +30,7 @@ public class EnergyStorageCore extends BlockDE {
|
||||
public EnergyStorageCore() {
|
||||
super(Material.iron);
|
||||
this.setHardness(10F);
|
||||
this.setResistance(100F);
|
||||
this.setResistance(20f);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
this.setBlockName(Strings.energyStorageCoreName);
|
||||
ModBlocks.register(this);
|
||||
@@ -63,8 +64,9 @@ public class EnergyStorageCore extends BlockDE {
|
||||
|
||||
if (!world.isRemote) {
|
||||
player.addChatComponentMessage(new ChatComponentText("Tier:" + tile.getTier()));
|
||||
player.addChatComponentMessage(new ChatComponentText("" + Utills.formatNumber(tile.getEnergyStored()) + " / " + Utills.formatNumber(tile.getMaxEnergyStored())));
|
||||
}
|
||||
String BN = String.valueOf(tile.getEnergyStored());
|
||||
if (BN.substring(BN.length() - 2).contentEquals(".0")) BN = BN.substring(0, BN.length() - 2);
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + ": " + Utills.formatNumber(tile.getEnergyStored()) + " / " + Utills.formatNumber(tile.getMaxEnergyStored()) + " [" + BN + " RF]")); }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -22,6 +22,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -34,7 +35,7 @@ public class InvisibleMultiblock extends BlockDE {
|
||||
public InvisibleMultiblock() {
|
||||
super(Material.iron);
|
||||
this.setHardness(10F);
|
||||
this.setResistance(100F);
|
||||
this.setResistance(2000F);
|
||||
//this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
|
||||
this.setBlockName(Strings.invisibleMultiblockName);
|
||||
ModBlocks.register(this);
|
||||
@@ -101,7 +102,9 @@ public class InvisibleMultiblock extends BlockDE {
|
||||
if (!world.isRemote) {
|
||||
world.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord);
|
||||
player.addChatComponentMessage(new ChatComponentText("Tier:" + master.getTier()));
|
||||
player.addChatComponentMessage(new ChatComponentText("" + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored())));
|
||||
String BN = String.valueOf(master.getEnergyStored());
|
||||
if (BN.substring(BN.length() - 2).contentEquals(".0")) BN = BN.substring(0, BN.length() - 2);
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + ": " + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + BN + " RF]"));
|
||||
}
|
||||
return true;
|
||||
} else if (meta == 2) {
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 14/11/2014.
|
||||
*/
|
||||
/**This class is for syncing values to bug for ICrafting*/
|
||||
public abstract class ContainerDataSync extends Container {
|
||||
|
||||
/**
|
||||
* Sends two ints to the client-side Container. Normally the first int identifies which variable to update, and the second contains the new
|
||||
* value.
|
||||
* if tile != null the packet will be sent to the tile client tile instead of the client container.
|
||||
*/
|
||||
public Object sendObject(TileObjectSync tile, short dataType, int index, Object object){
|
||||
for (Object p : crafters){
|
||||
DraconicEvolution.network.sendTo(new ObjectPacket(tile, ObjectPacket.INT, index, object), (EntityPlayerMP)p);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
/**Called when the client receives a sync packet from the server*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract void receiveSyncData(int index, Object value);
|
||||
}
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class ContainerDissEnchanter extends Container {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
return EnchantmentHelper.getEnchantments(stack).size() > 0 || ItemNBTHelper.getIntager(stack, "RepairCost", 0) > 0;
|
||||
return EnchantmentHelper.getEnchantments(stack).size() > 0 || ItemNBTHelper.getInteger(stack, "RepairCost", 0) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChest;
|
||||
import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChestResult;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
@@ -17,7 +17,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@ChestContainer(isLargeChest = false, rowSize = 26)
|
||||
public class ContainerDraconiumChest extends Container { //todo Create and implement IExtendedCrafters
|
||||
public class ContainerDraconiumChest extends Container {
|
||||
|
||||
/** The crafting matrix inventory (3x3). */
|
||||
public InventoryCrafting craftMatrix;
|
||||
@@ -165,9 +165,9 @@ public class ContainerDraconiumChest extends Container { //todo Create and imple
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCrafting) {
|
||||
super.addCraftingToCrafters(iCrafting);
|
||||
iCrafting.sendProgressBarUpdate(this, 0, tile.smeltingProgressTime);
|
||||
iCrafting.sendProgressBarUpdate(this, 1, tile.getEnergyStored(ForgeDirection.DOWN)/32);
|
||||
iCrafting.sendProgressBarUpdate(this, 2, tile.smeltingBurnSpeed);
|
||||
// iCrafting.sendProgressBarUpdate(this, 0, tile.smeltingProgressTime);
|
||||
// iCrafting.sendProgressBarUpdate(this, 1, tile.getEnergyStored(ForgeDirection.DOWN)/32);
|
||||
// iCrafting.sendProgressBarUpdate(this, 2, tile.smeltingBurnSpeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -231,7 +231,7 @@ public class ContainerDraconiumChest extends Container { //todo Create and imple
|
||||
{
|
||||
if (super.isItemValid(stack))
|
||||
{
|
||||
return EnergyHelper.isEnergyContainerItem(stack);
|
||||
return stack != null && stack.getItem() instanceof IEnergyContainerItem;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -242,4 +242,4 @@ public class ContainerDraconiumChest extends Container { //todo Create and imple
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}//todo update all guis like this
|
||||
}
|
||||
+17
-14
@@ -1,19 +1,21 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import com.brandon3055.draconicevolution.common.inventory.SlotChargable;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerEnergyInfuser extends Container {
|
||||
public class ContainerEnergyInfuser extends ContainerDataSync {
|
||||
|
||||
private TileEnergyInfuser tile;
|
||||
private EntityPlayer player;
|
||||
private int lastTickEnergyStorage = -1;
|
||||
|
||||
public ContainerEnergyInfuser(InventoryPlayer invPlayer, TileEnergyInfuser tile) {
|
||||
this.tile = tile;
|
||||
@@ -52,7 +54,7 @@ public class ContainerEnergyInfuser extends Container {
|
||||
if (!mergeItemStack(stack, 0, 36, false)){
|
||||
return null;
|
||||
}
|
||||
}else if (!EnergyHelper.isEnergyContainerItem(stack) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)){
|
||||
}else if (!(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -70,18 +72,19 @@ public class ContainerEnergyInfuser extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting par1ICrafting) {
|
||||
super.addCraftingToCrafters(par1ICrafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int par1, int par2) {
|
||||
super.updateProgressBar(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (tile.energy.getEnergyStored() != lastTickEnergyStorage){
|
||||
sendObject(null, ObjectPacket.INT, 0, tile.energy.getEnergyStored());
|
||||
lastTickEnergyStorage = tile.energy.getEnergyStored();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveSyncData(int index, Object value) {
|
||||
tile.energy.setEnergyStored((Integer)value);
|
||||
}
|
||||
}
|
||||
+19
-10
@@ -1,17 +1,22 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import com.brandon3055.draconicevolution.common.inventory.SlotItemValid;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ContainerGenerator extends Container {
|
||||
public class ContainerGenerator extends ContainerDataSync {
|
||||
|
||||
private TileGenerator tile;
|
||||
private int cachSize = -1;
|
||||
private int energyCach = -1;
|
||||
private int burnCach = -1;
|
||||
private int burnRemainingCach = -1;
|
||||
|
||||
public ContainerGenerator(InventoryPlayer invPlayer, TileGenerator tile) {
|
||||
this.tile = tile;
|
||||
@@ -70,12 +75,16 @@ public class ContainerGenerator extends Container {
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
ItemStack stack = tile.getStackInSlot(0);
|
||||
int size = stack == null ? 0 : stack.stackSize;
|
||||
if (cachSize != size) {
|
||||
cachSize = size;
|
||||
tile.tryRefuel();
|
||||
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
if (energyCach != tile.getEnergyStored(ForgeDirection.UP)) energyCach = (Integer) sendObject(null, ObjectPacket.INT, 0, tile.getEnergyStored(ForgeDirection.UP));
|
||||
if (burnCach != tile.burnTime) burnCach = (Integer) sendObject(null, ObjectPacket.INT, 1, tile.burnTime);
|
||||
if (burnRemainingCach != tile.burnTimeRemaining) burnRemainingCach = (Integer) sendObject(null, ObjectPacket.INT, 2, tile.burnTimeRemaining);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveSyncData(int index, Object object) {
|
||||
if (index == 0)tile.storage.setEnergyStored((Integer)object);
|
||||
else if (index == 1) tile.burnTime = (Integer)object;
|
||||
else if (index == 2) tile.burnTimeRemaining = (Integer)object;
|
||||
}
|
||||
}
|
||||
+22
-10
@@ -1,17 +1,22 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import com.brandon3055.draconicevolution.common.inventory.SlotItemValid;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerGrinder extends Container {
|
||||
public class ContainerGrinder extends ContainerDataSync {
|
||||
|
||||
private int cachSize = -1;
|
||||
private TileGrinder tile;
|
||||
private int energyCach = -1;
|
||||
private int energy2Cach = -1;
|
||||
private int burnCach = -1;
|
||||
private int burnRemainingCach = -1;
|
||||
|
||||
public ContainerGrinder(InventoryPlayer invPlayer, TileGrinder tile) {
|
||||
this.tile = tile;
|
||||
@@ -74,12 +79,19 @@ public class ContainerGrinder extends Container {
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
ItemStack stack = tile.getStackInSlot(0);
|
||||
int size = stack == null ? 0 : stack.stackSize;
|
||||
if (cachSize != size) {
|
||||
cachSize = size;
|
||||
tile.tryRefuel();
|
||||
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
if (energyCach != tile.externalInputBuffer.getEnergyStored()) energyCach = (Integer) sendObject(null, ObjectPacket.INT, 0, tile.externalInputBuffer.getEnergyStored());
|
||||
if (energy2Cach != tile.internalGenBuffer.getEnergyStored()) energy2Cach = (Integer) sendObject(null, ObjectPacket.INT, 1, tile.internalGenBuffer.getEnergyStored());
|
||||
if (burnCach != tile.burnTime) burnCach = (Integer) sendObject(null, ObjectPacket.INT, 2, tile.burnTime);
|
||||
if (burnRemainingCach != tile.burnTimeRemaining) burnRemainingCach = (Integer) sendObject(null, ObjectPacket.INT, 3, tile.burnTimeRemaining);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveSyncData(int index, Object object) {
|
||||
if (index == 0) tile.externalInputBuffer.setEnergyStored((Integer)object);
|
||||
else if (index == 1) tile.internalGenBuffer.setEnergyStored((Integer)object);
|
||||
else if (index == 2) tile.burnTime = (Integer)object;
|
||||
else if (index == 3) tile.burnTimeRemaining = (Integer)object;
|
||||
|
||||
}
|
||||
}
|
||||
+36
-16
@@ -9,27 +9,39 @@ public class ConfigHandler {
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
//GENERAL
|
||||
public static int disableSunDial;
|
||||
public static int teleporterUsesPerPearl;
|
||||
public static int disableXrayBlock;
|
||||
public static boolean bowBlockDamage;
|
||||
public static String[] spawnerList;
|
||||
public static String[] obliterationList;
|
||||
public static boolean spawnerListType;
|
||||
public static int soulDropChance;
|
||||
public static int passiveSoulDropChance;
|
||||
public static int cometRarity;
|
||||
public static String[] obliterationList;
|
||||
public static boolean generateEnderComets;
|
||||
public static boolean generateChaosIslands;
|
||||
public static boolean pigmenBloodRage;
|
||||
public static boolean updateFix;
|
||||
public static boolean bowBlockDamage;
|
||||
public static boolean showUnlocalizedNames;
|
||||
public static boolean disableLore;
|
||||
|
||||
//spawner
|
||||
public static String[] spawnerList;
|
||||
public static boolean spawnerListType;
|
||||
|
||||
//long range dislocator
|
||||
public static int dislocator_Min_Range;
|
||||
public static int dislocator_Max_Range;
|
||||
public static int admin_dislocator_Min_Range;
|
||||
public static int admin_dislocator_Max_Range;
|
||||
public static int admin_dislocator_Detect_Range;
|
||||
public static int disable_LRD;
|
||||
public static boolean updateFix;
|
||||
public static boolean showUnlocalizedNames;
|
||||
public static int cometRarity;
|
||||
public static boolean generateEnderComets;
|
||||
public static boolean generateChaosIslands;
|
||||
public static boolean pigmenBloodRage;
|
||||
|
||||
//Potion IDs
|
||||
|
||||
//Enchantments
|
||||
public static int reaperEnchantID;
|
||||
|
||||
|
||||
private static String[] defaultSpawnerList = new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"};
|
||||
private static String[] defaultObliterationList = new String[] {"tile.stonebrick", "tile.gravel", "tile.dirt", "tile.stone", "tile.dirt", "tile.sandStone", "tile.sand", "tile.grass", "tile.hellrock"};
|
||||
@@ -43,15 +55,13 @@ public class ConfigHandler {
|
||||
|
||||
public static void syncConfig() {
|
||||
|
||||
try {
|
||||
//config.load();
|
||||
|
||||
try {
|
||||
//General
|
||||
disableSunDial = config.get(Configuration.CATEGORY_GENERAL, "Disable Sun Dial", 0, "Disable Sun Dial 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0);
|
||||
disableXrayBlock = config.get(Configuration.CATEGORY_GENERAL, "Disable Xray Block", 0, "Disable Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0);
|
||||
teleporterUsesPerPearl = config.get(Configuration.CATEGORY_GENERAL, "Teleporter Uses PerPearl", 1, "Charm of Dislocation uses per Ender pearl").getInt(1);
|
||||
bowBlockDamage = config.get(Configuration.CATEGORY_GENERAL, "Bow Block Damage", true, "Dose Draconic bow explosion damage blocks").getBoolean(true);
|
||||
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);
|
||||
spawnerList = config.getStringList("Spawn List", "spawner", defaultSpawnerList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
|
||||
obliterationList = config.getStringList("Oblit Mode List", Configuration.CATEGORY_GENERAL, defaultObliterationList, "List of block (unlocalized)names that will be destroyed by tools in obliteration mode. To find the unlocalized name of a block see the \"Show Unlocalized Names\" config option");
|
||||
showUnlocalizedNames = config.get(Configuration.CATEGORY_GENERAL, "Show Unlocalized Names", false, "If set to true the unlocalized name of every block and item will be displayed in its tool tip").getBoolean(false);
|
||||
soulDropChance = config.get(Configuration.CATEGORY_GENERAL, "soulDropChance", 1000, "Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(1000);
|
||||
@@ -61,13 +71,23 @@ public class ConfigHandler {
|
||||
generateEnderComets = config.get(Configuration.CATEGORY_GENERAL, "Generate Ender Comets", true, "Should Ender comets be generated").getBoolean(true);
|
||||
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);
|
||||
|
||||
//dislocator_Min_Range = config.get("Long Range Dislocator", "Admin Dislocator Min Range", 1000000).getInt(1000000);
|
||||
//dislocator_Max_Range = config.get("Long Range Dislocator", "Admin Dislocator Max Range", 29000000).getInt(29000000);
|
||||
//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);
|
||||
spawnerList = config.getStringList("Spawn List", "spawner", defaultSpawnerList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
|
||||
|
||||
//LRD
|
||||
admin_dislocator_Min_Range = config.get("long range dislocator", "Dislocator Min Range", 1000).getInt(1000);
|
||||
admin_dislocator_Max_Range = config.get("long range dislocator", "Dislocator Max Range", 10000).getInt(10000);
|
||||
admin_dislocator_Detect_Range = config.get("long range dislocator", "Admin Dislocator Detect Range", 5).getInt(5);
|
||||
disable_LRD = config.get("long range dislocator", "Disable Dislocator", 0, "Disable Long Range Dislocator 0:Default, 1:Disable recipe, 2:Disable completely (Includes Admin Dislocator)").getInt(0);
|
||||
|
||||
//Potions
|
||||
// potionFlightID = config.get("magic id's", "potionFlightID", 50).getInt(50);
|
||||
|
||||
//Enchantments
|
||||
reaperEnchantID = config.get("magic id's", "Reaper Enchant id", 220).getInt(220);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LogHelper.error("Unable to load Config");
|
||||
|
||||
+66
@@ -2,12 +2,21 @@ package com.brandon3055.draconicevolution.common.core.handler;
|
||||
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerCapabilities;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class FMLEventHandler {
|
||||
|
||||
public static Map<EntityPlayer, Boolean> playersWithFlight = new WeakHashMap<EntityPlayer, Boolean>();
|
||||
public static List<String> playersWithUphillStep = new ArrayList<String>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
|
||||
@@ -16,4 +25,61 @@ public class FMLEventHandler {
|
||||
LogHelper.info("Config Changed");
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(TickEvent.PlayerTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.START)return;
|
||||
EntityPlayer player = event.player;
|
||||
|
||||
ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, player.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
|
||||
|
||||
if (player.worldObj.isRemote) {
|
||||
boolean highStepListed = playersWithUphillStep.contains(player.getDisplayName()) && player.stepHeight >= 1f;
|
||||
boolean hasHighStep = ArmorEffectHandler.getHasHighStep(player);
|
||||
|
||||
if (hasHighStep && !highStepListed) {
|
||||
playersWithUphillStep.add(player.getDisplayName());
|
||||
player.stepHeight = 1f;
|
||||
}
|
||||
|
||||
if (!hasHighStep && highStepListed) {
|
||||
playersWithUphillStep.remove(player.getDisplayName());
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ArmorEffectHandler.getHasSwiftness(player)) {
|
||||
int i = ArmorEffectHandler.getSwiftnessLevel(player);
|
||||
|
||||
float percentIncrease = (i + 1) * 0.05f;
|
||||
|
||||
|
||||
if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
|
||||
player.moveFlying(0F, 1F, player.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (ArmorEffectHandler.getHasFlight(player)) {
|
||||
playersWithFlight.put(player, true);
|
||||
player.capabilities.allowFlying = true;
|
||||
|
||||
} else {
|
||||
|
||||
if (!playersWithFlight.containsKey(player)) {
|
||||
playersWithFlight.put(player, false);
|
||||
}
|
||||
|
||||
if (playersWithFlight.get(player) && !player.worldObj.isRemote) {
|
||||
playersWithFlight.put(player, false);
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
player.sendPlayerAbilities();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
-95
@@ -7,8 +7,10 @@ import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
|
||||
import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -28,82 +30,55 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MinecraftForgeEventHandler {
|
||||
|
||||
Random random = new Random();
|
||||
public static List<String> playersWithUphillStep = new ArrayList<String>();
|
||||
public static List<String> playersWithFlight = new ArrayList<String>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event){
|
||||
EntityLivingBase entityLiving = event.entityLiving;
|
||||
public void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer))return;
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
|
||||
if (entityLiving.worldObj.isRemote && entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
boolean hasUphillStep = playersWithUphillStep.contains(player.getDisplayName());
|
||||
boolean shouldHaveUphillStep = player.getEquipmentInSlot(1) != null && player.getEquipmentInSlot(1).getItem() == ModItems.draconicBoots && !player.isSneaking();
|
||||
|
||||
if (!hasUphillStep && shouldHaveUphillStep)
|
||||
{
|
||||
playersWithUphillStep.add(player.getDisplayName());
|
||||
player.stepHeight = 1;
|
||||
}
|
||||
if (hasUphillStep && !shouldHaveUphillStep)
|
||||
{
|
||||
playersWithUphillStep.remove(player.getDisplayName());
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
if(entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
boolean hasFlight = playersWithFlight.contains(player.getDisplayName());
|
||||
boolean shouldHaveFlight = player.getEquipmentInSlot(3) != null && player.getEquipmentInSlot(3).getItem() == ModItems.draconicChest;
|
||||
|
||||
if ((!hasFlight || !player.capabilities.allowFlying) && shouldHaveFlight)
|
||||
{
|
||||
if (!playersWithFlight.contains(player.getDisplayName()) && !player.worldObj.isRemote)
|
||||
playersWithFlight.add(player.getDisplayName());
|
||||
player.capabilities.allowFlying = true;
|
||||
}
|
||||
if (player.worldObj.isRemote && hasFlight && player.capabilities.getFlySpeed() <= 0.05F) player.capabilities.setFlySpeed(player.capabilities.getFlySpeed() + 0.05F);
|
||||
//if (!player.worldObj.isRemote) LogHelper.info(hasFlight);
|
||||
if (hasFlight && !shouldHaveFlight)
|
||||
{
|
||||
if (player.worldObj.isRemote && player.capabilities.getFlySpeed() > 0.05F) player.capabilities.setFlySpeed(0.05F);
|
||||
if (!player.worldObj.isRemote)playersWithFlight.remove(player.getDisplayName());
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
if (player.capabilities.isCreativeMode)
|
||||
player.capabilities.allowFlying = true;
|
||||
}
|
||||
if (ArmorEffectHandler.getHasJumpBoost(player)) {
|
||||
int i = ArmorEffectHandler.getJumpLevel(player);
|
||||
event.entityLiving.motionY += (0.1f) * (2 + i);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SubscribeEvent
|
||||
public void onDropEvent(LivingDropsEvent event){
|
||||
if (event.entity instanceof EntityDragon && !event.entity.worldObj.isRemote){
|
||||
public void onEntityDamaged(LivingAttackEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer))return;
|
||||
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
if (event.source.isFireDamage() && ArmorEffectHandler.getFireImunity(player)) {
|
||||
event.setCanceled(true);
|
||||
event.entityLiving.extinguish();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
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);
|
||||
if (event.entity instanceof EntityCustomDragon && ((EntityCustomDragon)event.entity).getIsUber()) event.entity.worldObj.spawnEntityInWorld(item);
|
||||
if (event.entity instanceof EntityCustomDragon && ((EntityCustomDragon) event.entity).getIsUber())
|
||||
event.entity.worldObj.spawnEntityInWorld(item);
|
||||
|
||||
int count = 30 + event.entity.worldObj.rand.nextInt(30);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float mm = 0.3F;
|
||||
EntityItem item2 = new EntityItem(event.entity.worldObj, event.entity.posX-2+event.entity.worldObj.rand.nextInt(4), event.entity.posY-2+event.entity.worldObj.rand.nextInt(4), event.entity.posZ-2+event.entity.worldObj.rand.nextInt(4), new ItemStack(ModItems.draconiumDust));
|
||||
EntityItem item2 = new EntityItem(event.entity.worldObj, event.entity.posX - 2 + event.entity.worldObj.rand.nextInt(4), event.entity.posY - 2 + event.entity.worldObj.rand.nextInt(4), event.entity.posZ - 2 + event.entity.worldObj.rand.nextInt(4), new ItemStack(ModItems.draconiumDust));
|
||||
item.motionX = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F);
|
||||
item.motionY = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F);
|
||||
item.motionZ = mm * ((((float) event.entity.worldObj.rand.nextInt(100)) / 100F) - 0.5F);
|
||||
@@ -111,15 +86,26 @@ public class MinecraftForgeEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entity.worldObj.isRemote || !(event.source.damageType.equals("player") || event.source.damageType.equals("arrow")) || !isValidEntity(event.entityLiving)){ return; }
|
||||
if (event.entity.worldObj.isRemote || !(event.source.damageType.equals("player") || event.source.damageType.equals("arrow")) || !isValidEntity(event.entityLiving)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityLivingBase entity = event.entityLiving;
|
||||
Entity attacker = event.source.getEntity();
|
||||
if (attacker == null || !(attacker instanceof EntityPlayer)) { return; }
|
||||
if (((EntityPlayer) attacker).getHeldItem() == null || !(((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicSword) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicDistructionStaff) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicBow) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.wyvernBow) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.wyvernSword))) { return; }
|
||||
|
||||
if (attacker == null || !(attacker instanceof EntityPlayer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int dropChanceModifier = getDropChanceFromItem(((EntityPlayer) attacker).getHeldItem());
|
||||
|
||||
if (dropChanceModifier == 0) return;
|
||||
|
||||
World world = entity.worldObj;
|
||||
int rand = random.nextInt(ConfigHandler.soulDropChance);
|
||||
int rand2 = random.nextInt(ConfigHandler.passiveSoulDropChance);
|
||||
int rand = random.nextInt(Math.max(ConfigHandler.soulDropChance / dropChanceModifier, 1));
|
||||
int rand2 = random.nextInt(Math.max(ConfigHandler.passiveSoulDropChance / dropChanceModifier, 1));
|
||||
boolean isAnimal = entity instanceof EntityAnimal;
|
||||
|
||||
if ((rand == 0 && !isAnimal) || (rand2 == 0 && isAnimal)) {
|
||||
ItemStack soul = new ItemStack(ModItems.mobSoul);
|
||||
String name = EntityList.getEntityString(entity);
|
||||
@@ -128,26 +114,35 @@ public class MinecraftForgeEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidEntity(EntityLivingBase entity){
|
||||
if (entity instanceof IBossDisplayData) { return false; }
|
||||
for (int i = 0; i < ConfigHandler.spawnerList.length; i++)
|
||||
{
|
||||
if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && ConfigHandler.spawnerListType)
|
||||
{
|
||||
private int getDropChanceFromItem(ItemStack stack){
|
||||
int chance = 0;
|
||||
if (stack == null) return 0;
|
||||
if (stack.getItem().equals(ModItems.wyvernBow) || stack.getItem().equals(ModItems.wyvernSword)) chance++;
|
||||
if (stack.getItem().equals(ModItems.draconicSword) || stack.getItem().equals(ModItems.draconicBow)) chance+=2;
|
||||
if (stack.getItem().equals(ModItems.draconicDistructionStaff)) chance+=3;
|
||||
|
||||
chance += EnchantmentHelper.getEnchantmentLevel(ConfigHandler.reaperEnchantID, stack);
|
||||
return chance;
|
||||
}
|
||||
|
||||
private boolean isValidEntity(EntityLivingBase entity) {
|
||||
if (entity instanceof IBossDisplayData) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < ConfigHandler.spawnerList.length; i++) {
|
||||
if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && ConfigHandler.spawnerListType) {
|
||||
return true;
|
||||
} else if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && !ConfigHandler.spawnerListType)
|
||||
{
|
||||
} else if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && !ConfigHandler.spawnerListType) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (ConfigHandler.spawnerListType) {
|
||||
return false;
|
||||
}else {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SubscribeEvent
|
||||
public void ChunkEvent(ChunkEvent event) {
|
||||
if (!ConfigHandler.updateFix) return;
|
||||
@@ -165,44 +160,51 @@ public class MinecraftForgeEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean changeBlock(ExtendedBlockStorage storage, int x, int y, int z){
|
||||
private boolean changeBlock(ExtendedBlockStorage storage, int x, int y, int z) {
|
||||
|
||||
if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.particleGenerator")) return makeChange(storage, x, y, z, ModBlocks.particleGenerator);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.customSpawner")) return makeChange(storage, x, y, z, ModBlocks.customSpawner);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.generator")) return makeChange(storage, x, y, z, ModBlocks.generator);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.playerDetectorAdvanced")) return makeChange(storage, x, y, z, ModBlocks.playerDetectorAdvanced);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.energyInfuser")) return makeChange(storage, x, y, z, ModBlocks.energyInfuser);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.draconiumOre")) return makeChange(storage, x, y, z, ModBlocks.draconiumOre);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.weatherController")) return makeChange(storage, x, y, z, ModBlocks.weatherController);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.longRangeDislocator")) return makeChange(storage, x, y, z, ModBlocks.longRangeDislocator);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.grinder")) return makeChange(storage, x, y, z, ModBlocks.grinder);
|
||||
if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.particleGenerator"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.particleGenerator);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.customSpawner"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.customSpawner);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.generator"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.generator);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.playerDetectorAdvanced"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.playerDetectorAdvanced);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.energyInfuser"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.energyInfuser);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.draconiumOre"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.draconiumOre);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.weatherController"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.weatherController);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.longRangeDislocator"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.longRangeDislocator);
|
||||
else if (storage.getBlockByExtId(x, y, z).getUnlocalizedName().equals("tile.tile.grinder"))
|
||||
return makeChange(storage, x, y, z, ModBlocks.grinder);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean makeChange(ExtendedBlockStorage storage, int x, int y, int z, Block block){
|
||||
private boolean makeChange(ExtendedBlockStorage storage, int x, int y, int z, Block block) {
|
||||
if (block == null) return false;
|
||||
LogHelper.info("Changing block at [X:"+x+" Y:"+y+" Z:"+z+"] from "+storage.getBlockByExtId(x, y, z).getUnlocalizedName()+" to "+block.getUnlocalizedName());
|
||||
LogHelper.info("Changing block at [X:" + x + " Y:" + y + " Z:" + z + "] from " + storage.getBlockByExtId(x, y, z).getUnlocalizedName() + " to " + block.getUnlocalizedName());
|
||||
storage.func_150818_a(x, y, z, block);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityConstructing(EntityEvent.EntityConstructing event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer && ExtendedPlayer.get((EntityPlayer) event.entity) == null) ExtendedPlayer.register((EntityPlayer) event.entity);
|
||||
public void onEntityConstructing(EntityEvent.EntityConstructing event) {
|
||||
if (event.entity instanceof EntityPlayer && ExtendedPlayer.get((EntityPlayer) event.entity) == null)
|
||||
ExtendedPlayer.register((EntityPlayer) event.entity);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SubscribeEvent
|
||||
public void itemTooltipEvent(ItemTooltipEvent event){
|
||||
public void itemTooltipEvent(ItemTooltipEvent event) {
|
||||
if (ConfigHandler.showUnlocalizedNames) event.toolTip.add(event.itemStack.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SubscribeEvent
|
||||
public void stopUsingEvent(PlayerUseItemEvent.Start event){
|
||||
public void stopUsingEvent(PlayerUseItemEvent.Start event) {
|
||||
if (!ConfigHandler.pigmenBloodRage || event.item == null || event.item.getItem() == null) return;
|
||||
if (event.item.getItem() == Items.porkchop || event.item.getItem() == Items.cooked_porkchop){
|
||||
if (event.item.getItem() == Items.porkchop || event.item.getItem() == Items.cooked_porkchop) {
|
||||
World world = event.entityPlayer.worldObj;
|
||||
if (world.isRemote) return;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
@@ -213,18 +215,17 @@ public class MinecraftForgeEventHandler {
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
Entity entity1 = (Entity)list.get(i);
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity1 = (Entity) list.get(i);
|
||||
|
||||
if (entity1 instanceof EntityPigZombie)
|
||||
{
|
||||
EntityPigZombie entitypigzombie = (EntityPigZombie)entity1;
|
||||
if (entity1 instanceof EntityPigZombie) {
|
||||
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
entitypigzombie.writeEntityToNBT(compound);
|
||||
compound.setShort("Anger", (short)1000);
|
||||
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;
|
||||
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));
|
||||
}
|
||||
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
package com.brandon3055.draconicevolution.common.core.network;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDataSync;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
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 io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 14/11/2014.
|
||||
*/
|
||||
public class ObjectPacket implements IMessage{
|
||||
public static final byte BYTE = 0;
|
||||
public static final byte SHORT = 1;
|
||||
public static final byte INT = 2;
|
||||
public static final byte LONG = 3;
|
||||
public static final byte FLOAT = 4;
|
||||
public static final byte DOUBLE = 5;
|
||||
public static final byte BOOLEAN = 6;
|
||||
public static final byte CHAR = 7;
|
||||
public static final byte STRING = 8;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
short index;
|
||||
short dataType = -1;
|
||||
Object object;
|
||||
boolean isContainerPacket;
|
||||
|
||||
/**Used for Tile and Container synchronization*/
|
||||
public ObjectPacket() {}
|
||||
|
||||
public ObjectPacket(TileObjectSync tile, byte dataType, int index, Object object) {
|
||||
this.isContainerPacket = tile == null;
|
||||
if (!isContainerPacket) {
|
||||
this.x = tile.xCoord;
|
||||
this.y = tile.yCoord;
|
||||
this.z = tile.zCoord;
|
||||
}
|
||||
this.dataType = dataType;
|
||||
this.object = object;
|
||||
this.index = (short)index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf bytes){
|
||||
bytes.writeBoolean(isContainerPacket);
|
||||
|
||||
if (!isContainerPacket) {
|
||||
bytes.writeInt(x);
|
||||
bytes.writeInt(y);
|
||||
bytes.writeInt(z);
|
||||
}
|
||||
|
||||
bytes.writeByte(dataType);
|
||||
bytes.writeShort(index);
|
||||
|
||||
switch (dataType){
|
||||
case BYTE:
|
||||
bytes.writeByte((Byte)object);
|
||||
break;
|
||||
case SHORT:
|
||||
bytes.writeShort((Short) object);
|
||||
break;
|
||||
case INT:
|
||||
bytes.writeInt((Integer) object);
|
||||
break;
|
||||
case LONG:
|
||||
bytes.writeLong((Long) object);
|
||||
break;
|
||||
case FLOAT:
|
||||
bytes.writeFloat((Float) object);
|
||||
break;
|
||||
case DOUBLE:
|
||||
bytes.writeDouble((Double) object);
|
||||
break;
|
||||
case CHAR:
|
||||
bytes.writeChar((Character) object);
|
||||
break;
|
||||
case STRING:
|
||||
ByteBufUtils.writeUTF8String(bytes, (String)object);
|
||||
break;
|
||||
case BOOLEAN:
|
||||
bytes.writeBoolean((Boolean) object);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf bytes){
|
||||
isContainerPacket = bytes.readBoolean();
|
||||
|
||||
if (!isContainerPacket) {
|
||||
x = bytes.readInt();
|
||||
y = bytes.readInt();
|
||||
z = bytes.readInt();
|
||||
}
|
||||
|
||||
dataType = bytes.readByte();
|
||||
index = bytes.readShort();
|
||||
|
||||
switch (dataType){
|
||||
case BYTE:
|
||||
object = bytes.readByte();
|
||||
break;
|
||||
case SHORT:
|
||||
object = bytes.readShort();
|
||||
break;
|
||||
case INT:
|
||||
object = bytes.readInt();
|
||||
break;
|
||||
case LONG:
|
||||
object = bytes.readLong();
|
||||
break;
|
||||
case FLOAT:
|
||||
object = bytes.readFloat();
|
||||
break;
|
||||
case DOUBLE:
|
||||
object = bytes.readDouble();
|
||||
break;
|
||||
case CHAR:
|
||||
object = bytes.readChar();
|
||||
break;
|
||||
case STRING:
|
||||
object = ByteBufUtils.readUTF8String(bytes);
|
||||
break;
|
||||
case BOOLEAN:
|
||||
object = bytes.readBoolean();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<ObjectPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(ObjectPacket message, MessageContext ctx) {
|
||||
if (message.isContainerPacket){
|
||||
ContainerDataSync container = Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerDataSync ? (ContainerDataSync)Minecraft.getMinecraft().thePlayer.openContainer : null;
|
||||
if (container == null) return null;
|
||||
container.receiveSyncData(message.index, message.object);
|
||||
}else {
|
||||
if (!(Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z) instanceof TileObjectSync)) return null;
|
||||
((TileObjectSync) Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z)).receiveObject(message.index, message.object);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
-10
@@ -143,18 +143,16 @@ public class TeleporterPacket implements IMessage
|
||||
|
||||
if (message.function == SCROLL){
|
||||
int selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0);
|
||||
int selectionOffset = ItemNBTHelper.getIntager(teleporter, "SelectionOffset", 0);
|
||||
int selectionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0);
|
||||
int maxSelect = Math.min(list.tagCount()-1, 11);
|
||||
int maxOffset = Math.max(list.tagCount() - 12, 0);
|
||||
|
||||
LogHelper.info(message.data+" "+maxSelect+" "+selected);
|
||||
|
||||
if(message.data > 0 && selected < maxSelect) {
|
||||
ItemNBTHelper.setShort(teleporter, "Selection", (short) (selected + 1));
|
||||
return null;
|
||||
}
|
||||
if(message.data > 0 && selectionOffset < maxOffset) {
|
||||
ItemNBTHelper.setIntager(teleporter, "SelectionOffset", selectionOffset + 1);
|
||||
ItemNBTHelper.setInteger(teleporter, "SelectionOffset", selectionOffset + 1);
|
||||
return null;
|
||||
}
|
||||
if(message.data < 0 && selected > 0) {
|
||||
@@ -162,7 +160,7 @@ public class TeleporterPacket implements IMessage
|
||||
return null;
|
||||
}
|
||||
if(message.data < 0 && selectionOffset > 0) {
|
||||
ItemNBTHelper.setIntager(teleporter, "SelectionOffset", selectionOffset-1);
|
||||
ItemNBTHelper.setInteger(teleporter, "SelectionOffset", selectionOffset - 1);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -196,15 +194,15 @@ public class TeleporterPacket implements IMessage
|
||||
}
|
||||
|
||||
if (message.function == TELEPORT){
|
||||
int fuel = ItemNBTHelper.getIntager(teleporter, "Fuel", 0);
|
||||
if (!ctx.getServerHandler().playerEntity.capabilities.isCreativeMode)ItemNBTHelper.setIntager(teleporter, "Fuel", fuel - 1);
|
||||
int fuel = ItemNBTHelper.getInteger(teleporter, "Fuel", 0);
|
||||
if (!ctx.getServerHandler().playerEntity.capabilities.isCreativeMode)ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1);
|
||||
TeleportLocation destination = new TeleportLocation();
|
||||
destination.readFromNBT(list.getCompoundTagAt(message.data));
|
||||
destination.sendEntityToCoords(ctx.getServerHandler().playerEntity);
|
||||
}
|
||||
|
||||
if (message.function == ADDFUEL){
|
||||
int fuel = ItemNBTHelper.getIntager(teleporter, "Fuel", 0);
|
||||
int fuel = ItemNBTHelper.getInteger(teleporter, "Fuel", 0);
|
||||
int count = 0;
|
||||
for (int i = 0; i < message.data; i++)
|
||||
{
|
||||
@@ -213,7 +211,7 @@ public class TeleporterPacket implements IMessage
|
||||
count++;
|
||||
}else break;
|
||||
}
|
||||
ItemNBTHelper.setIntager(teleporter, "Fuel", fuel + (ConfigHandler.teleporterUsesPerPearl * count));
|
||||
ItemNBTHelper.setInteger(teleporter, "Fuel", fuel + (ConfigHandler.teleporterUsesPerPearl * count));
|
||||
}
|
||||
|
||||
if (message.function == CHANGESELECTION){
|
||||
@@ -221,7 +219,7 @@ public class TeleporterPacket implements IMessage
|
||||
}
|
||||
|
||||
if (message.function == UPDATEOFFSET){
|
||||
ItemNBTHelper.setIntager(teleporter, "SelectionOffset", message.data);
|
||||
ItemNBTHelper.setInteger(teleporter, "SelectionOffset", message.data);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+10
-13
@@ -26,7 +26,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -69,18 +68,20 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
public void registerRendering()
|
||||
{
|
||||
//Item Renderers
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBow());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBow());
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.mobSoul, new RenderMobSoul());
|
||||
|
||||
TileEntitySpecialRenderer render = new RenderTileParticleGen();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileParticleGenerator.class, render);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen(render, new TileParticleGenerator()));
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser());
|
||||
|
||||
render = new RenderTileEnergyInfiser();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyInfuser.class, render);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser(render, new TileEnergyInfuser()));
|
||||
//ISimpleBlockRendering
|
||||
RenderingRegistry.registerBlockHandler(new RenderTeleporterStand());
|
||||
|
||||
//TileEntitySpecialRenderers
|
||||
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(TileEnergyStorageCore.class, new RenderTileEnergyStorageCore());
|
||||
@@ -90,16 +91,12 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTeleporterStand.class, new RenderTileTeleporterStand());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileDraconiumChest.class, new RenderTileDraconiumChest());
|
||||
|
||||
//RenderingRegistry.registerEntityRenderingHandler(EntityChaosDrill.class, new EntityChaosDrillRenderer());
|
||||
|
||||
//Entitys
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new RenderDragon());
|
||||
}
|
||||
|
||||
public void registerRenderIDs (){
|
||||
References.idTeleporterStand = RenderingRegistry.getNextAvailableRenderId();
|
||||
References.idDraconiumChest = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new RenderTeleporterStand());
|
||||
RenderingRegistry.registerBlockHandler(new RenderDraconiumChest());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,13 +4,19 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.creativetab.DETab;
|
||||
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.*;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.CraftingHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.FMLEventHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.MinecraftForgeEventHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.network.*;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.common.entity.*;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.magic.EnchantmentReaper;
|
||||
import com.brandon3055.draconicevolution.common.magic.PotionHandler;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.*;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
|
||||
@@ -25,8 +31,12 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
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.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
public class CommonProxy {
|
||||
//private final static boolean debug = DraconicEvolution.debug;
|
||||
|
||||
@@ -38,6 +48,33 @@ public class CommonProxy {
|
||||
GameRegistry.registerWorldGenerator(new DraconicWorldGenerator(), 1);
|
||||
registerTileEntities();
|
||||
initializeNetwork();
|
||||
|
||||
DraconicEvolution.reaperEnchant = new EnchantmentReaper(ConfigHandler.reaperEnchantID);
|
||||
|
||||
Potion[] potionTypes = null;
|
||||
LogHelper.info("Expanding Potion array size to 256");
|
||||
|
||||
for (Field f : Potion.class.getDeclaredFields()) {
|
||||
f.setAccessible(true);
|
||||
|
||||
try {
|
||||
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
|
||||
Field modfield = Field.class.getDeclaredField("modifiers");
|
||||
modfield.setAccessible(true);
|
||||
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
|
||||
potionTypes = (Potion[]) f.get(null);
|
||||
final Potion[] newPotionTypes = new Potion[256];
|
||||
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
|
||||
f.set(null, newPotionTypes);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
LogHelper.error("Severe error, please report this to the mod author:");
|
||||
LogHelper.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
LogHelper.info("Finished PreInitialization");
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
@@ -46,13 +83,17 @@ public class CommonProxy {
|
||||
registerWorldGen();
|
||||
registerEntitys();
|
||||
DETab.initialize();
|
||||
PotionHandler.init();
|
||||
|
||||
LogHelper.info("Finished Initialization");
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
OreDoublingRegistry.init();
|
||||
LogHelper.info("Finished PostInitialization");
|
||||
}
|
||||
|
||||
public void initializeNetwork(){
|
||||
public void initializeNetwork() {
|
||||
DraconicEvolution.network = NetworkRegistry.INSTANCE.newSimpleChannel(DraconicEvolution.networkChannelName);
|
||||
DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER);
|
||||
@@ -60,6 +101,7 @@ public class CommonProxy {
|
||||
DraconicEvolution.network.registerMessage(PlayerDetectorButtonPacket.Handler.class, PlayerDetectorButtonPacket.class, 3, Side.SERVER);
|
||||
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);
|
||||
}
|
||||
|
||||
public void registerTileEntities() {
|
||||
@@ -83,8 +125,7 @@ public class CommonProxy {
|
||||
GameRegistry.registerTileEntity(TileDissEnchanter.class, References.RESOURCESPREFIX + "TileDissEnchanter");
|
||||
GameRegistry.registerTileEntity(TileTeleporterStand.class, References.RESOURCESPREFIX + "TileTeleporterStand");
|
||||
GameRegistry.registerTileEntity(TileDraconiumChest.class, References.RESOURCESPREFIX + "TileDraconiumChest");
|
||||
if (DraconicEvolution.debug)
|
||||
{
|
||||
if (DraconicEvolution.debug) {
|
||||
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
|
||||
GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate");
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,9 +10,9 @@ import net.minecraft.util.IChatComponent;
|
||||
* Created by Brandon on 1/09/2014.
|
||||
*/
|
||||
public class DamageSourceChaos extends EntityDamageSource {
|
||||
public DamageSourceChaos(String s, Entity entity)
|
||||
public DamageSourceChaos(Entity entity)
|
||||
{
|
||||
super(s, entity);
|
||||
super("Chaos", entity);
|
||||
this.setDamageBypassesArmor();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.core.utills;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 28/06/2014.
|
||||
*/
|
||||
public class EnergyHelper {
|
||||
|
||||
public static boolean isEnergyContainerItem(ItemStack stack)
|
||||
{
|
||||
return (stack != null) && ((stack.getItem() instanceof IEnergyContainerItem));
|
||||
}
|
||||
|
||||
public static ItemStack setDefaultEnergyTag(ItemStack container, int energy) {
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.brandon3055.draconicevolution.common.core.utills;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/11/2014.
|
||||
*/
|
||||
public interface ICustomItemData {
|
||||
|
||||
public static final String tagName = "TileCompound";
|
||||
|
||||
void writeDataToItem(NBTTagCompound compound, ItemStack stack);
|
||||
|
||||
void readDataFromItem(NBTTagCompound compound, ItemStack stack);
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.brandon3055.draconicevolution.common.core.utills;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 1/07/2014.
|
||||
*/
|
||||
public class InfoHelper {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addEnergyInfo(ItemStack stack, List list) {
|
||||
IEnergyContainerItem item = (IEnergyContainerItem)stack.getItem();
|
||||
int energy = item.getEnergyStored(stack);
|
||||
int maxEnergy = item.getMaxEnergyStored(stack);
|
||||
String eS = "";
|
||||
String eM = "";
|
||||
if (energy < 1000)
|
||||
eS = String.valueOf(energy);
|
||||
else if (energy < 1000000)
|
||||
eS = String.valueOf(Math.round((float)energy / 10F)/100F)+"k";
|
||||
else
|
||||
eS = String.valueOf(Math.round((float)energy / 1000F)/1000F)+"m";
|
||||
if (maxEnergy < 1000)
|
||||
eM = String.valueOf(maxEnergy);
|
||||
else if (maxEnergy < 1000000)
|
||||
eM = String.valueOf(Math.round((float)maxEnergy / 100F)/10F)+"k";
|
||||
else
|
||||
eM = String.valueOf(Math.round((float)maxEnergy / 10000F)/100F)+"m";
|
||||
|
||||
list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + eS + " / " + eM + " RF");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addLore(ItemStack stack, List list, boolean addLeadingLine){
|
||||
if (ConfigHandler.disableLore) return;
|
||||
String[] lore = getLore(stack);
|
||||
if (addLeadingLine) list.add("");
|
||||
if (lore == null) {
|
||||
list.add("" + EnumChatFormatting.ITALIC + "" + EnumChatFormatting.DARK_PURPLE + "Invalid lore localization see console for details");
|
||||
return;
|
||||
}
|
||||
for (String s : lore) list.add("" + EnumChatFormatting.ITALIC + "" + EnumChatFormatting.DARK_PURPLE + s);
|
||||
}
|
||||
|
||||
/**Add lore with a blank line above it*/
|
||||
public static void addLore(ItemStack stack, List list){
|
||||
addLore(stack, list, true);
|
||||
}
|
||||
|
||||
/**Add the standard energy and lore information*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addEnergyAndLore(ItemStack stack, List list){
|
||||
if (!isShiftKeyDown()) list.add(StatCollector.translateToLocal("info.de.hold.txt")+" "+EnumChatFormatting.AQUA + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.de.shift.txt") + EnumChatFormatting.RESET + " " + EnumChatFormatting.GRAY + StatCollector.translateToLocal("info.de.forDetails.txt"));
|
||||
else {
|
||||
addEnergyInfo(stack, list);
|
||||
addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
/**returns lore text or an empty string if the lore is not set*/
|
||||
public static String[] getLore(ItemStack stack){
|
||||
String unlocalizeLore = stack.getItem().getUnlocalizedName() + ".lore";
|
||||
String rawLore = StatCollector.translateToLocal(unlocalizeLore);
|
||||
|
||||
if (rawLore.contains(unlocalizeLore)){
|
||||
LogHelper.error("Invalid or missing Lore localization \""+unlocalizeLore+"\"");
|
||||
return null;
|
||||
}
|
||||
|
||||
String lineCountS = rawLore.substring(0, 1);
|
||||
rawLore = rawLore.substring(1);
|
||||
int lineCount = 0;
|
||||
|
||||
try {
|
||||
lineCount = Integer.parseInt(lineCountS);
|
||||
}catch (NumberFormatException e){
|
||||
LogHelper.error("Invalid Lore Format! Lore myst start with the number of lines \"3Line 1\\nLine 2\\nLine 3\"");
|
||||
}
|
||||
|
||||
String[] loreLines = new String[lineCount];
|
||||
|
||||
for (int i = 0; i < lineCount; i++){
|
||||
if (rawLore.contains("\\n")) loreLines[i] = rawLore.substring(0, rawLore.indexOf("\\n"));
|
||||
else loreLines[i] = rawLore;
|
||||
if (rawLore.contains("\\n")) rawLore = rawLore.substring(rawLore.indexOf("\\n")+2);
|
||||
}
|
||||
|
||||
return loreLines;
|
||||
}
|
||||
|
||||
public static boolean isShiftKeyDown() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static boolean holdShiftForDetails(List list, boolean inverted){
|
||||
if (isShiftKeyDown() == inverted) list.add(StatCollector.translateToLocal("info.de.hold.txt")+" "+EnumChatFormatting.AQUA + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.de.shift.txt") + EnumChatFormatting.RESET + " " + EnumChatFormatting.GRAY + StatCollector.translateToLocal("info.de.forDetails.txt"));
|
||||
return isShiftKeyDown();
|
||||
}
|
||||
|
||||
public static boolean holdShiftForDetails(List list){
|
||||
return holdShiftForDetails(list, false);
|
||||
}
|
||||
|
||||
/**"Information Text Colour" The colour used for custom tool tip info*/
|
||||
public static String ITC(){return "" + EnumChatFormatting.RESET + "" + EnumChatFormatting.DARK_AQUA;}
|
||||
/**"Highlighted Information Text Colour" The colour used for parts that need to stand out*/
|
||||
public static String HITC(){return "" + EnumChatFormatting.RESET + "" + EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GOLD;}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.core.utills;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 1/07/2014.
|
||||
*/
|
||||
public class ItemInfoHelper {
|
||||
public static void energyDisplayInfo(ItemStack stack, List list) {
|
||||
IEnergyContainerItem item = (IEnergyContainerItem)stack.getItem();
|
||||
int energy = item.getEnergyStored(stack);
|
||||
int maxEnergy = item.getMaxEnergyStored(stack);
|
||||
String eS = "";
|
||||
String eM = "";
|
||||
if (energy < 1000)
|
||||
eS = String.valueOf(energy);
|
||||
else if (energy < 1000000)
|
||||
eS = String.valueOf(Math.round((float)energy / 100F)/10F)+"k";
|
||||
else
|
||||
eS = String.valueOf(Math.round((float)energy / 10000F)/100F)+"m";
|
||||
if (maxEnergy < 1000)
|
||||
eM = String.valueOf(maxEnergy);
|
||||
else if (maxEnergy < 1000000)
|
||||
eM = String.valueOf(Math.round((float)maxEnergy / 100F)/10F)+"k";
|
||||
else
|
||||
eM = String.valueOf(Math.round((float)maxEnergy / 10000F)/100F)+"m";
|
||||
|
||||
list.add(eS + " / " + eM + " RF");
|
||||
}
|
||||
}
|
||||
+13
-7
@@ -16,45 +16,51 @@ public final class ItemNBTHelper {
|
||||
return stack.getTagCompound();
|
||||
}
|
||||
|
||||
public static void setBoolean(ItemStack stack, String tag, boolean b)
|
||||
public static ItemStack setBoolean(ItemStack stack, String tag, boolean b)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setBoolean(tag, b);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void setShort(ItemStack stack, String tag, short s)
|
||||
public static ItemStack setShort(ItemStack stack, String tag, short s)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setShort(tag, s);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void setIntager(ItemStack stack, String tag, int i)
|
||||
public static ItemStack setInteger(ItemStack stack, String tag, int i)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setInteger(tag, i);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void setFloat(ItemStack stack, String tag, float f)
|
||||
public static ItemStack setFloat(ItemStack stack, String tag, float f)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setFloat(tag, f);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void setDouble(ItemStack stack, String tag, double d)
|
||||
public static ItemStack setDouble(ItemStack stack, String tag, double d)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setDouble(tag, d);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void setString(ItemStack stack, String tag, String s) {
|
||||
public static ItemStack setString(ItemStack stack, String tag, String s) {
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setString(tag, s);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
// GETTERS ///////////////////////////////////////////////////////////////////
|
||||
@@ -75,7 +81,7 @@ public final class ItemNBTHelper {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getShort(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static int getIntager(ItemStack stack, String tag, int defaultExpected) {
|
||||
public static int getInteger(ItemStack stack, String tag, int defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getInteger(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -390,7 +390,7 @@ public class EntityCustomDragon extends EntityDragon {
|
||||
}
|
||||
if (entity instanceof EntityLivingBase && isUber){
|
||||
((EntityLivingBase)entity).setLastAttacker(this);
|
||||
entity.attackEntityFrom(new DamageSourceChaos("ChaosDragon", this), 20F);
|
||||
entity.attackEntityFrom(new DamageSourceChaos(this), 20F);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,7 +405,7 @@ public class EntityCustomDragon extends EntityDragon {
|
||||
}
|
||||
if (entity instanceof EntityLivingBase && isUber){
|
||||
((EntityLivingBase)entity).setLastAttacker(this);
|
||||
entity.attackEntityFrom(new DamageSourceChaos("ChaosDragon", this), 50F);
|
||||
entity.attackEntityFrom(new DamageSourceChaos(this), 50F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -34,7 +34,8 @@ public class EntityPersistentItem extends EntityItem {
|
||||
public EntityPersistentItem(World world, Entity original, ItemStack stack)
|
||||
{
|
||||
this(world, original.posX, original.posY, original.posZ);
|
||||
this.delayBeforeCanPickup = 20;
|
||||
if (original instanceof EntityItem) this.delayBeforeCanPickup = ((EntityItem)original).delayBeforeCanPickup;
|
||||
else this.delayBeforeCanPickup = 20;
|
||||
this.motionX = original.motionX;
|
||||
this.motionY = original.motionY;
|
||||
this.motionZ = original.motionZ;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.inventory;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -20,7 +19,7 @@ public class SlotChargable extends Slot {
|
||||
{
|
||||
if (super.isItemValid(stack))
|
||||
{
|
||||
return EnergyHelper.isEnergyContainerItem(stack);
|
||||
return stack != null && stack.getItem() instanceof IEnergyContainerItem;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package com.brandon3055.draconicevolution.common.items;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -19,11 +21,12 @@ public class DraconicCore extends ItemDE {
|
||||
ModItems.register(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
par3List.add(StatCollector.translateToLocal("info.draconicCore.txt"));
|
||||
par3List.add("");
|
||||
par3List.add("" + EnumChatFormatting.DARK_PURPLE + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.draconicCore1.txt"));
|
||||
par3List.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicCore.txt"));
|
||||
par3List.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicCore1.txt"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,5 +9,4 @@ public class DraconiumIngot extends ItemDE {
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
|
||||
ModItems.register(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,8 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
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.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemDE extends Item {
|
||||
public String getUnwrappedUnlocalizedName(final String unlocalizedName){
|
||||
@@ -37,9 +35,4 @@ public class ItemDE extends Item {
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return null;//new EntityPersistentItem(world, location, itemstack);
|
||||
}
|
||||
}
|
||||
@@ -41,14 +41,14 @@ public class Key extends ItemDE {
|
||||
return;
|
||||
}
|
||||
|
||||
int keyCode = ItemNBTHelper.getIntager(key, "KeyCode", 0);
|
||||
int keyCode = ItemNBTHelper.getInteger(key, "KeyCode", 0);
|
||||
list.add(keyCode == 0 ? "Un-Bound" : "Key Code: " + String.valueOf(keyCode));
|
||||
|
||||
if (keyCode != 0){
|
||||
list.add("Linked to {X:"+ItemNBTHelper.getIntager(key, "X", 0)+" Y:"+ItemNBTHelper.getIntager(key, "Y", 0)+" X:"+ItemNBTHelper.getIntager(key, "Z", 0)+"}");
|
||||
if (ItemNBTHelper.getIntager(key, "LockCount", 0) == 0) return;
|
||||
for (int i = 1; i <= ItemNBTHelper.getIntager(key, "LockCount", 0); i++){
|
||||
list.add("Linked to {X:"+ItemNBTHelper.getIntager(key, "X_"+i, 0)+" Y:"+ItemNBTHelper.getIntager(key, "Y_"+i, 0)+" X:"+ItemNBTHelper.getIntager(key, "Z_"+i, 0)+"}");
|
||||
list.add("Linked to {X:"+ItemNBTHelper.getInteger(key, "X", 0)+" Y:"+ItemNBTHelper.getInteger(key, "Y", 0)+" X:"+ItemNBTHelper.getInteger(key, "Z", 0)+"}");
|
||||
if (ItemNBTHelper.getInteger(key, "LockCount", 0) == 0) return;
|
||||
for (int i = 1; i <= ItemNBTHelper.getInteger(key, "LockCount", 0); i++){
|
||||
list.add("Linked to {X:"+ItemNBTHelper.getInteger(key, "X_" + i, 0)+" Y:"+ItemNBTHelper.getInteger(key, "Y_" + i, 0)+" X:"+ItemNBTHelper.getInteger(key, "Z_" + i, 0)+"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,6 @@ public class Key extends ItemDE {
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack, int pass) {
|
||||
if (stack.getItemDamage() == 1) return true;
|
||||
return ItemNBTHelper.getIntager(stack, "KeyCode", 0) != 0;
|
||||
return ItemNBTHelper.getInteger(stack, "KeyCode", 0) != 0;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
@@ -75,6 +74,10 @@ public class Tclogo extends ItemDE {
|
||||
{
|
||||
//if (!world.isRemote)OreDoublingRegistry.getOreResult(GameRegistry.findItemStack("ThermalFoundation", "oreCopper", 1));
|
||||
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionFlight.id, 100, 0));
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionFireResist.id, 100, 1));
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 100, 1));
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionUpHillStep.id, 100, 1));
|
||||
int xi = (int)player.posX;
|
||||
int yi = (int)player.posY;
|
||||
int zi = (int)player.posZ;
|
||||
@@ -84,10 +87,10 @@ public class Tclogo extends ItemDE {
|
||||
for (int x = xi-rad; x < xi+rad; x++){
|
||||
for (int y = yi-10; y < yi+30; y++){
|
||||
for (int z = zi-rad; z < zi+rad; z++){
|
||||
block = world.getBlock(x, y, z);
|
||||
if (block.getMaterial().equals(Material.vine) || block.getMaterial().equals(Material.plants)){
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
// block = world.getBlock(x, y, z);
|
||||
//if (block.getMaterial().equals(Material.vine) || block.getMaterial().equals(Material.plants)){
|
||||
//world.setBlockToAir(x, y, z);
|
||||
//}
|
||||
|
||||
//world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/11/2014.
|
||||
*/
|
||||
public class ArmorEffectHandler {
|
||||
|
||||
// slotHelm = 4;
|
||||
// slotChest = 3;
|
||||
// slotLeggs = 2;
|
||||
// slotBoots = 1;
|
||||
|
||||
public static boolean getHasFlight(EntityPlayer player){
|
||||
return isDraconicArmor(player, 3) && ((IEnergyContainerItem)player.getEquipmentInSlot(3).getItem()).extractEnergy(player.getEquipmentInSlot(3), 80, !player.capabilities.isFlying) == 80;
|
||||
}
|
||||
|
||||
public static boolean getHasSwiftness(EntityPlayer player){
|
||||
return isDraconicArmor(player, 2) || isWyvernArmor(player, 2);
|
||||
}
|
||||
|
||||
public static int getSwiftnessLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 2) ? 1 : isDraconicArmor(player, 2) ? 2 : 0;
|
||||
return player.isSprinting() ? i * 2 : i;
|
||||
}
|
||||
|
||||
public static boolean getHasJumpBoost(EntityPlayer player){
|
||||
return (isDraconicArmor(player, 1) || isWyvernArmor(player, 1)) && extractEnergy(player, (getJumpLevel(player)+1)*1000, 1);
|
||||
}
|
||||
|
||||
public static int getJumpLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 1) ? 1 : isDraconicArmor(player, 1) ? 2 : 0;
|
||||
return player.isSprinting() ? i * 2 : i;
|
||||
}
|
||||
|
||||
public static boolean getFireImunity(EntityPlayer player){
|
||||
if (isDraconicArmor(player, 3) && extractEnergy(player, 80, 3)) return true;
|
||||
return (isWyvernArmor(player, 1) && isWyvernArmor(player, 2) && isWyvernArmor(player, 3) && isWyvernArmor(player, 4));
|
||||
}
|
||||
|
||||
public static boolean getHasHighStep(EntityPlayer player){
|
||||
return isDraconicArmor(player, 1);
|
||||
}
|
||||
|
||||
public static boolean isWyvernArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof WyvernArmor && ((WyvernArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean isDraconicArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof DraconicArmor && ((DraconicArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean extractEnergy(EntityPlayer player, int amount, int slot){
|
||||
if (player.getEquipmentInSlot(slot).getItem() instanceof IEnergyContainerItem) return ((IEnergyContainerItem)player.getEquipmentInSlot(slot).getItem()).extractEnergy(player.getEquipmentInSlot(slot), amount, false) == amount;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
-114
@@ -1,114 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.DamageSourceChaos;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 3/07/2014.
|
||||
*/
|
||||
public class ArmorPropertiesHandler {
|
||||
|
||||
public static ISpecialArmor.ArmorProperties draconicHelm(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
if (source instanceof DamageSourceChaos)
|
||||
return new ISpecialArmor.ArmorProperties(1, 0, 0);
|
||||
else if (source == DamageSource.fallingBlock || source == DamageSource.anvil)
|
||||
return new ISpecialArmor.ArmorProperties(1, 1, Integer.MAX_VALUE);
|
||||
else if (isFireDamage(source))
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.15, Integer.MAX_VALUE);
|
||||
else
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.14, Integer.MAX_VALUE);
|
||||
|
||||
}
|
||||
|
||||
public static ISpecialArmor.ArmorProperties draconicChest(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
if (source instanceof DamageSourceChaos)
|
||||
return new ISpecialArmor.ArmorProperties(1, 0, 0);
|
||||
else if (hasFullSetDraconic(player) && source == DamageSource.wither || source == DamageSource.magic)
|
||||
return new ISpecialArmor.ArmorProperties(1, 1, Integer.MAX_VALUE);
|
||||
else if (isFireDamage(source))
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.50, Integer.MAX_VALUE);
|
||||
else
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.50, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static ISpecialArmor.ArmorProperties draconicLeggs(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
if (source instanceof DamageSourceChaos)
|
||||
return new ISpecialArmor.ArmorProperties(1, 0, 0);
|
||||
else if (isFireDamage(source))
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.20, Integer.MAX_VALUE);
|
||||
else
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.18, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static ISpecialArmor.ArmorProperties draconicBoots(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
if (source instanceof DamageSourceChaos)
|
||||
return new ISpecialArmor.ArmorProperties(1, 0, 0);
|
||||
else if (isFireDamage(source))
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.15, Integer.MAX_VALUE);
|
||||
else if (source == DamageSource.fall)
|
||||
return new ISpecialArmor.ArmorProperties(1, 1, Integer.MAX_VALUE);
|
||||
else
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.14, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static boolean isFireDamage(DamageSource damage){
|
||||
return damage == DamageSource.inFire || damage == DamageSource.onFire || damage == DamageSource.lava;
|
||||
}
|
||||
|
||||
public static boolean hasFullSetDraconic(EntityLivingBase player){
|
||||
ItemStack slotBoots = player.getEquipmentInSlot(1);
|
||||
ItemStack slotLeggs = player.getEquipmentInSlot(2);
|
||||
ItemStack slotChest = player.getEquipmentInSlot(3);
|
||||
ItemStack slotHelmet = player.getEquipmentInSlot(4);
|
||||
if (slotBoots == null || slotHelmet == null || slotChest == null || slotLeggs == null)
|
||||
return false;
|
||||
if(slotBoots.getItem() == ModItems.draconicBoots && slotLeggs.getItem() == ModItems.draconicLeggs && slotChest.getItem() == ModItems.draconicChest && slotHelmet.getItem() == ModItems.draconicHelm)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static ISpecialArmor.ArmorProperties wyvernHelm(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.12, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static ISpecialArmor.ArmorProperties wyvernChest(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
if (hasFullSetWyvern(player) && source == DamageSource.magic)
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.9, Integer.MAX_VALUE);
|
||||
else if (isFireDamage(source))
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.49, Integer.MAX_VALUE);
|
||||
else
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.48, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static ISpecialArmor.ArmorProperties wyvernLeggs(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
if (isFireDamage(source))
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.19, Integer.MAX_VALUE);
|
||||
else
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.16, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static ISpecialArmor.ArmorProperties wyvernBoots(EntityLivingBase player, ItemStack armor, DamageSource source){
|
||||
if (isFireDamage(source))
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.14, Integer.MAX_VALUE);
|
||||
else
|
||||
return new ISpecialArmor.ArmorProperties(1, 0.12, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static boolean hasFullSetWyvern(EntityLivingBase player){
|
||||
ItemStack slotBoots = player.getEquipmentInSlot(1);
|
||||
ItemStack slotLeggs = player.getEquipmentInSlot(2);
|
||||
ItemStack slotChest = player.getEquipmentInSlot(3);
|
||||
ItemStack slotHelmet = player.getEquipmentInSlot(4);
|
||||
if (slotBoots == null || slotHelmet == null || slotChest == null || slotLeggs == null)
|
||||
return false;
|
||||
if(slotBoots.getItem() == ModItems.wyvernBoots && slotLeggs.getItem() == ModItems.wyvernLeggs && slotChest.getItem() == ModItems.wyvernChest && slotHelmet.getItem() == ModItems.wyvernHelm)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+141
-95
@@ -1,7 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -10,21 +12,21 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -32,12 +34,17 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Brandon on 3/07/2014.
|
||||
*/
|
||||
public class DraconicArmor extends ItemArmor implements ISpecialArmor {
|
||||
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem {//TODO Wings
|
||||
private IIcon helmIcon;
|
||||
private IIcon chestIcon;
|
||||
private IIcon leggsIcon;
|
||||
private IIcon bootsIcon;
|
||||
|
||||
private double totalAbsorption = 2; // 1=100%
|
||||
private int maxTransfer = References.DRACONICTRANSFER;
|
||||
private int maxEnergy = References.DRACONICCAPACITY;
|
||||
private int energyPerDamage = 80;
|
||||
|
||||
public DraconicArmor(ArmorMaterial material, int armorType, String name) {
|
||||
super(material, 0, armorType);
|
||||
this.setUnlocalizedName(name);
|
||||
@@ -45,6 +52,18 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor {
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item), "Energy", maxEnergy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
|
||||
@@ -92,66 +111,68 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor {
|
||||
}
|
||||
}
|
||||
|
||||
//#####################################################################################
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
return 1D - (double)ItemNBTHelper.getInteger(stack, "Energy", 0) / (double)maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return getEnergyStored(stack) < maxEnergy;
|
||||
}
|
||||
|
||||
protected double getAbsorptionPercent() {
|
||||
switch (armorType) {
|
||||
case 0:
|
||||
return 0.15D;
|
||||
case 1:
|
||||
return 0.40D;
|
||||
case 2:
|
||||
return 0.30D;
|
||||
case 3:
|
||||
return 0.15D;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ISpecialArmor */
|
||||
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
switch (slot) {
|
||||
case 0:
|
||||
return ArmorPropertiesHandler.draconicBoots(player, armor, source);
|
||||
case 1:
|
||||
return ArmorPropertiesHandler.draconicLeggs(player, armor, source);
|
||||
case 2:
|
||||
return ArmorPropertiesHandler.draconicChest(player, armor, source);
|
||||
case 3:
|
||||
return ArmorPropertiesHandler.draconicHelm(player, armor, source);
|
||||
default:
|
||||
LogHelper.error("[Draconic Armor] Invalid slot");
|
||||
return new ArmorProperties(0, 0, 0);
|
||||
|
||||
}
|
||||
int maxAbsorption = 25 * getEnergyStored(armor) / energyPerDamage;
|
||||
if (source.damageType.equals(DamageSource.fall.damageType) && armor.getItem() == ModItems.draconicBoots) return new ArmorProperties(0, 1D, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getAbsorptionPercent()*totalAbsorption)/2, maxAbsorption);
|
||||
return new ArmorProperties(0, getAbsorptionPercent()*totalAbsorption, maxAbsorption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
switch (slot) {
|
||||
case 0:
|
||||
return 3;
|
||||
case 1:
|
||||
return 6;
|
||||
case 2:
|
||||
return 8;
|
||||
case 3:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return this.getEnergyStored(armor) > 10000 ? (int)(getAbsorptionPercent() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getAbsorptionPercent() * 20D));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
|
||||
extractEnergy(stack, damage * energyPerDamage, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
if (player.isBurning() && ArmorPropertiesHandler.hasFullSetDraconic(player)) {
|
||||
player.addPotionEffect(new PotionEffect(12, 10, 0, true));
|
||||
}
|
||||
if (stack != null && stack.getItem() == ModItems.draconicHelm) {
|
||||
if (stack == null) return;
|
||||
if (stack.getItem() == ModItems.draconicHelm) {
|
||||
if (world.isRemote) return;
|
||||
clearNegativeEffects(player);
|
||||
if (player.worldObj.getBlockLightValue((int) player.posX, (int) player.posY, (int) player.posZ) < 5)
|
||||
if (this.getEnergyStored(stack) >= 5000 && clearNegativeEffects(player)) this.extractEnergy(stack, 5000, false);
|
||||
if (player.worldObj.getBlockLightValue((int)Math.floor(player.posX), (int) player.posY, (int)Math.floor(player.posZ)) < 5)
|
||||
player.addPotionEffect(new PotionEffect(16, 210, 0, true));
|
||||
else if (player.isPotionActive(16)) player.removePotionEffect(16);
|
||||
|
||||
}
|
||||
if (stack != null && stack.getItem() == ModItems.draconicLeggs) {
|
||||
if (player.isSprinting()) player.addPotionEffect(new PotionEffect(1, 10, 3, true));
|
||||
else player.addPotionEffect(new PotionEffect(1, 10, 1, true));
|
||||
}
|
||||
if (stack != null && stack.getItem() == ModItems.draconicBoots) {
|
||||
if (player.isSprinting()) player.addPotionEffect(new PotionEffect(8, 10, 3, true));
|
||||
else player.addPotionEffect(new PotionEffect(8, 10, 1, true));
|
||||
if (stack.getItem() == ModItems.draconicLeggs && player.isSprinting() && !player.capabilities.isCreativeMode) {
|
||||
this.extractEnergy(stack, player.capabilities.isFlying ? 160 : 80, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,26 +180,82 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
|
||||
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
} else {
|
||||
if (stack.getItem() == ModItems.draconicHelm) {
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoHelm.txt"));
|
||||
} else if (stack.getItem() == ModItems.draconicChest) {
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest.txt"));
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest1.txt"));
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest2.txt"));
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest3.txt"));
|
||||
} else if (stack.getItem() == ModItems.draconicLeggs) {
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoLeggs.txt"));
|
||||
} else if (stack.getItem() == ModItems.draconicBoots) {
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoBoots.txt"));
|
||||
list.add(StatCollector.translateToLocal("info.draconicArmorInfoBoots1.txt"));
|
||||
InfoHelper.addEnergyAndLore(stack, list);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean clearNegativeEffects(Entity par3Entity) {
|
||||
boolean flag = false;
|
||||
if (par3Entity.ticksExisted % 20 == 0) {
|
||||
if (par3Entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) par3Entity;
|
||||
|
||||
Collection<PotionEffect> potions = player.getActivePotionEffects();
|
||||
|
||||
if (player.isBurning()) {
|
||||
player.extinguish();
|
||||
flag = true;
|
||||
} else for (PotionEffect potion : potions) {
|
||||
int id = potion.getPotionID();
|
||||
if (ReflectionHelper.getPrivateValue(Potion.class, Potion.potionTypes[id], new String[]{"isBadEffect", "field_76418_K", "J"})) {
|
||||
if ((player.getHeldItem() == null || (player.getHeldItem().getItem() != ModItems.wyvernBow && player.getHeldItem().getItem() != ModItems.draconicBow)) || id != 2) {
|
||||
player.removePotionEffect(id);
|
||||
flag = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
list.add("");
|
||||
list.add("" + EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.draconicArmorLegend1.txt"));
|
||||
list.add("" + EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.draconicArmorLegend2.txt"));
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
int stored = ItemNBTHelper.getInteger(container, "Energy", 0);
|
||||
int receive = Math.min(maxReceive, Math.min(maxEnergy - stored, maxTransfer));
|
||||
|
||||
if (!simulate) {
|
||||
stored += receive;
|
||||
ItemNBTHelper.setInteger(container, "Energy", stored);
|
||||
}
|
||||
return receive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
int stored = ItemNBTHelper.getInteger(container, "Energy", 0);
|
||||
int extract = Math.min(maxExtract, stored);
|
||||
|
||||
if (!simulate) {
|
||||
stored -= extract;
|
||||
ItemNBTHelper.setInteger(container, "Energy", stored);
|
||||
}
|
||||
return extract;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
return ItemNBTHelper.getInteger(container, "Energy", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new EntityPersistentItem(world, location, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void registerRecipe() {
|
||||
@@ -191,35 +268,4 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor {
|
||||
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicBoots), "ISI", "DAD", "CIC", 'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernBoots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new EntityPersistentItem(world, location, itemstack);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void clearNegativeEffects(Entity par3Entity) {
|
||||
if (par3Entity.ticksExisted % 20 == 0) {
|
||||
if (par3Entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) par3Entity;
|
||||
|
||||
Collection<PotionEffect> potions = player.getActivePotionEffects();
|
||||
|
||||
if (player.isBurning()) {
|
||||
player.extinguish();
|
||||
} else for (PotionEffect potion : potions) {
|
||||
int id = potion.getPotionID();
|
||||
if (ReflectionHelper.getPrivateValue(Potion.class, Potion.potionTypes[id], new String[]{"isBadEffect", "field_76418_K", "J"})) {
|
||||
if ((player.getHeldItem() == null || (player.getHeldItem().getItem() != ModItems.wyvernBow && player.getHeldItem().getItem() != ModItems.draconicBow)) || id != 2) player.removePotionEffect(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+111
-47
@@ -1,7 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -9,19 +11,19 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
|
||||
@@ -30,12 +32,17 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Brandon on 3/07/2014.
|
||||
*/
|
||||
public class WyvernArmor extends ItemArmor implements ISpecialArmor{
|
||||
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem{
|
||||
private IIcon helmIcon;
|
||||
private IIcon chestIcon;
|
||||
private IIcon leggsIcon;
|
||||
private IIcon bootsIcon;
|
||||
|
||||
private double totalAbsorption = 1; // 1=100%
|
||||
private int maxTransfer = References.WYVERNTRANSFER;
|
||||
private int maxEnergy = References.WYVERNCAPACITY;
|
||||
private int energyPerDamage = 80;
|
||||
|
||||
public WyvernArmor(ArmorMaterial material, int armorType, String name) {
|
||||
super(material, 0, armorType);
|
||||
this.setUnlocalizedName(name);
|
||||
@@ -43,6 +50,18 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor{
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item), "Energy", maxEnergy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(){
|
||||
|
||||
@@ -90,68 +109,75 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor{
|
||||
}
|
||||
}
|
||||
|
||||
//#####################################################################################
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
return 1D - (double)ItemNBTHelper.getInteger(stack, "Energy", 0) / (double)maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return getEnergyStored(stack) < maxEnergy;
|
||||
}
|
||||
|
||||
protected double getAbsorptionPercent() {
|
||||
switch (armorType) {
|
||||
case 0:
|
||||
return 0.15D;
|
||||
case 1:
|
||||
return 0.40D;
|
||||
case 2:
|
||||
return 0.30D;
|
||||
case 3:
|
||||
return 0.15D;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ISpecialArmor */
|
||||
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
switch(slot){
|
||||
case 0:
|
||||
return ArmorPropertiesHandler.wyvernBoots(player, armor, source);
|
||||
case 1:
|
||||
return ArmorPropertiesHandler.wyvernLeggs(player, armor, source);
|
||||
case 2:
|
||||
return ArmorPropertiesHandler.wyvernChest(player, armor, source);
|
||||
case 3:
|
||||
return ArmorPropertiesHandler.wyvernHelm(player, armor, source);
|
||||
default:
|
||||
LogHelper.error("[Draconic Armor] Invalid slot");
|
||||
return new ArmorProperties(0, 0, 0);
|
||||
|
||||
}
|
||||
int maxAbsorption = 25 * getEnergyStored(armor) / energyPerDamage;
|
||||
if (source.damageType.equals(DamageSource.fall.damageType) && armor.getItem() == ModItems.wyvernBoots) return new ArmorProperties(0, 0.8D, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getAbsorptionPercent()*totalAbsorption)/4, maxAbsorption);
|
||||
return new ArmorProperties(0, getAbsorptionPercent()*totalAbsorption, maxAbsorption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
switch(slot){
|
||||
case 0:
|
||||
return 3;
|
||||
case 1:
|
||||
return 6;
|
||||
case 2:
|
||||
return 8;
|
||||
case 3:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return (int)(getAbsorptionPercent() * 20D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
|
||||
extractEnergy(stack, damage * energyPerDamage, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
if(stack != null && stack.getItem() == ModItems.wyvernLeggs) {
|
||||
if (player.isSprinting())
|
||||
player.addPotionEffect(new PotionEffect(1, 10, 1, true));
|
||||
else
|
||||
player.addPotionEffect(new PotionEffect(1, 10, 0, true));
|
||||
}
|
||||
if(stack != null && stack.getItem() == ModItems.wyvernBoots) {
|
||||
if (player.isSprinting())
|
||||
player.addPotionEffect(new PotionEffect(8, 10, 1, true));
|
||||
else
|
||||
player.addPotionEffect(new PotionEffect(8, 10, 0, true));
|
||||
}
|
||||
// if(stack != null && stack.getItem() == ModItems.wyvernLeggs) {
|
||||
// if (player.isSprinting())
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 10, 1, true));
|
||||
// else
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 10, 0, true));
|
||||
// }
|
||||
// if(stack != null && stack.getItem() == ModItems.wyvernBoots) {
|
||||
// if (player.isSprinting())
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionJumpBoost.id, 10, 1, true));
|
||||
// else
|
||||
// player.addPotionEffect(new PotionEffect(PotionHandler.potionJumpBoost.id, 10, 0, true));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
|
||||
list.add("" + EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.wyvernArmorLegend1.txt"));
|
||||
list.add("" + EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.wyvernArmorLegend2.txt"));
|
||||
InfoHelper.addEnergyAndLore(stack, list);
|
||||
}
|
||||
|
||||
public static void registerRecipe(){
|
||||
@@ -189,4 +215,42 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor{
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new EntityPersistentItem(world, location, itemstack);
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
int stored = ItemNBTHelper.getInteger(container, "Energy", 0);
|
||||
int receive = Math.min(maxReceive, Math.min(maxEnergy - stored, maxTransfer));
|
||||
|
||||
if (!simulate) {
|
||||
stored += receive;
|
||||
ItemNBTHelper.setInteger(container, "Energy", stored);
|
||||
}
|
||||
return receive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
int stored = ItemNBTHelper.getInteger(container, "Energy", 0);
|
||||
int extract = Math.min(maxExtract, stored);
|
||||
|
||||
if (!simulate) {
|
||||
stored -= extract;
|
||||
ItemNBTHelper.setInteger(container, "Energy", stored);
|
||||
}
|
||||
return extract;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
return ItemNBTHelper.getInteger(container, "Energy", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
}
|
||||
+17
-18
@@ -2,8 +2,8 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -24,10 +24,8 @@ import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -44,11 +42,16 @@ public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
|
||||
GameRegistry.registerItem(this, Strings.draconicAxeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,18 +177,14 @@ public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) {
|
||||
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
|
||||
list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.draconicAxe1.txt"));
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
} else {
|
||||
list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("info.draconicAxe2.txt"));
|
||||
list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("info.draconicAxe3.txt"));
|
||||
list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("info.draconicAxe4.txt"));
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.draconicLaw1.txt"));
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.draconicLaw2.txt"));
|
||||
}
|
||||
if (InfoHelper.holdShiftForDetails(list)){
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe2.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe3.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe4.txt"));
|
||||
InfoHelper.addLore(stack, list);
|
||||
|
||||
}else list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe1.txt"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+26
-28
@@ -2,8 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
@@ -23,18 +22,15 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -76,11 +72,16 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
GameRegistry.registerItem(this, Strings.draconicDStaffName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,17 +97,17 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
|
||||
@Override
|
||||
public boolean func_150897_b(Block block) {
|
||||
return block == Blocks.obsidian ? toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock ? true : (block.getMaterial() == Material.iron ? true : block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float func_150893_a(ItemStack stack, Block block) {
|
||||
return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) : this.efficiencyOnProperMaterial;
|
||||
return this.efficiencyOnProperMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister iconRegister) {
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_staff");
|
||||
this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_staff_active");
|
||||
this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_staff_obliterate");
|
||||
@@ -131,7 +132,7 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer player) {
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
World world = player.worldObj;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Material mat = block.getMaterial();
|
||||
@@ -145,7 +146,7 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
return ToolHandler.changeMode(stack, player, true, 4);
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers() {
|
||||
Multimap multimap = super.getItemAttributeModifiers();
|
||||
@@ -164,24 +165,21 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) {
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1;
|
||||
boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false);
|
||||
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
}
|
||||
else {
|
||||
list.add(EnumChatFormatting.GREEN + "Mining Mode: " + EnumChatFormatting.BLUE + size + "x" + size);
|
||||
list.add(EnumChatFormatting.GREEN + "Shift Right-click to change minning mode");
|
||||
list.add(StatCollector.translateToLocal("msg.oblit" + oblit + ".txt"));
|
||||
list.add(EnumChatFormatting.GREEN + "Right-click to toggle Obliteration mode");
|
||||
list.add(EnumChatFormatting.GREEN + "Obliteration mode destroys low value blocks");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "After great pains you have managed");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "to master the Draconic powers!");
|
||||
if (InfoHelper.holdShiftForDetails(list)){
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt"));
|
||||
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -2,8 +2,8 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -26,8 +26,6 @@ import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
@@ -47,11 +45,16 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
|
||||
GameRegistry.registerItem(this, Strings.draconicHoeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,10 +164,7 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) {
|
||||
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.draconicLaw1.txt"));
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.draconicLaw2.txt"));
|
||||
InfoHelper.addEnergyAndLore(stack, list);
|
||||
}
|
||||
|
||||
public static void registerRecipe() {
|
||||
|
||||
+20
-25
@@ -2,8 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
@@ -25,11 +24,9 @@ import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,11 +45,16 @@ public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem
|
||||
GameRegistry.registerItem(this, Strings.draconicPickaxeName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,29 +122,22 @@ public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem
|
||||
return ToolHandler.changeMode(stack, player, true, 3);
|
||||
}
|
||||
|
||||
public static int getMode(final ItemStack tool)
|
||||
{
|
||||
return tool.getItemDamage();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short)0) * 2) + 1;
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1;
|
||||
boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false);
|
||||
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
}else {
|
||||
list.add(EnumChatFormatting.GREEN + "Mining Mode: " + EnumChatFormatting.BLUE + size + "x" + size);
|
||||
list.add(EnumChatFormatting.GREEN + "Shift Right-click to change minning mode");
|
||||
list.add(StatCollector.translateToLocal("msg.oblit" + oblit + ".txt"));
|
||||
list.add(EnumChatFormatting.GREEN + "Right-click to toggle Obliteration mode");
|
||||
list.add(EnumChatFormatting.GREEN + "Obliteration mode destroys low value blocks");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Further Draconic research has allowed");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "you to unlock even better methods");
|
||||
if (InfoHelper.holdShiftForDetails(list)){
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt"));
|
||||
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-19
@@ -2,8 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
@@ -25,11 +24,9 @@ import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,11 +45,16 @@ public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
|
||||
GameRegistry.registerItem(this, Strings.draconicShovelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,20 +131,18 @@ public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short)0) * 2) + 1;
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1;
|
||||
boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false);
|
||||
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
}else {
|
||||
list.add(EnumChatFormatting.GREEN + "Mining Mode: " + EnumChatFormatting.BLUE + size + "x" + size);
|
||||
list.add(EnumChatFormatting.GREEN + "Shift Right-click to change minning mode");
|
||||
list.add(StatCollector.translateToLocal("msg.oblit" + oblit + ".txt"));
|
||||
list.add(EnumChatFormatting.GREEN + "Right-click to toggle Obliteration mode");
|
||||
list.add(EnumChatFormatting.GREEN + "Obliteration mode destroys low value blocks");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Further Draconic research has allowed");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "you to unlock even better methods");
|
||||
if (InfoHelper.holdShiftForDetails(list)){
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt"));
|
||||
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
|
||||
public class Reader extends ItemDE
|
||||
{
|
||||
public Reader() {
|
||||
this.setUnlocalizedName(Strings.readerName);
|
||||
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
|
||||
this.setMaxStackSize(1);
|
||||
GameRegistry.registerItem(this, Strings.readerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + Strings.readerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
return itemIcon;//(new ItemStack(Items.apple)).getIconIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
|
||||
{
|
||||
ItemStack selectedItem = getSelectedItem(player.worldObj, player, 1);
|
||||
if (selectedItem != null)
|
||||
return selectedItem.getIconIndex();
|
||||
else
|
||||
return itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
player.displayGUIBook(new ItemStack(Items.writable_book));
|
||||
if (!world.isRemote && player.isSneaking())
|
||||
{
|
||||
//FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_READER, world, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}else if (!player.isSneaking()){
|
||||
//System.out.println((getSelectedItem(world, player, 1).useItemRightClick(world, player)));
|
||||
}
|
||||
|
||||
/*
|
||||
ItemStack book = new ItemStack(ModItems.teleporterMKII);
|
||||
book.useItemRightClick(par2World, par3EntityPlayer);
|
||||
*/
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
|
||||
public ItemStack getSelectedItem(World world, EntityPlayer player, int item) {
|
||||
|
||||
ItemStack reader = player != null? player.getCurrentEquippedItem(): null;
|
||||
ItemStack selectedItem = null;
|
||||
|
||||
if(reader != null && reader.getItem() instanceof Reader) {
|
||||
NBTTagCompound inventoryTagCompound = reader.hasTagCompound() ? reader.stackTagCompound: new NBTTagCompound();
|
||||
NBTTagList inventoryTagList = inventoryTagCompound.getTagList("Inventory", 10);
|
||||
|
||||
if (inventoryTagList != null) {
|
||||
for (int i = 0; i < inventoryTagList.tagCount(); i++) {
|
||||
NBTTagCompound itemTagCompound = inventoryTagList.getCompoundTagAt(i);
|
||||
byte byte0 = itemTagCompound.getByte("Slot");
|
||||
if (byte0 == item) {
|
||||
selectedItem = ItemStack.loadItemStackFromNBT(itemTagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
return selectedItem;
|
||||
}
|
||||
}
|
||||
|
||||
return selectedItem;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -13,8 +14,8 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
@@ -130,6 +131,6 @@ public class SafetyMatch extends ItemDE {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
|
||||
list.add(""+EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.ITALIC+"Light a fire that will NOT burn your house down!");
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.safetyMatch.txt"));
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -54,7 +54,7 @@ public class TeleporterMKI extends ItemDE
|
||||
double x = ItemNBTHelper.getDouble(stack, "X", 0);
|
||||
double y = ItemNBTHelper.getDouble(stack, "Y", 0);
|
||||
double z = ItemNBTHelper.getDouble(stack, "Z", 0);
|
||||
int dim = ItemNBTHelper.getIntager(stack, "Dimension", 0);
|
||||
int dim = ItemNBTHelper.getInteger(stack, "Dimension", 0);
|
||||
|
||||
if (!(entity instanceof EntityPlayer) && !(entity instanceof IBossDisplayData))
|
||||
{
|
||||
@@ -95,7 +95,7 @@ public class TeleporterMKI extends ItemDE
|
||||
double z = ItemNBTHelper.getDouble(stack, "Z", 0);
|
||||
float yaw = ItemNBTHelper.getFloat(stack, "Yaw", 0);
|
||||
float pitch = ItemNBTHelper.getFloat(stack, "Pitch", 0);
|
||||
int dim = ItemNBTHelper.getIntager(stack, "Dimension", 0);
|
||||
int dim = ItemNBTHelper.getInteger(stack, "Dimension", 0);
|
||||
boolean onStand = !(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof TeleporterMKI);
|
||||
|
||||
if (player.isSneaking())
|
||||
@@ -107,7 +107,7 @@ public class TeleporterMKI extends ItemDE
|
||||
ItemNBTHelper.setDouble(stack, "Z", player.posZ);
|
||||
ItemNBTHelper.setFloat(stack, "Yaw", player.rotationYaw);
|
||||
ItemNBTHelper.setFloat(stack, "Pitch", player.rotationPitch);
|
||||
ItemNBTHelper.setIntager(stack, "Dimension", player.dimension);
|
||||
ItemNBTHelper.setInteger(stack, "Dimension", player.dimension);
|
||||
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() + "}"));
|
||||
@@ -151,7 +151,7 @@ public class TeleporterMKI extends ItemDE
|
||||
} else
|
||||
{
|
||||
list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("info.teleporterInfSet1.txt"));
|
||||
list.add(EnumChatFormatting.WHITE + "{x:" + (int) ItemNBTHelper.getDouble(stack, "X", 0) + " y:" + (int) ItemNBTHelper.getDouble(stack, "Y", 0) + " z:" + (int) ItemNBTHelper.getDouble(stack, "Z", 0) + " Dim:" + WorldProvider.getProviderForDimension(ItemNBTHelper.getIntager(stack, "Dimension", 0)).getDimensionName() + "}");
|
||||
list.add(EnumChatFormatting.WHITE + "{x:" + (int) ItemNBTHelper.getDouble(stack, "X", 0) + " y:" + (int) ItemNBTHelper.getDouble(stack, "Y", 0) + " z:" + (int) ItemNBTHelper.getDouble(stack, "Z", 0) + " Dim:" + WorldProvider.getProviderForDimension(ItemNBTHelper.getInteger(stack, "Dimension", 0)).getDimensionName() + "}");
|
||||
list.add(EnumChatFormatting.BLUE + String.valueOf(stack.getMaxDamage() - stack.getItemDamage() + 1) + " " + StatCollector.translateToLocal("info.teleporterInfSet2.txt"));
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -53,8 +53,8 @@ public class TeleporterMKII extends ItemDE
|
||||
{
|
||||
World world = player.worldObj;
|
||||
short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0);
|
||||
int selrctionOffset = ItemNBTHelper.getIntager(teleporter, "SelectionOffset", 0);
|
||||
int fuel = ItemNBTHelper.getIntager(teleporter, "Fuel", 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();
|
||||
@@ -72,7 +72,7 @@ public class TeleporterMKII extends ItemDE
|
||||
if (entity instanceof EntityPlayer){
|
||||
if (entity.isSneaking()){
|
||||
destination.sendEntityToCoords((EntityPlayer) entity);
|
||||
if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setIntager(teleporter, "Fuel", fuel - 1);
|
||||
if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1);
|
||||
}else{
|
||||
if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterPlayerConsent.txt"));
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class TeleporterMKII extends ItemDE
|
||||
|
||||
if (entity instanceof EntityLivingBase){
|
||||
destination.sendEntityToCoords((EntityLivingBase) entity);
|
||||
if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setIntager(teleporter, "Fuel", fuel - 1);
|
||||
if (!player.capabilities.isCreativeMode && fuel > 0) ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -91,8 +91,8 @@ public class TeleporterMKII extends ItemDE
|
||||
public ItemStack onItemRightClick(final ItemStack teleporter, final World world, final EntityPlayer player)
|
||||
{
|
||||
short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0);
|
||||
int selrctionOffset = ItemNBTHelper.getIntager(teleporter, "SelectionOffset", 0);
|
||||
int fuel = ItemNBTHelper.getIntager(teleporter, "Fuel", 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();
|
||||
@@ -127,7 +127,7 @@ public class TeleporterMKII extends ItemDE
|
||||
return teleporter;
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode && fuel > 0 && !onStand) ItemNBTHelper.setIntager(teleporter, "Fuel", fuel - 1);
|
||||
if (!player.capabilities.isCreativeMode && fuel > 0 && !onStand) ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1);
|
||||
|
||||
destination.sendEntityToCoords(player);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class TeleporterMKII extends ItemDE
|
||||
public void addInformation(final ItemStack teleporter, final EntityPlayer player, final List list2, final boolean extraInformation)
|
||||
{
|
||||
short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0);
|
||||
int selrctionOffset = ItemNBTHelper.getIntager(teleporter, "SelectionOffset", 0);
|
||||
int selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0);
|
||||
NBTTagCompound compound = teleporter.getTagCompound();
|
||||
if(compound == null) compound = new NBTTagCompound();
|
||||
NBTTagList list = (NBTTagList)compound.getTag("Locations");
|
||||
@@ -153,7 +153,7 @@ public class TeleporterMKII extends ItemDE
|
||||
list2.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
}
|
||||
else {
|
||||
list2.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + ItemNBTHelper.getIntager(teleporter, "Fuel", 0));
|
||||
list2.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + ItemNBTHelper.getInteger(teleporter, "Fuel", 0));
|
||||
list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.teleporterInfGUI.txt"));
|
||||
list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.teleporterInfScroll.txt"));
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class TeleporterMKII extends ItemDE
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack teleporter) {
|
||||
short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0);
|
||||
int selrctionOffset = ItemNBTHelper.getIntager(teleporter, "SelectionOffset", 0);
|
||||
int selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0);
|
||||
NBTTagCompound compound = teleporter.getTagCompound();
|
||||
if(compound == null) compound = new NBTTagCompound();
|
||||
NBTTagList list = (NBTTagList)compound.getTag("Locations");
|
||||
|
||||
+58
-3
@@ -9,6 +9,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.boss.EntityDragonPart;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -195,6 +196,36 @@ public class ToolHandler {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(player), 100F * dmg);
|
||||
}
|
||||
}
|
||||
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
EntityLivingBase entityLivingBase = (EntityLivingBase)entity;
|
||||
double d1 = player.posX - entityLivingBase.posX;
|
||||
double d0;
|
||||
|
||||
for (d0 = player.posZ - entityLivingBase.posZ; d1 * d1 + d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D)
|
||||
{
|
||||
d1 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
entityLivingBase.attackedAtYaw = (float)(Math.atan2(d0, d1) * 180.0D / Math.PI) - entityLivingBase.rotationYaw;
|
||||
|
||||
if (entityLivingBase.worldObj.rand.nextDouble() >= entityLivingBase.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue())
|
||||
{
|
||||
entityLivingBase.isAirBorne = true;
|
||||
float f1 = MathHelper.sqrt_double(d1 * d1 + d0 * d0);
|
||||
float f2 = 0.4F + EnchantmentHelper.getKnockbackModifier(player, entityLivingBase) * 0.4F;
|
||||
entityLivingBase.motionX /= 2.0D;
|
||||
entityLivingBase.motionY /= 2.0D;
|
||||
entityLivingBase.motionZ /= 2.0D;
|
||||
entityLivingBase.motionX -= d1 / (double)f1 * (double)f2;
|
||||
entityLivingBase.motionY += (double)f2;
|
||||
entityLivingBase.motionZ -= d0 / (double)f1 * (double)f2;
|
||||
|
||||
if (entityLivingBase.motionY > 0.4000000059604645D)
|
||||
{
|
||||
entityLivingBase.motionY = 0.4000000059604645D;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unused"})
|
||||
@@ -205,16 +236,40 @@ public class ToolHandler {
|
||||
World world = player.worldObj;
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range).expand(1.0D, 1.0D, 1.0D);
|
||||
List list = world.getEntitiesWithinAABBExcludingEntity(player, box);
|
||||
for (Object o : list) {
|
||||
for (Object entityObject : list) {
|
||||
if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK, false);
|
||||
}
|
||||
if (((Entity) o) instanceof EntityLivingBase)
|
||||
((Entity) o).attackEntityFrom(DamageSource.causePlayerDamage(player), dmg + sharp);
|
||||
if (entityObject instanceof EntityLivingBase) {
|
||||
((Entity) entityObject).attackEntityFrom(DamageSource.causePlayerDamage(player), dmg + sharp);
|
||||
|
||||
EntityLivingBase entityLivingBase = (EntityLivingBase) entityObject;
|
||||
double d1 = player.posX - entityLivingBase.posX;
|
||||
double d0;
|
||||
|
||||
for (d0 = player.posZ - entityLivingBase.posZ; d1 * d1 + d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) {
|
||||
d1 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
|
||||
if (entityLivingBase.worldObj.rand.nextDouble() >= entityLivingBase.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) {
|
||||
entityLivingBase.isAirBorne = true;
|
||||
float f1 = MathHelper.sqrt_double(d1 * d1 + d0 * d0);
|
||||
float f2 = 0.4F + EnchantmentHelper.getKnockbackModifier(player, entityLivingBase) * 0.4F;
|
||||
entityLivingBase.motionX /= 2.0D;
|
||||
entityLivingBase.motionY /= 2.0D;
|
||||
entityLivingBase.motionZ /= 2.0D;
|
||||
entityLivingBase.motionX -= d1 / (double) f1 * (double) f2;
|
||||
entityLivingBase.motionY += (double) f2;
|
||||
entityLivingBase.motionZ -= d0 / (double) f1 * (double) f2;
|
||||
|
||||
if (entityLivingBase.motionY > 0.4000000059604645D) {
|
||||
entityLivingBase.motionY = 0.4000000059604645D;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+16
-21
@@ -2,8 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
@@ -26,10 +25,9 @@ import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -47,11 +45,16 @@ public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
|
||||
GameRegistry.registerItem(this, Strings.wyvernPickaxeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,27 +117,19 @@ public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
|
||||
return ToolHandler.changeMode(stack, player, false, 1);
|
||||
}
|
||||
|
||||
public static int getMode(final ItemStack tool)
|
||||
{
|
||||
return tool.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short)0) * 2) + 1;
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1;
|
||||
if (InfoHelper.holdShiftForDetails(list)){
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
|
||||
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
} else {
|
||||
list.add(EnumChatFormatting.GREEN + "Mining Mode: " + EnumChatFormatting.BLUE + size + "x" + size);
|
||||
list.add(EnumChatFormatting.GREEN + "Shift Right-click to change mode");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Weary of plain tools you begin to understand");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "ways to use Draconic energy to upgrade");
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt"));
|
||||
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-21
@@ -2,8 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
@@ -26,10 +25,9 @@ import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -47,11 +45,16 @@ public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
|
||||
GameRegistry.registerItem(this, Strings.wyvernShovelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,26 +117,18 @@ public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
|
||||
return ToolHandler.changeMode(stack, player, false, 1);
|
||||
}
|
||||
|
||||
public static int getMode(final ItemStack tool)
|
||||
{
|
||||
return tool.getItemDamage();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short)0) * 2) + 1;
|
||||
int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1;
|
||||
if (InfoHelper.holdShiftForDetails(list)){
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
|
||||
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
|
||||
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
} else {
|
||||
list.add(EnumChatFormatting.GREEN + "Mining Mode: " + EnumChatFormatting.BLUE + size + "x" + size);
|
||||
list.add(EnumChatFormatting.GREEN + "Shift Right-click to change mode");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Weary of plain tools you begin to understand");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "ways to use Draconic energy to upgrade");
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt"));
|
||||
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-7
@@ -1,6 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.items.weapons;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
@@ -18,7 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -41,6 +41,11 @@ public class DraconicBow extends ItemBow
|
||||
GameRegistry.registerItem(this, Strings.draconicBowName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(){
|
||||
|
||||
@@ -197,12 +202,11 @@ public class DraconicBow extends ItemBow
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + StatCollector.translateToLocal("msg.bowmode" + ItemNBTHelper.getString(stack, "mode", "rapidfire") + ".txt"));
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "After being imbued with the heart of a dragon the bow pulses");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "with a great power and roars to be unleashed");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.BLUE + "" + EnumChatFormatting.ITALIC + "Enchants are twice as effective on this bow");
|
||||
if (InfoHelper.holdShiftForDetails(list)) {
|
||||
list.add(StatCollector.translateToLocal("msg.bowmode" + ItemNBTHelper.getString(stack, "mode", "rapidfire") + ".txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.bowEnchants.txt"));
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerRecipe()
|
||||
|
||||
+15
-9
@@ -2,8 +2,8 @@ package com.brandon3055.draconicevolution.common.items.weapons;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
@@ -39,11 +39,16 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
|
||||
GameRegistry.registerItem(this, Strings.draconicSwordName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,10 +81,11 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
list.add(EnumChatFormatting.DARK_RED + "Your enemy's strength will be their undoing");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Further Draconic research has allowed");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "you to unlock even better methods");
|
||||
if (InfoHelper.holdShiftForDetails(list)) {
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.sword.txt"));
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
-7
@@ -1,6 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.items.weapons;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
@@ -18,7 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -40,6 +40,11 @@ public class WyvernBow extends ItemBow {
|
||||
GameRegistry.registerItem(this, Strings.wyvernBowName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(){
|
||||
|
||||
@@ -164,12 +169,11 @@ public class WyvernBow extends ItemBow {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + StatCollector.translateToLocal("msg.bowmode" + ItemNBTHelper.getString(stack, "mode", "rapidfire") + ".txt"));
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "You have learned how to use draconic power to upgrade");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "your bow, what benefits does it have?");
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.BLUE + "" + EnumChatFormatting.ITALIC + "Enchants are twice as effective on this bow");
|
||||
if (InfoHelper.holdShiftForDetails(list)) {
|
||||
list.add(StatCollector.translateToLocal("msg.bowmode" + ItemNBTHelper.getString(stack, "mode", "rapidfire") + ".txt"));
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.bowEnchants.txt"));
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerRecipe()
|
||||
|
||||
+18
-10
@@ -2,8 +2,8 @@ package com.brandon3055.draconicevolution.common.items.weapons;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
@@ -42,11 +42,18 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
|
||||
GameRegistry.registerItem(this, Strings.wyvernSwordName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack p_77616_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
|
||||
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0));
|
||||
list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,10 +87,11 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
|
||||
{
|
||||
list.add(EnumChatFormatting.DARK_RED + "Your enemy's strength will be their undoing");
|
||||
ItemInfoHelper.energyDisplayInfo(stack, list);
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Weary of plain tools you begin to understand");
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "ways to use Draconic energy to upgrade");
|
||||
if (InfoHelper.holdShiftForDetails(list)) {
|
||||
InfoHelper.addEnergyInfo(stack, list);
|
||||
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.sword.txt"));
|
||||
InfoHelper.addLore(stack, list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.brandon3055.draconicevolution.common.magic;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 17/11/2014.
|
||||
*/
|
||||
public class EnchantmentReaper extends Enchantment {
|
||||
public EnchantmentReaper(int id) {
|
||||
super(id, 2, EnumEnchantmentType.weapon);
|
||||
setName("draconicevolution.reaperEnchant");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLevel() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinEnchantability(int level) {
|
||||
return 1 + 10 * (level - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnchantability(int level) {
|
||||
return super.getMinEnchantability(level) + 50;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.brandon3055.draconicevolution.common.magic;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 10/11/2014.
|
||||
*/
|
||||
public class PotionHandler {
|
||||
|
||||
|
||||
public static void init(){
|
||||
|
||||
}
|
||||
|
||||
public static class PotionBase extends Potion {
|
||||
|
||||
public PotionBase(int id, boolean isBad, int colour)
|
||||
{
|
||||
super(id, isBad, colour);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInvText(PotionEffect effect) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) {
|
||||
// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.effect.txt"), x+7, y+6, 0xffffff);
|
||||
// if (effect.getPotionID() == potionFlight.id)
|
||||
// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.flight.txt"), x+7, y+17, 0x00ff00);
|
||||
// else if (effect.getPotionID() == potionUpHillStep.id)
|
||||
// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.highStep.txt"), x+7, y+17, 0x00ff00);
|
||||
// else if (effect.getPotionID() == potionSpeed.id)
|
||||
// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.swiftness.txt"), x+7, y+17, 0x00ff00);
|
||||
// else if (effect.getPotionID() == potionFireResist.id)
|
||||
// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.fireImmune.txt"), x+7, y+17, 0x00ff00);
|
||||
// else if (effect.getPotionID() == potionJumpBoost.id)
|
||||
// mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.jumpBoost.txt"), x+7, y+17, 0x00ff00);
|
||||
// if (effect.getAmplifier() > 0)mc.fontRenderer.drawString("lvl: "+(effect.getAmplifier()+1), x+86, y+12, 0xff0000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+2
-3
@@ -1,4 +1,4 @@
|
||||
package com.brandon3055.draconicevolution.common;
|
||||
package com.brandon3055.draconicevolution.common.plugins.nei;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
@@ -7,8 +7,6 @@ import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.plugins.nei.CraftingChestOverlayHandler;
|
||||
import com.brandon3055.draconicevolution.common.plugins.nei.CraftingChestStackPositioner;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
@@ -26,6 +24,7 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI {
|
||||
API.hideItem(new ItemStack(ModBlocks.safetyFlame));
|
||||
API.hideItem(new ItemStack(ModItems.tclogo));
|
||||
API.hideItem(new ItemStack(ModItems.creativeStructureSpawner));
|
||||
API.hideItem(new ItemStack(ModItems.creativeStructureSpawner, 1, 1));
|
||||
LogHelper.info("Added NEI integration");
|
||||
}
|
||||
|
||||
+12
-12
@@ -97,20 +97,20 @@ public class TileCKeyStone extends TileEntity {
|
||||
}
|
||||
|
||||
private boolean setKey(ItemStack key){
|
||||
if (keyCode == 0 && ItemNBTHelper.getIntager(key, "KeyCode", 0) == 0){
|
||||
if (keyCode == 0 && ItemNBTHelper.getInteger(key, "KeyCode", 0) == 0){
|
||||
keyCode = worldObj.rand.nextInt();
|
||||
ItemNBTHelper.setIntager(key, "KeyCode", keyCode);
|
||||
ItemNBTHelper.setIntager(key, "X", xCoord);
|
||||
ItemNBTHelper.setIntager(key, "Y", yCoord);
|
||||
ItemNBTHelper.setIntager(key, "Z", zCoord);
|
||||
ItemNBTHelper.setInteger(key, "KeyCode", keyCode);
|
||||
ItemNBTHelper.setInteger(key, "X", xCoord);
|
||||
ItemNBTHelper.setInteger(key, "Y", yCoord);
|
||||
ItemNBTHelper.setInteger(key, "Z", zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return true;
|
||||
}else if (keyCode == 0 && ItemNBTHelper.getIntager(key, "KeyCode", 0) != 0){
|
||||
keyCode = ItemNBTHelper.getIntager(key, "KeyCode", 0);
|
||||
ItemNBTHelper.setIntager(key, "LockCount", ItemNBTHelper.getIntager(key, "LockCount", 0) + 1);
|
||||
ItemNBTHelper.setIntager(key, "X_"+ItemNBTHelper.getIntager(key, "LockCount", 0), xCoord);
|
||||
ItemNBTHelper.setIntager(key, "Y_"+ItemNBTHelper.getIntager(key, "LockCount", 0), yCoord);
|
||||
ItemNBTHelper.setIntager(key, "Z_"+ItemNBTHelper.getIntager(key, "LockCount", 0), zCoord);
|
||||
}else if (keyCode == 0 && ItemNBTHelper.getInteger(key, "KeyCode", 0) != 0){
|
||||
keyCode = ItemNBTHelper.getInteger(key, "KeyCode", 0);
|
||||
ItemNBTHelper.setInteger(key, "LockCount", ItemNBTHelper.getInteger(key, "LockCount", 0) + 1);
|
||||
ItemNBTHelper.setInteger(key, "X_" + ItemNBTHelper.getInteger(key, "LockCount", 0), xCoord);
|
||||
ItemNBTHelper.setInteger(key, "Y_" + ItemNBTHelper.getInteger(key, "LockCount", 0), yCoord);
|
||||
ItemNBTHelper.setInteger(key, "Z_" + ItemNBTHelper.getInteger(key, "LockCount", 0), zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return true;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class TileCKeyStone extends TileEntity {
|
||||
}
|
||||
|
||||
private boolean isKeyValid(ItemStack key, EntityPlayer player){
|
||||
if (ItemNBTHelper.getIntager(key, "KeyCode", 0) != keyCode) {
|
||||
if (ItemNBTHelper.getInteger(key, "KeyCode", 0) != keyCode) {
|
||||
if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.wrongKey.txt"));
|
||||
return false;
|
||||
}
|
||||
|
||||
+6
-7
@@ -1,7 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -47,8 +46,8 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory {
|
||||
}else {
|
||||
if (items[1].getItem() != Items.book || EnchantmentHelper.getEnchantments(items[0]).size() == 0) flag = false;
|
||||
}
|
||||
if (items[0] != null) dissenchantCost = ItemNBTHelper.getIntager(items[0], "RepairCost", 0);
|
||||
//if (flag) dissenchantCost = ItemNBTHelper.getIntager(items[0], "RepairCost", 0);
|
||||
if (items[0] != null) dissenchantCost = ItemNBTHelper.getInteger(items[0], "RepairCost", 0);
|
||||
//if (flag) dissenchantCost = ItemNBTHelper.getInteger(items[0], "RepairCost", 0);
|
||||
//else dissenchantCost = 0;
|
||||
isValidRecipe = flag;
|
||||
|
||||
@@ -116,16 +115,16 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory {
|
||||
if (list.tagCount() > 0) input.setTagInfo(tagName, list);
|
||||
if (input.getItem() == Items.enchanted_book && list.tagCount() == 0) setInventorySlotContents(0, null);
|
||||
if (!player.capabilities.isCreativeMode) player.addExperienceLevel(-dissenchantCost);
|
||||
if (items[0] != null && ItemNBTHelper.getIntager(items[0], "RepairCost", 0) > 0)ItemNBTHelper.setIntager(items[0], "RepairCost", ItemNBTHelper.getIntager(items[0], "RepairCost", 0) - Math.min(2, ItemNBTHelper.getIntager(items[0], "RepairCost", 0)));
|
||||
if (items[0] != null && ItemNBTHelper.getInteger(items[0], "RepairCost", 0) > 0)ItemNBTHelper.setInteger(items[0], "RepairCost", ItemNBTHelper.getInteger(items[0], "RepairCost", 0) - Math.min(2, ItemNBTHelper.getInteger(items[0], "RepairCost", 0)));
|
||||
if (!player.capabilities.isCreativeMode) decrStackSize(1, 1);
|
||||
int maxDamage = items[0].getMaxDamage();
|
||||
float damageF = (40f - bookPower)/100f;
|
||||
int damage = (int)(damageF*(float)maxDamage);
|
||||
int damageResult = items[0].getItemDamage() + damage;
|
||||
LogHelper.info(damage);
|
||||
if (!player.capabilities.isCreativeMode && damageResult > maxDamage) {
|
||||
|
||||
if (!player.capabilities.isCreativeMode && damageResult > maxDamage && maxDamage > 0) {
|
||||
setInventorySlotContents(0, null);
|
||||
}else if (!player.capabilities.isCreativeMode){
|
||||
}else if (!player.capabilities.isCreativeMode && maxDamage > 0){
|
||||
items[0].setItemDamage(damageResult);
|
||||
}
|
||||
onInventoryChanged();
|
||||
|
||||
+18
-8
@@ -5,6 +5,7 @@ import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.ICustomItemData;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.InventoryUtils;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
|
||||
@@ -18,6 +19,7 @@ import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
@@ -25,7 +27,7 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Brandon on 27/06/2014.
|
||||
*/
|
||||
public class TileDraconiumChest extends TileEntity implements IInventory, IEnergyHandler {
|
||||
public class TileDraconiumChest extends TileEntity implements IInventory, IEnergyHandler, ICustomItemData {
|
||||
ItemStack[] items = new ItemStack[240];
|
||||
ItemStack[] itemsCrafting = new ItemStack[10];
|
||||
private int ticksSinceSync = -1;
|
||||
@@ -37,6 +39,7 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg
|
||||
public int green = 0;
|
||||
public int blue = 150;
|
||||
public boolean editMode = false;
|
||||
private String customName;
|
||||
public EnergyStorage energy = new EnergyStorage(1000000, 10000, 0);
|
||||
|
||||
/**
|
||||
@@ -361,12 +364,16 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return ""; //todo custom name
|
||||
return hasCustomInventoryName() ? customName : StatCollector.translateToLocal(ModBlocks.draconiumChest.getUnlocalizedName() + ".name");
|
||||
}
|
||||
|
||||
public void setCustomName(String s){
|
||||
customName = s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
return customName != null && customName.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -429,6 +436,7 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg
|
||||
compound.setInteger("Blue", blue);
|
||||
compound.setBoolean("Edit", editMode);
|
||||
compound.setByte("AutoFeed", (byte) smeltingAutoFeed);
|
||||
if (customName != null && customName.length() > 0)compound.setString("CustomName", customName);
|
||||
energy.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@@ -453,10 +461,12 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg
|
||||
blue = compound.getInteger("Blue");
|
||||
editMode = compound.getBoolean("Edit");
|
||||
smeltingAutoFeed = compound.getByte("AutoFeed");
|
||||
customName = compound.getString("CustomName");
|
||||
energy.readFromNBT(compound);
|
||||
}
|
||||
|
||||
public void writeToItem(NBTTagCompound compound){
|
||||
@Override
|
||||
public void writeDataToItem(NBTTagCompound compound, ItemStack stack) {
|
||||
NBTTagCompound[] tag = new NBTTagCompound[items.length];
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
@@ -479,16 +489,18 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg
|
||||
compound.setTag("CraftingItem" + i, tag[i]);
|
||||
}
|
||||
|
||||
compound.setByte("facing", (byte) facing);
|
||||
compound.setInteger("Red", red);
|
||||
compound.setInteger("Green", green);
|
||||
compound.setInteger("Blue", blue);
|
||||
compound.setBoolean("Edit", editMode);
|
||||
compound.setByte("AutoFeed", (byte) smeltingAutoFeed);
|
||||
if (hasCustomInventoryName()) stack.setStackDisplayName(customName);
|
||||
LogHelper.info(stack.getDisplayName());
|
||||
energy.writeToNBT(compound);
|
||||
}
|
||||
|
||||
public void readFromItem(NBTTagCompound compound) {
|
||||
@Override
|
||||
public void readDataFromItem(NBTTagCompound compound, ItemStack stack) {
|
||||
NBTTagCompound[] tag = new NBTTagCompound[items.length];
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
@@ -501,7 +513,6 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg
|
||||
itemsCrafting[i] = ItemStack.loadItemStackFromNBT(tag[i]);
|
||||
}
|
||||
|
||||
facing = compound.getByte("facing");
|
||||
red = compound.getInteger("Red");
|
||||
green = compound.getInteger("Green");
|
||||
blue = compound.getInteger("Blue");
|
||||
@@ -510,7 +521,6 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg
|
||||
energy.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return this.energy.receiveEnergy(maxReceive, simulate);
|
||||
|
||||
+49
-45
@@ -1,11 +1,11 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergy;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergy;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -15,7 +15,6 @@ 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.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -23,76 +22,70 @@ import java.util.Random;
|
||||
/**
|
||||
* Created by Brandon on 27/06/2014.
|
||||
*/
|
||||
public class TileEnergyInfuser extends TileEntity implements IEnergyHandler, ISidedInventory {
|
||||
public class TileEnergyInfuser extends TileObjectSync implements IEnergyHandler, ISidedInventory {
|
||||
ItemStack[] items = new ItemStack[1];
|
||||
public EnergyStorage energy = new EnergyStorage(1000000);
|
||||
public int maxInput = 81920;
|
||||
public boolean running = false;
|
||||
public boolean runningCach = false;
|
||||
private int tick = 0;
|
||||
private int longTick = 0;
|
||||
public float rotation = 0;
|
||||
public boolean transfer = false;
|
||||
public boolean transferCach = false;
|
||||
|
||||
//==============================================LOGIC=======================================================//
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
tick();
|
||||
if (worldObj.isRemote)
|
||||
if (worldObj.isRemote && running) {
|
||||
rotation += 0.5F;
|
||||
if (rotation > 360F) rotation = 0;
|
||||
spawnParticles();
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
}
|
||||
|
||||
if (tick % 100 == 0) tryStartOrStop();
|
||||
if (tick % 400 == 0) detectAndSendChanges(true);
|
||||
|
||||
|
||||
if(running && tryStartOrStop())
|
||||
{
|
||||
IEnergyContainerItem item = (IEnergyContainerItem)items[0].getItem();
|
||||
if (energy.extractEnergy(item.receiveEnergy(items[0], energy.getEnergyStored(), false), false) > 0 && !transfer)
|
||||
setTransfer(true);
|
||||
else if (energy.extractEnergy(item.receiveEnergy(items[0], energy.getEnergyStored(), false), false) <= 0 && transfer)
|
||||
setTransfer(false);
|
||||
// if (energy.extractEnergy(item.receiveEnergy(items[0], energy.getEnergyStored(), false), false) > 0 && !transfer)
|
||||
// setTransfer(true);
|
||||
// else if (energy.extractEnergy(item.receiveEnergy(items[0], energy.getEnergyStored(), false), false) <= 0 && transfer)
|
||||
setTransfer(energy.extractEnergy(item.receiveEnergy(items[0], energy.getEnergyStored(), false), false) > 0);
|
||||
}
|
||||
|
||||
detectAndSendChanges(false);
|
||||
tick++;
|
||||
}
|
||||
|
||||
private boolean tryStartOrStop(){
|
||||
if (items[0] != null && items[0].stackSize == 1 && EnergyHelper.isEnergyContainerItem(items[0])) {
|
||||
if (items[0] != null && items[0].stackSize == 1 && items[0] != null && items[0].getItem() instanceof IEnergyContainerItem) {
|
||||
IEnergyContainerItem item = (IEnergyContainerItem)items[0].getItem();
|
||||
if (item.getEnergyStored(items[0]) < item.getMaxEnergyStored(items[0]))
|
||||
if (item.getEnergyStored(items[0]) < item.getMaxEnergyStored(items[0])) {
|
||||
|
||||
running = true;
|
||||
else{
|
||||
if (running) worldObj.markBlockForUpdate(xCoord, yCoord ,zCoord);
|
||||
//worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
|
||||
}else{
|
||||
|
||||
running = false;
|
||||
//worldObj.markBlockForUpdate(xCoord, yCoord ,zCoord);
|
||||
|
||||
}
|
||||
}else {
|
||||
if (running) worldObj.markBlockForUpdate(xCoord, yCoord ,zCoord);
|
||||
|
||||
running = false;
|
||||
//worldObj.markBlockForUpdate(xCoord, yCoord ,zCoord);
|
||||
}
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
private void tick()
|
||||
{
|
||||
if (tick >= 20) {
|
||||
tick = 0;
|
||||
if (running)
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
else
|
||||
tick++;
|
||||
if (longTick >= 100) {
|
||||
longTick = 0;
|
||||
tryStartOrStop();
|
||||
}else
|
||||
longTick++;
|
||||
if(rotation >= 360F)
|
||||
rotation = 0F;
|
||||
else if (running)
|
||||
rotation += 0.5F;
|
||||
|
||||
}
|
||||
|
||||
private void setTransfer(boolean t){
|
||||
transfer = t;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnParticles(){
|
||||
@@ -151,14 +144,12 @@ public class TileEnergyInfuser extends TileEntity implements IEnergyHandler, ISi
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
if (tick == 0)
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return this.energy.receiveEnergy(Math.min(maxInput, maxReceive), simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {;
|
||||
return this.energy.extractEnergy(maxExtract, simulate);
|
||||
return this.energy.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -190,6 +181,19 @@ public class TileEnergyInfuser extends TileEntity implements IEnergyHandler, ISi
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
public void detectAndSendChanges(boolean sendAnyway){
|
||||
if (runningCach != running || sendAnyway) runningCach = (Boolean)sendObject(ObjectPacket.BOOLEAN, 0, running);
|
||||
if (transferCach != transfer || sendAnyway) transferCach = (Boolean)sendObject(ObjectPacket.BOOLEAN, 1, transfer);
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveObject(int index, Object object) {
|
||||
if (index == 0) running = (Boolean)object;
|
||||
if (index == 1) transfer = (Boolean)object;
|
||||
}
|
||||
|
||||
//==============================================INVENTORY====================================================//
|
||||
|
||||
@Override
|
||||
@@ -237,7 +241,7 @@ public class TileEnergyInfuser extends TileEntity implements IEnergyHandler, ISi
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "InventoryWeatherController";
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,7 +267,7 @@ public class TileEnergyInfuser extends TileEntity implements IEnergyHandler, ISi
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return EnergyHelper.isEnergyContainerItem(itemstack);
|
||||
return itemstack != null && itemstack.getItem() instanceof IEnergyContainerItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+30
-6
@@ -1,8 +1,11 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -17,17 +20,20 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileGenerator extends TileEntity implements ISidedInventory, IEnergyHandler {
|
||||
public class TileGenerator extends TileObjectSync implements ISidedInventory, IEnergyHandler {
|
||||
//########### variables #############//
|
||||
private ItemStack[] items;
|
||||
public int burnTime = 1;
|
||||
public int burnTimeRemaining = 0;
|
||||
private int burnSpeed = 6;
|
||||
public boolean isBurning = false;
|
||||
public boolean isBurningCach = false;
|
||||
private int tick;
|
||||
/**
|
||||
* Energy per burn tick
|
||||
*/
|
||||
private int EPBT = 14;
|
||||
protected EnergyStorage storage = new EnergyStorage(100000, 0, 1000);
|
||||
public EnergyStorage storage = new EnergyStorage(100000, 0, 1000);
|
||||
|
||||
//##################################//
|
||||
|
||||
@@ -37,6 +43,10 @@ public class TileGenerator extends TileEntity implements ISidedInventory, IEnerg
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.isRemote) return;
|
||||
|
||||
isBurning = burnTimeRemaining > 0 && storage.getEnergyStored() < storage.getMaxEnergyStored();
|
||||
|
||||
if (burnTimeRemaining > 0 && storage.getEnergyStored() < storage.getMaxEnergyStored()) {
|
||||
burnTimeRemaining -= burnSpeed;
|
||||
storage.setEnergyStored(storage.getEnergyStored() + Math.min(burnSpeed * EPBT, storage.getMaxEnergyStored() - storage.getEnergyStored()));
|
||||
@@ -50,8 +60,12 @@ public class TileGenerator extends TileEntity implements ISidedInventory, IEnerg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
detectAndSentChanges(tick % 500 == 0);
|
||||
tick++;
|
||||
}
|
||||
|
||||
|
||||
public void tryRefuel() {
|
||||
if (burnTimeRemaining > 0 || storage.getEnergyStored() >= storage.getMaxEnergyStored()) return;
|
||||
if (items[0] != null && items[0].stackSize > 0) {
|
||||
@@ -227,6 +241,19 @@ public class TileGenerator extends TileEntity implements ISidedInventory, IEnerg
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
private void detectAndSentChanges(boolean sendAnyway){
|
||||
if (isBurning != isBurningCach || sendAnyway) isBurningCach = (Boolean)sendObject(ObjectPacket.BOOLEAN, 0, isBurning);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveObject(int index, Object object) {
|
||||
if (isBurning != (Boolean) object){
|
||||
isBurning = (Boolean) object;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
@@ -237,7 +264,6 @@ public class TileGenerator extends TileEntity implements ISidedInventory, IEnerg
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/* IEnergyHandler */
|
||||
@@ -248,13 +274,11 @@ public class TileGenerator extends TileEntity implements ISidedInventory, IEnerg
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
|
||||
+37
-22
@@ -1,9 +1,12 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import com.brandon3055.draconicevolution.common.core.utills.EnergyStorage;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
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.block.material.Material;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
@@ -18,14 +21,13 @@ 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.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyHandler {
|
||||
public class TileGrinder extends TileObjectSync implements ISidedInventory, IEnergyHandler {
|
||||
//########### variables #############//
|
||||
public int meta = -1;
|
||||
List<EntityLiving> killList;
|
||||
@@ -38,14 +40,16 @@ public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyH
|
||||
public int burnTime = 1;
|
||||
public int burnTimeRemaining = 0;
|
||||
public boolean disabled = false;
|
||||
private boolean disabledCach = false;
|
||||
public boolean hasPower = false;
|
||||
public boolean hasPowerCach = false;
|
||||
private boolean readyNext = false;
|
||||
protected EnergyStorage internalGenBuffer = new EnergyStorage(20000, 32000, 0);
|
||||
protected EnergyStorage externalInputBuffer = new EnergyStorage(100000, 32000, 0);
|
||||
public EnergyStorage internalGenBuffer = new EnergyStorage(20000, 32000, 0);
|
||||
public EnergyStorage externalInputBuffer = new EnergyStorage(100000, 32000, 0);
|
||||
public int energyPerKill = 1000;
|
||||
|
||||
public void updateVariables() {
|
||||
if (meta == -1) meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
//if (fakePlayer == null) fakePlayer = new DEFakePlayer((WorldServer)worldObj, new GameProfile(UUID.randomUUID(), "DEGrinderFakePlayer"));
|
||||
if (centreY == -1) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
@@ -70,6 +74,7 @@ public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyH
|
||||
break;
|
||||
}
|
||||
}
|
||||
hasPower = getActiveBuffer().getEnergyStored() >= energyPerKill;
|
||||
}
|
||||
//##################################//
|
||||
|
||||
@@ -79,6 +84,8 @@ public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyH
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.isRemote) return;
|
||||
|
||||
updateVariables();
|
||||
int burnSpeed = 2;
|
||||
int EPBT = 10;
|
||||
@@ -88,28 +95,18 @@ public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyH
|
||||
internalGenBuffer.setEnergyStored(internalGenBuffer.getEnergyStored() + Math.min(burnSpeed * EPBT, internalGenBuffer.getMaxEnergyStored() - internalGenBuffer.getEnergyStored()));
|
||||
} else if (burnTimeRemaining <= 0) tryRefuel();
|
||||
|
||||
// if ((internalGenBuffer.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) {
|
||||
// internalGenBuffer.extractEnergy(((IEnergyHandler) tile).receiveEnergy(ForgeDirection.getOrientation(i).getOpposite(), internalGenBuffer.extractEnergy(internalGenBuffer.getMaxExtract(), true), false), false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!worldObj.isRemote && readyNext && !disabled && getActiveBuffer().getEnergyStored() >= energyPerKill) {
|
||||
if (readyNext && !disabled && getActiveBuffer().getEnergyStored() >= energyPerKill) {
|
||||
if (killNextEntity()) {
|
||||
getActiveBuffer().modifyEnergyStored(-energyPerKill);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if (tick >= 100) {
|
||||
tick = 0;
|
||||
checkSignal();
|
||||
if (tick % 100 == 0) {
|
||||
//checkSignal();
|
||||
readyNext = true;
|
||||
if (burnTimeRemaining > 0) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
} else tick++;
|
||||
}
|
||||
detectAndSendChanges(tick % 500 == 0);
|
||||
tick++;
|
||||
}
|
||||
|
||||
public EnergyStorage getActiveBuffer(){
|
||||
@@ -337,6 +334,24 @@ public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyH
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveObject(int index, Object object) {
|
||||
if (index == 0 && disabled != (Boolean) object) {
|
||||
disabled = (Boolean) object;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
else if (hasPower != (Boolean) object){
|
||||
hasPower = (Boolean) object;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
private void detectAndSendChanges(boolean sendAnyway){
|
||||
if (disabledCach != disabled || sendAnyway) disabledCach = (Boolean)sendObject(ObjectPacket.BOOLEAN, 0, disabled);
|
||||
if (hasPowerCach != hasPower || sendAnyway) hasPowerCach = (Boolean)sendObject(ObjectPacket.BOOLEAN, 1, hasPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
@@ -347,7 +362,6 @@ public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyH
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/* IEnergyHandler */
|
||||
@@ -381,4 +395,5 @@ public class TileGrinder extends TileEntity implements ISidedInventory, IEnergyH
|
||||
public EnergyStorage getInternalBuffer(){
|
||||
return internalGenBuffer;
|
||||
}
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.core.network.ObjectPacket;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 14/11/2014.
|
||||
*/
|
||||
public abstract class TileObjectSync extends TileEntity {
|
||||
|
||||
public Object sendObject(byte dataType, int index, Object object){
|
||||
return sendObject(dataType, index, object, new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
|
||||
}
|
||||
|
||||
public Object sendObject(byte dataType, int index, Object object, TargetPoint point){
|
||||
DraconicEvolution.network.sendToAllAround(new ObjectPacket(this, dataType, index, object), point);
|
||||
return object;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract void receiveObject(int index, Object object);
|
||||
}
|
||||
+3
-3
@@ -1,10 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -13,9 +12,10 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TileParticleGenerator extends TileEntity {
|
||||
public int red = 0;
|
||||
public int green = 0;
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory
|
||||
{
|
||||
public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory {
|
||||
public String[] names = new String[42];
|
||||
private ItemStack[] items;
|
||||
public boolean whiteList = false;
|
||||
|
||||
+2
-9
@@ -12,8 +12,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
|
||||
public class TileWeatherController extends TileEntity implements IInventory
|
||||
{
|
||||
public class TileWeatherController extends TileEntity implements IInventory {
|
||||
int tick = 0;
|
||||
boolean running = false;
|
||||
public boolean lastTickInput = false;
|
||||
@@ -149,9 +148,6 @@ public class TileWeatherController extends TileEntity implements IInventory
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
if (debug)
|
||||
System.out.println("[DEBUG]TileWeatherController: getDescriptionPacket");
|
||||
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
this.writeToNBT(tagCompound);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound);
|
||||
@@ -160,9 +156,6 @@ public class TileWeatherController extends TileEntity implements IInventory
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
|
||||
{
|
||||
if (debug)
|
||||
System.out.println("[DEBUG]TileWeatherController: onDataPacket");
|
||||
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@@ -225,7 +218,7 @@ public class TileWeatherController extends TileEntity implements IInventory
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "InventoryWeatherController";
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user