mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-27 23:45:59 +00:00
Just another commit
This commit is contained in:
1 parent
96be94c7b4
commit
baaea7d9e0
138 files changed
+3587
-2448
No files matched your search
@@ -17,7 +17,11 @@ 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;" +
|
||||
"required-after:BrandonsCore@[1.0.0.1,);")
|
||||
public class DraconicEvolution {
|
||||
|
||||
@Mod.Instance(References.MODID)
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnerg
|
||||
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileReactorCore;
|
||||
import com.brandon3055.draconicevolution.common.utills.UpdateChecker;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
@@ -138,6 +139,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
//ISimpleBlockRendering
|
||||
RenderingRegistry.registerBlockHandler(new RenderTeleporterStand());
|
||||
RenderingRegistry.registerBlockHandler(new RenderPortal());
|
||||
|
||||
//TileEntitySpecialRenderers
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileParticleGenerator.class, new RenderTileParticleGen());
|
||||
@@ -153,6 +155,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyRelay.class, new RenderTileCrystal());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyTransceiver.class, new RenderTileCrystal());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWirelessEnergyTransceiver.class, new RenderTileCrystal());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore());
|
||||
|
||||
//Entitys
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new RenderDragon());
|
||||
@@ -161,11 +164,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
public void registerRenderIDs (){
|
||||
References.idTeleporterStand = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDedicatedServer() {
|
||||
return false;
|
||||
References.idPortal = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,22 +227,9 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(Object particle) {
|
||||
if (particle instanceof EntityFX) ParticleHandler.spawnCustomParticle((EntityFX)particle);
|
||||
public void spawnParticle(Object particle, int range) {
|
||||
if (particle instanceof EntityFX && ((EntityFX)particle).worldObj.isRemote) ParticleHandler.spawnCustomParticle((EntityFX)particle, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpaceDown() {
|
||||
return Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShiftDown() {
|
||||
return Minecraft.getMinecraft().gameSettings.keyBindSneak.getIsKeyPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCtrlDown() {
|
||||
return Minecraft.getMinecraft().gameSettings.keyBindSprint.getIsKeyPressed();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client.creativetab;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChes
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import com.brandon3055.draconicevolution.common.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.client.gui;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser;
|
||||
import com.brandon3055.draconicevolution.common.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client.gui;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerGenerator;
|
||||
import com.brandon3055.draconicevolution.common.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client.gui;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerGrinder;
|
||||
import com.brandon3055.draconicevolution.common.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
+5
-5
@@ -754,15 +754,15 @@ public class GUIParticleGenerator extends GuiScreen {
|
||||
packetValue = (short) beam_blue;
|
||||
break;
|
||||
case 103: //beam pitch +
|
||||
beam_pitch = (beam_pitch + value_F) > 360F ? 360F : beam_pitch + value_F;
|
||||
beam_pitch = (beam_pitch + value_F) > 180F ? 180F : beam_pitch + value_F;
|
||||
packetValue = (short) (beam_pitch * 100F);
|
||||
break;
|
||||
case 104: //beam yaw +
|
||||
beam_yaw = (beam_yaw + value_F) > 360F ? 360F : beam_yaw + value_F;
|
||||
beam_yaw = (beam_yaw + value_F) > 180F ? 180F : beam_yaw + value_F;
|
||||
packetValue = (short) (beam_yaw * 100F);
|
||||
break;
|
||||
case 105: //beam length +
|
||||
beam_length = (beam_length + value_F) > 30F ? 30F : beam_length + value_F;
|
||||
beam_length = (beam_length + value_F) > 320F ? 320F : beam_length + value_F;
|
||||
packetValue = (short) (beam_length * 100F);
|
||||
break;
|
||||
case 106: //beam rotation +
|
||||
@@ -786,11 +786,11 @@ public class GUIParticleGenerator extends GuiScreen {
|
||||
packetValue = (short) beam_blue;
|
||||
break;
|
||||
case 111: //beam pitch -
|
||||
beam_pitch = (beam_pitch - value_F) < -0F ? -0F : beam_pitch - value_F;
|
||||
beam_pitch = (beam_pitch - value_F) < -180F ? -180F : beam_pitch - value_F;
|
||||
packetValue = (short) (beam_pitch * 100F);
|
||||
break;
|
||||
case 112: //beam yaw -
|
||||
beam_yaw = (beam_yaw - value_F) < -0F ? -0F : beam_yaw - value_F;
|
||||
beam_yaw = (beam_yaw - value_F) < -180F ? -180F : beam_yaw - value_F;
|
||||
packetValue = (short) (beam_yaw * 100F);
|
||||
break;
|
||||
case 113: //beam length -
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.container.DummyContainer;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.DataUtills;
|
||||
import com.brandon3055.draconicevolution.common.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation;
|
||||
import com.brandon3055.draconicevolution.common.utills.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.client.gui.manual;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow;
|
||||
import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow;
|
||||
import com.brandon3055.draconicevolution.common.network.MountUpdatePacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
package com.brandon3055.draconicevolution.client.render.block;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 25/5/2015.
|
||||
*/
|
||||
public class RenderPortal implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
tess.setColorRGBA(0, 0, 0, 256);
|
||||
switch (meta){
|
||||
case 1:
|
||||
tess.addVertexWithUV(x-0.01, y-0.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y-0.01, z+0.75, 0, 0);
|
||||
|
||||
tess.addVertexWithUV(x+1.01, y-0.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+1.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+1.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y-0.01, z+0.25, 0, 0);
|
||||
|
||||
if (isFrame(world, x+1, y, z)){
|
||||
tess.addVertexWithUV(x+0.99, y-0.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y-0.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+1.01, z+0.25, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x-1, y, z)){
|
||||
tess.addVertexWithUV(x+0.01, y+1.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y-0.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y-0.01, z+0.25, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x, y-1, z)){
|
||||
tess.addVertexWithUV(x-0.01, y+0.01,z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.01,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.01,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.01,z+0.25, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x, y+1, z)){
|
||||
tess.addVertexWithUV(x+1.01, y+0.99,z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.99,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.99,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.99,z+0.25, 0, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z-0.01, 0, 0);
|
||||
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z-0.01, 0, 0);
|
||||
|
||||
if (isFrame(world, x, y, z+1)){
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z+0.99, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x, y, z-1)){
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z+0.01, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x, y-1, z)){
|
||||
tess.addVertexWithUV(x+0.25, y+0.01, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+0.01, z-0.01, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x, y+1, z)){
|
||||
tess.addVertexWithUV(x+0.75, y+0.99, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+0.99, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+0.99, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+0.99, z-0.01, 0, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z-0.01, 0, 0);
|
||||
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z-0.01, 0, 0);
|
||||
|
||||
if (isFrame(world, x, y, z+1)){
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z+0.99, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x, y, z-1)){
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z+0.01, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x+1, y, z)){
|
||||
tess.addVertexWithUV(x+0.99, y+0.25, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+0.75, z-0.01, 0, 0);
|
||||
}
|
||||
if (isFrame(world, x-1, y, z)){
|
||||
tess.addVertexWithUV(x+0.01, y+0.75, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+0.25, z-0.01, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return References.idPortal;
|
||||
}
|
||||
|
||||
private boolean isFrame(IBlockAccess access, int x, int y, int z){
|
||||
Block block = access.getBlock(x, y, z);
|
||||
return block == ModBlocks.infusedObsidian || block == ModBlocks.dislocatorReceptacle;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class RenderTeleporterStand implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.client.render.item;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.brandon3055.draconicevolution.client.render.particle;
|
||||
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.brandon3055.draconicevolution.client.render.particle;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -543,6 +545,96 @@ public final class Particles {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class PortalParticle extends EntityFX
|
||||
{
|
||||
public double targetX;
|
||||
public double targetY;
|
||||
public double targetZ;
|
||||
public double startX;
|
||||
public double startY;
|
||||
public double startZ;
|
||||
public float baseScale;
|
||||
|
||||
public PortalParticle(World world, double x, double y, double z, double tx, double ty, double tz) {
|
||||
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
this.startX = x;
|
||||
this.startY = y;
|
||||
this.startZ = z;
|
||||
this.targetX = tx;
|
||||
this.targetY = ty;
|
||||
this.targetZ = tz;
|
||||
float speed = 0.12F + (rand.nextFloat() * 0.2F);
|
||||
this.motionX = (targetX - startX) * speed;
|
||||
this.motionY = (targetY - startY) * speed;
|
||||
this.motionZ = (targetZ - startZ) * speed;
|
||||
this.particleMaxAge = 100;
|
||||
this.noClip = true;
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0f;
|
||||
float baseSize = 0.05F + ((float) RenderManager.instance.livingPlayer.getDistance(x, y, z)) * 0.007F;
|
||||
if (RenderManager.instance.livingPlayer != null) this.baseScale = baseSize + (rand.nextFloat() * (baseSize * 2F));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
//super.onUpdate();
|
||||
if (particleAge >= particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead();
|
||||
|
||||
double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ);
|
||||
double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ);
|
||||
particleScale = ((float) (d2 / d1)) * baseScale;
|
||||
|
||||
particleAge ++;
|
||||
prevPosX = posX;
|
||||
prevPosY = posY;
|
||||
prevPosZ = posZ;
|
||||
moveEntity(motionX, motionY, motionZ);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y
|
||||
|
||||
tesselator.draw();
|
||||
ResourceHandler.bindParticles();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.setBrightness(200);
|
||||
|
||||
int uIndex = 6;
|
||||
int vIndex = 0;
|
||||
|
||||
float minU = uIndex * 0.125F;
|
||||
float maxU = (uIndex+1) * 0.125F;
|
||||
float minV = vIndex * 0.125F;
|
||||
float maxV = (vIndex+1) * 0.125F;
|
||||
|
||||
float drawScale = 0.1F * this.particleScale;
|
||||
|
||||
if (this.particleIcon != null) {
|
||||
minU = this.particleIcon.getMinU();
|
||||
maxU = this.particleIcon.getMaxU();
|
||||
minV = this.particleIcon.getMinV();
|
||||
maxV = this.particleIcon.getMaxV();
|
||||
}
|
||||
|
||||
float drawX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX);
|
||||
float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY);
|
||||
float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ);
|
||||
|
||||
tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
|
||||
|
||||
tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV);
|
||||
tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV);
|
||||
tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV);
|
||||
tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV);
|
||||
|
||||
tesselator.draw();
|
||||
ResourceHandler.bindDefaultParticles();
|
||||
tesselator.startDrawingQuads();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//int uIndex = 0;
|
||||
//int vIndex = 0;
|
||||
|
||||
+1
-8
@@ -20,12 +20,10 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {//to
|
||||
private static final ResourceLocation iner_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png");
|
||||
private static final ResourceLocation outer_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png");
|
||||
private IModelCustom iner_model;
|
||||
private IModelCustom outer_model;
|
||||
|
||||
public RenderTileEnergyStorageCore()
|
||||
{
|
||||
iner_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj"));
|
||||
//outer_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_2.obj"));
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
|
||||
@@ -67,15 +65,10 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {//to
|
||||
GL11.glTranslated(x+0.5, y+0.5, z+0.5);
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture);
|
||||
|
||||
|
||||
//float colour = (float)(Minecraft.getSystemTime()%10000) / 10000f;
|
||||
//double colour = Math.sin((float)Minecraft.getSystemTime() / 10000f);
|
||||
double colour = ((TileEnergyStorageCore) tile).getEnergyStored() / ((TileEnergyStorageCore) tile).getMaxEnergyStored();
|
||||
float brightness = (float)Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f);
|
||||
|
||||
colour = 1f - colour;
|
||||
//LogHelper.info(colour + " " + ((TileEnergyStorageCore) tile).getEnergyStored() +" "+ ((TileEnergyStorageCore) tile).getMaxEnergyStored());
|
||||
//GL11.glColor4d(1F, 0.3F, 0.7f, 1F);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
|
||||
@@ -109,7 +102,7 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {//to
|
||||
iner_model.renderAll();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.brandon3055.draconicevolution.client.render.tile;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileReactorCore;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 16/6/2015.
|
||||
*/
|
||||
public class RenderTileReactorCore extends TileEntitySpecialRenderer {
|
||||
private IModelCustom reactorModel;
|
||||
|
||||
public RenderTileReactorCore(){
|
||||
reactorModel = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
|
||||
TileReactorCore tile = (TileReactorCore) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
|
||||
|
||||
renderReactorCore(tile, partialTick);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
public void renderReactorCore(TileReactorCore tile, float partialTick) {
|
||||
float rotation = tile.renderRotation + (partialTick * 0.2F);
|
||||
double ff = 1;
|
||||
double r = ff < 0.5 ? 1 - (ff*2) : 0;
|
||||
double g = ff > 0.5 ? (ff-0.5)*2 : 0;
|
||||
double b = ff * 2;
|
||||
double a = ff < 0.1 ? (ff * 10) + 0.5 : 1;
|
||||
|
||||
|
||||
|
||||
ResourceHandler.bindResource("textures/models/reactorCore.png");
|
||||
GL11.glScaled(2F, 2F, 2F);
|
||||
GL11.glRotatef(rotation, 0.5F, 1F, 0.5F);
|
||||
reactorModel.renderAll();
|
||||
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
|
||||
|
||||
ResourceHandler.bindResource("textures/models/reactorShieldPlate.png");
|
||||
|
||||
|
||||
GL11.glColor4d(r, g, b, a);
|
||||
GL11.glScaled(1.03F, 1.03F, 1.03F);
|
||||
GL11.glRotatef(2343, 0.5F, 1F, 0.5F);
|
||||
GL11.glRotatef(-rotation*2, 0.5F, 1F, 0.5F);
|
||||
reactorModel.renderAll();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -5,8 +5,8 @@ import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
@@ -20,10 +20,7 @@ import com.brandon3055.draconicevolution.common.tileentities.*;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.*;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -34,7 +31,6 @@ 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.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -144,6 +140,9 @@ public class CommonProxy {
|
||||
GameRegistry.registerTileEntity(TileEnergyRelay.class, References.RESOURCESPREFIX + "TileEnergyRelay");
|
||||
GameRegistry.registerTileEntity(TileEnergyTransceiver.class, References.RESOURCESPREFIX + "TileEnergyTransceiver");
|
||||
GameRegistry.registerTileEntity(TileWirelessEnergyTransceiver.class, References.RESOURCESPREFIX + "TileWirelessEnergyTransceiver");
|
||||
GameRegistry.registerTileEntity(TileDislocatorReceptacle.class, References.RESOURCESPREFIX + "TileDislocatorReceptacle");
|
||||
GameRegistry.registerTileEntity(TilePortalBlock.class, References.RESOURCESPREFIX + "TilePortalBlock");
|
||||
GameRegistry.registerTileEntity(TileReactorCore.class, References.RESOURCESPREFIX + "TileReactorCore");
|
||||
if (DraconicEvolution.debug) {
|
||||
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
|
||||
GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate");
|
||||
@@ -174,12 +173,6 @@ public class CommonProxy {
|
||||
EntityRegistry.registerModEntity(EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true);
|
||||
}
|
||||
|
||||
public boolean isDedicatedServer() {return true;}
|
||||
|
||||
public MinecraftServer getMCServer(){
|
||||
return FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
}
|
||||
|
||||
public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType)
|
||||
{
|
||||
return null;
|
||||
@@ -189,36 +182,12 @@ public class CommonProxy {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOp(String paramString)
|
||||
{
|
||||
MinecraftServer localMinecraftServer = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
paramString = paramString.trim();
|
||||
for (String str : localMinecraftServer.getConfigurationManager().func_152606_n()) {
|
||||
if (paramString.equalsIgnoreCase(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void spawnParticle(Object particle)
|
||||
|
||||
public void spawnParticle(Object particle, int range)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isSpaceDown()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isCtrlDown()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isShiftDown()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,9 +3,7 @@ package com.brandon3055.draconicevolution.common;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.blocks.*;
|
||||
import com.brandon3055.draconicevolution.common.blocks.machine.*;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyPylon;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyStorageCore;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.InvisibleMultiblock;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.*;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -42,6 +40,10 @@ public class ModBlocks {
|
||||
public static BlockDE draconiumChest;
|
||||
public static BlockDE draconicBlock;
|
||||
public static BlockDE energyCrystal;
|
||||
public static BlockDE infusedObsidian;
|
||||
public static BlockDE dislocatorReceptacle;
|
||||
public static BlockDE portal;
|
||||
public static BlockDE reactorCore;
|
||||
public static Block safetyFlame;
|
||||
|
||||
public static ItemStack resurrectionStone;
|
||||
@@ -73,6 +75,10 @@ public class ModBlocks {
|
||||
draconiumChest = new DraconiumChest();
|
||||
draconicBlock = new DraconicBlock();
|
||||
energyCrystal = new EnergyCrystal();
|
||||
infusedObsidian = new InfusedObsidian();
|
||||
dislocatorReceptacle = new DislocatorReceptacle();
|
||||
portal = new Portal();
|
||||
reactorCore = new ReactorCore();
|
||||
|
||||
longRangeDislocator = new LongRangeDislocator();
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.achievements;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utills.InventoryUtils;
|
||||
import com.brandon3055.brandonscore.common.utills.InventoryUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.brandon3055.draconicevolution.common.blocks;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.itemblocks.CKeyStoneItemBlock;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
@@ -99,7 +99,7 @@ public class CKeyStone extends BlockDE {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
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);
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -170,7 +170,7 @@ public class DraconiumChest extends BlockCustomDrop {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return References.idDraconiumChest;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
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.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 19/5/2015.
|
||||
*/
|
||||
public class InfusedObsidian extends BlockDE {
|
||||
|
||||
public InfusedObsidian(){
|
||||
super(Material.rock);
|
||||
this.setHardness(100.0F);
|
||||
this.setResistance(4000.0F);
|
||||
this.setBlockName("infusedObsidian");
|
||||
this.setHarvestLevel("pickaxe", 4);
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
|
||||
ModBlocks.register(this, InfusedObsidianItemBlock.class);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/infusedObsidian");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class InfusedObsidianItemBlock extends ItemBlock {
|
||||
|
||||
public InfusedObsidianItemBlock(Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
|
||||
list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("info.infusedObsidian.txt"));
|
||||
super.addInformation(p_77624_1_, p_77624_2_, list, p_77624_4_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
|
||||
import com.brandon3055.draconicevolution.common.utills.Teleporter;
|
||||
import com.brandon3055.brandonscore.common.utills.Teleporter;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.energynet.*;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -207,7 +207,7 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock
|
||||
IRemoteEnergyHandler tile = world.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler ? (IRemoteEnergyHandler) world.getTileEntity(x, y, z) : null;
|
||||
if (tile != null)
|
||||
{
|
||||
list.add(InfoHelper.HITC()+getLocalizedName());
|
||||
list.add(InfoHelper.HITC()+StatCollector.translateToLocal(this.getUnlocalizedName() + world.getBlockMetadata(x, y, z) + ".name"));
|
||||
list.add("RF: " + tile.getEnergyStored(ForgeDirection.DOWN));
|
||||
list.add("Cap: " + tile.getCapacity() + "%");
|
||||
if (tile instanceof TileEnergyTransceiver) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class SunDial extends BlockDE {
|
||||
public IIcon icon_front;
|
||||
public IIcon icon_front_active;
|
||||
public IIcon icon_side;
|
||||
public boolean blockState = true;
|
||||
//public boolean blockState = true;
|
||||
|
||||
public SunDial() {
|
||||
this.setBlockName(Strings.blockSunDialName);
|
||||
@@ -62,6 +62,7 @@ public class SunDial extends BlockDE {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.multiblock;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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 java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 19/5/2015.
|
||||
*/
|
||||
public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntityProvider {
|
||||
IIcon textureInactive;
|
||||
|
||||
public DislocatorReceptacle(){
|
||||
super(Material.rock);
|
||||
this.setHardness(50.0F);
|
||||
this.setResistance(2000.0F);
|
||||
this.setBlockName("dislocatorReceptacle");
|
||||
this.setHarvestLevel("pickaxe", 3);
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
textureInactive = iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_inactive");
|
||||
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_active");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) {
|
||||
TileDislocatorReceptacle tile = access.getTileEntity(x, y, z) instanceof TileDislocatorReceptacle ? (TileDislocatorReceptacle)access.getTileEntity(x, y, z) : null;
|
||||
if (tile != null) return tile.isActive ? blockIcon : textureInactive;
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z);
|
||||
if (tile != null) tile.updateState();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int p_149691_1_, int meta) {
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileDislocatorReceptacle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
|
||||
if (world.isRemote) return true;
|
||||
TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z);
|
||||
if (tile == null) return false;
|
||||
|
||||
if (tile.getStackInSlot(0) != null){
|
||||
if (player.getHeldItem() == null){
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.getStackInSlot(0));
|
||||
tile.setInventorySlotContents(0, null);
|
||||
}else {
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, tile.getStackInSlot(0)));
|
||||
tile.setInventorySlotContents(0, null);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
world.notifyBlockChange(x, y, z, this);
|
||||
|
||||
}else {
|
||||
ItemStack stack = player.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof TeleporterMKI && ((TeleporterMKI)stack.getItem()).getLocation(stack) != null){
|
||||
tile.setInventorySlotContents(0, player.getHeldItem());
|
||||
player.destroyCurrentEquippedItem();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) {
|
||||
TileDislocatorReceptacle tile = (TileDislocatorReceptacle)world.getTileEntity(x, y, z);
|
||||
return tile == null ? 0 : tile.getStackInSlot(0) != null ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -7,9 +7,9 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.multiblock;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 23/5/2015.
|
||||
*/
|
||||
public class Portal extends BlockDE implements ITileEntityProvider{
|
||||
|
||||
public Portal(){
|
||||
super(Material.portal);
|
||||
this.setBlockUnbreakable();
|
||||
this.setBlockName("portal");
|
||||
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return References.idPortal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) {
|
||||
return AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TilePortalBlock();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
if (world.isRemote) return;
|
||||
if (getMaster(world, x, y, z) == null){
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
if (getMaster(world, x, y, z).isActive) getMaster(world, x, y, z).validateActivePortal();
|
||||
if (!getMaster(world, x, y, z).isActive && !getMaster(world, x, y, z).updating) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
updateMetadata(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (world.isRemote) return;
|
||||
TileDislocatorReceptacle tile = getMaster(world, x, y, z);
|
||||
if (tile != null && tile.isActive && tile.getLocation() != null) {
|
||||
if (tile.coolDown > 0) return;
|
||||
tile.coolDown = 1;
|
||||
tile.getLocation().sendEntityToCoords(entity);
|
||||
}
|
||||
else if (tile != null) tile.validateActivePortal();
|
||||
else world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
private TileDislocatorReceptacle getMaster(World world, int x, int y, int z){
|
||||
return world.getTileEntity(x, y, z) instanceof TilePortalBlock ? ((TilePortalBlock)world.getTileEntity(x, y, z)).getMaster() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return null; }
|
||||
|
||||
private boolean isPortalOrFrame(IBlockAccess access, int x, int y, int z) {
|
||||
Block block = access.getBlock(x, y, z);
|
||||
return block == ModBlocks.portal || block == ModBlocks.infusedObsidian || block == ModBlocks.dislocatorReceptacle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
updateMetadata(world, x, y, z);
|
||||
}
|
||||
|
||||
private void updateMetadata(World world, int x, int y, int z) {
|
||||
if (world.isRemote || world.getBlockMetadata(x, y, z) != 0) return;
|
||||
int meta = 0;
|
||||
|
||||
if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z) && isPortalOrFrame(world, x + 1, y, z) && isPortalOrFrame(world, x - 1, y, z)) meta = 1;
|
||||
else if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z) && isPortalOrFrame(world, x, y, z + 1) && isPortalOrFrame(world, x, y, z - 1)) meta = 2;
|
||||
else if (isPortalOrFrame(world, x + 1, y, z) && isPortalOrFrame(world, x - 1, y, z) && isPortalOrFrame(world, x, y, z + 1) && isPortalOrFrame(world, x, y, z - 1)) meta = 3;
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.multiblock;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileReactorCore;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 16/6/2015.
|
||||
*/
|
||||
public class ReactorCore extends BlockDE {
|
||||
|
||||
public ReactorCore(){
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
this.setBlockName("reactorCore");
|
||||
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileReactorCore();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.inventory.SlotOutput;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.entity;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.blocks.DraconiumBlock;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
|
||||
import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.entity;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ExtendedPlayer implements IExtendedEntityProperties {
|
||||
* Used to register these extended properties for the player during EntityConstructing event
|
||||
* This method is for convenience only; it will make your code look nicer
|
||||
*/
|
||||
public static final void register(EntityPlayer player) {
|
||||
public static void register(EntityPlayer player) {
|
||||
player.registerExtendedProperties(ExtendedPlayer.EXT_PROP_NAME, new ExtendedPlayer(player));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ExtendedPlayer implements IExtendedEntityProperties {
|
||||
* Returns ExtendedPlayer properties for player
|
||||
* This method is for convenience only; it will make your code look nicer
|
||||
*/
|
||||
public static final ExtendedPlayer get(EntityPlayer player) {
|
||||
public static ExtendedPlayer get(EntityPlayer player) {
|
||||
return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.handler;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ShapedOreEnergyRecipe;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
@@ -74,11 +74,13 @@ public class CraftingHandler {
|
||||
|
||||
//aesthetic
|
||||
add(ModBlocks.particleGenerator, "RBR", "BCB", "RBR", 'R', Blocks.redstone_block, 'B', Items.blaze_rod, 'C', ModItems.draconicCore);
|
||||
add(ModBlocks.infusedObsidian, "BOB", "ODO", "BOB", 'B', Items.blaze_powder, 'O', Blocks.obsidian, 'D', ModItems.draconiumDust);
|
||||
|
||||
//machines
|
||||
addOre(ModBlocks.potentiometer, "ITI", "QCQ", "IRI", 'I', "ingotIron", 'T', Blocks.redstone_torch, 'Q', "gemQuartz", 'C', Items.comparator, 'R', Blocks.redstone_block);
|
||||
addOre(ModBlocks.rainSensor, " ", "RBR", "SPS", 'R', "dustRedstone", 'B', Items.bucket, 'S', Blocks.stone_slab, 'P', Blocks.heavy_weighted_pressure_plate);
|
||||
addOre(ModBlocks.teleporterStand, " P ", " S ", "HBH", 'P', Blocks.stone_pressure_plate, 'S', "stone", 'H', new ItemStack(Blocks.stone_slab, 1, 0), 'B', Items.blaze_powder);
|
||||
addOre(ModBlocks.dislocatorReceptacle, "ICI", " O ", "ISI", 'I', "ingotIron", 'C', ModItems.draconicCore, 'O', ModBlocks.infusedObsidian, 'S', ModBlocks.teleporterStand);
|
||||
|
||||
|
||||
//machines adv
|
||||
@@ -94,7 +96,7 @@ public class CraftingHandler {
|
||||
addOre(getStack(ModBlocks.generator, 1, 3), "NIN", "IFI", "NCN", 'N', Items.netherbrick, 'I', "ingotIron", 'F', Blocks.furnace, 'C', ModItems.draconicCore);
|
||||
addOre(ModBlocks.dissEnchanter, "PIP", "ETE", "CBC", 'P', Items.ender_eye, 'I', Items.enchanted_book, 'E', "gemEmerald", 'T', Blocks.enchanting_table, 'C', ModItems.draconicCore, 'B', Items.book);
|
||||
addOre(getStack(ModBlocks.energyCrystal, 4, 0), "IDI", "DCD", "IDI", 'I' , ModItems.draconiumIngot, 'D', "gemDiamond", 'C', ModItems.draconicCore);
|
||||
addOre(getStack(ModBlocks.energyCrystal, 4, 1), "CRC", "RWR", "CRC", 'R' , ModBlocks.energyCrystal, 'W', ModItems.wyvernCore, 'C', ModItems.draconicCore);
|
||||
addOre(getStack(ModBlocks.energyCrystal, 4, 1), "CRC", "RWR", "CRC", 'R' , getStack(ModBlocks.energyCrystal, 1, 0), 'W', ModItems.wyvernCore, 'C', ModItems.draconicCore);
|
||||
addShaplessOre(getStack(ModBlocks.energyCrystal, 1, 0), getStack(ModBlocks.energyCrystal, 1, 2), getStack(ModBlocks.energyCrystal, 1, 2));
|
||||
addShaplessOre(getStack(ModBlocks.energyCrystal, 2, 2), getStack(ModBlocks.energyCrystal, 1, 0));
|
||||
addShaplessOre(getStack(ModBlocks.energyCrystal, 1, 1), getStack(ModBlocks.energyCrystal, 1, 3), getStack(ModBlocks.energyCrystal, 1, 3));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.handler;
|
||||
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -96,16 +96,16 @@ public class FMLEventHandler {
|
||||
player.capabilities.allowFlying = true;
|
||||
if (ArmorEffectHandler.getFlightLock(player)) player.capabilities.isFlying = true;
|
||||
|
||||
if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && ((ArmorEffectHandler.getVAccSprint(player) && DraconicEvolution.proxy.isCtrlDown()) || (!ArmorEffectHandler.getVAccSprint(player))))
|
||||
if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && ((ArmorEffectHandler.getVAccSprint(player) && BrandonsCore.proxy.isCtrlDown()) || (!ArmorEffectHandler.getVAccSprint(player))))
|
||||
{
|
||||
float percentIncrease = ArmorEffectHandler.getVAccel(player);
|
||||
|
||||
if (DraconicEvolution.proxy.isSpaceDown() && !DraconicEvolution.proxy.isShiftDown())
|
||||
if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown())
|
||||
{
|
||||
player.motionY =(double)(percentIncrease * 2F);
|
||||
}
|
||||
|
||||
if (DraconicEvolution.proxy.isShiftDown() && !DraconicEvolution.proxy.isSpaceDown())
|
||||
if (BrandonsCore.proxy.isShiftDown() && !BrandonsCore.proxy.isSpaceDown())
|
||||
{
|
||||
player.motionY = -(double)(percentIncrease * 2F);
|
||||
}
|
||||
|
||||
+33
-2
@@ -1,6 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.handler;
|
||||
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
@@ -12,7 +13,6 @@ import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler;
|
||||
import com.brandon3055.draconicevolution.common.network.MountUpdatePacket;
|
||||
import com.brandon3055.draconicevolution.common.network.SpeedRequestPacket;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
@@ -53,6 +54,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
@@ -68,11 +70,40 @@ public class MinecraftForgeEventHandler {
|
||||
public static int ticksSinceRequest = 0;
|
||||
public static boolean speedNeedsUpdating = true;
|
||||
|
||||
private Field persistenceRequired = null;
|
||||
|
||||
public MinecraftForgeEventHandler(){
|
||||
try {
|
||||
persistenceRequired = ReflectionHelper.findField(EntityLiving.class, "field_82179_bU", "persistenceRequired");
|
||||
} catch (Exception e) {
|
||||
LogHelper.error("Unable to find field \"persistenceRequired\"");
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event)
|
||||
{
|
||||
EntityLivingBase entity = event.entityLiving;
|
||||
|
||||
if (entity.getEntityData().hasKey("SpawnedByDESpawner")){
|
||||
long spawnTime = entity.getEntityData().getLong("SpawnedByDESpawner");
|
||||
long livedFor = entity.worldObj.getTotalWorldTime() - spawnTime;
|
||||
|
||||
if (livedFor > 600 && persistenceRequired != null){
|
||||
try {
|
||||
persistenceRequired.setBoolean(entity, false);
|
||||
entity.getEntityData().removeTag("SpawnedByDESpawner");
|
||||
LogHelper.info("Tag Removed From " + entity);
|
||||
} catch (Exception e) {
|
||||
LogHelper.warn("Error occured while resetting entity persistence: " + e);
|
||||
entity.getEntityData().removeTag("SpawnedByDESpawner");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!event.entityLiving.worldObj.isRemote || !(event.entityLiving instanceof EntityPlayerSP)) return;
|
||||
EntityPlayerSP player = (EntityPlayerSP) event.entityLiving;
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
|
||||
double motionX = player.motionX;
|
||||
double motionZ = player.motionZ;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.inventory;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.brandon3055.draconicevolution.common.items;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
|
||||
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.tileentity.TileEntityMobSpawner;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -34,7 +36,18 @@ public class DraconicCore extends ItemDE {
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
|
||||
if (world.getBlock(x, y, z) == Blocks.mob_spawner)
|
||||
{
|
||||
TileEntityMobSpawner oldSpawner = world.getTileEntity(x, y, z) instanceof TileEntityMobSpawner ? (TileEntityMobSpawner)world.getTileEntity(x, y, z) : null;
|
||||
if (oldSpawner == null) return false;
|
||||
String mobName = oldSpawner.func_145881_a().getEntityNameToSpawn();
|
||||
|
||||
world.setBlock(x, y, z, ModBlocks.customSpawner);
|
||||
TileCustomSpawner newSpawner = world.getTileEntity(x, y, z) instanceof TileCustomSpawner ? (TileCustomSpawner)world.getTileEntity(x, y, z) : null;
|
||||
if (newSpawner != null) {
|
||||
newSpawner.getBaseLogic().entityName = mobName;
|
||||
newSpawner.isSetToSpawn = true;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
stack.splitStack(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.items;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.items;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -32,6 +32,29 @@ public class Tclogo extends ItemDE {
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
// if (entity instanceof EntityPlayerMP && !entity.onGround) {
|
||||
// //for (int i = 0; i < 10; i++)
|
||||
// EntityPlayer player = (EntityPlayer)entity;
|
||||
// if (player.posX < 500){
|
||||
//
|
||||
// ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(player.posX + 10, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
// player.motionX += 10;
|
||||
// if (player.posX > 128) {
|
||||
//
|
||||
// ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(501, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// else player.motionX = 0;
|
||||
|
||||
|
||||
|
||||
// ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(entity.posX + 10, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
// ((EntityPlayerMP) entity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 1000));
|
||||
// if (entity.posX > 500) ((EntityPlayerMP) entity).destroyCurrentEquippedItem();
|
||||
// }
|
||||
/*
|
||||
//if (entity.isCollidedHorizontally)// && !world.isRemote)
|
||||
//entity.setLocationAndAngles(entity.posX+30D, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);;
|
||||
/*
|
||||
@@ -74,6 +97,13 @@ public class Tclogo extends ItemDE {
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
/*if (player instanceof EntityPlayerMP) {
|
||||
for (int i = 0; i < 10; i++)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(player.posX + 1, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
|
||||
}
|
||||
|
||||
if (1==1) return stack;*/
|
||||
|
||||
//Minecraft.getMinecraft().gameSettings.mouseSensitivity = -0.34F;
|
||||
|
||||
// if (world.isRemote)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.RFItemBase;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
|
||||
+4
-3
@@ -1,13 +1,14 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -92,7 +93,7 @@ public class TeleporterMKI extends ItemDE {
|
||||
ItemNBTHelper.setFloat(stack, "Pitch", player.rotationPitch);
|
||||
ItemNBTHelper.setInteger(stack, "Dimension", player.dimension);
|
||||
ItemNBTHelper.setBoolean(stack, "IsSet", true);
|
||||
ItemNBTHelper.setString(stack, "DimentionName", DraconicEvolution.proxy.getMCServer().worldServerForDimension(player.dimension).provider.getDimensionName());
|
||||
ItemNBTHelper.setString(stack, "DimentionName", BrandonsCore.proxy.getMCServer().worldServerForDimension(player.dimension).provider.getDimensionName());
|
||||
}
|
||||
return stack;
|
||||
} else if (world.isRemote)
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MaterialLiquid;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
+3
@@ -1,6 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
|
||||
+7
-2
@@ -1,5 +1,10 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
@@ -159,11 +164,11 @@ public class ToolBase extends RFItemBase {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote && !DraconicEvolution.proxy.isDedicatedServer())
|
||||
if (!world.isRemote && !BrandonsCore.proxy.isDedicatedServer())
|
||||
{
|
||||
handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown());
|
||||
}
|
||||
else if (world.isRemote && DraconicEvolution.proxy.getMCServer() == null)
|
||||
else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null)
|
||||
{
|
||||
handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown());
|
||||
DraconicEvolution.network.sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()));
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
|
||||
+2
-2
@@ -6,9 +6,9 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -108,8 +108,6 @@ public class WyvernBow extends ItemBow implements IInventoryTool {
|
||||
{
|
||||
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
|
||||
|
||||
System.out.println("curent mode:" + currentMode);
|
||||
|
||||
if (currentMode.equals("rapidfire"))
|
||||
ItemNBTHelper.setString(stack, "mode", "sharpshooter");
|
||||
else
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -21,7 +21,7 @@ public final class References {
|
||||
|
||||
//======================Render IDs========================//
|
||||
public static int idTeleporterStand = -1;
|
||||
public static int idDraconiumChest = -1;
|
||||
public static int idPortal = -1;
|
||||
|
||||
//======================Data Types========================//
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.brandon3055.draconicevolution.common.lib;
|
||||
*/
|
||||
public class VersionHandler
|
||||
{
|
||||
public static final String VERSION = "1.0.1c";
|
||||
public static final String VERSION = "1.0.1d";
|
||||
public static final int SNAPSHOT = 0;
|
||||
public static final String MCVERSION = "1.7.10";
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.handler.MinecraftForgeEventHandler;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
@@ -39,7 +39,7 @@ public class SpeedRequestPacket implements IMessage
|
||||
public IMessage onMessage(SpeedRequestPacket message, MessageContext ctx) {
|
||||
if (ctx.side == Side.SERVER)
|
||||
{
|
||||
if (ConfigHandler.speedLimitDimList.contains(ctx.getServerHandler().playerEntity.dimension) || (DraconicEvolution.proxy.isOp(ctx.getServerHandler().playerEntity.getCommandSenderName()) && !ConfigHandler.speedLimitops)) return new SpeedRequestPacket(20F);
|
||||
if (ConfigHandler.speedLimitDimList.contains(ctx.getServerHandler().playerEntity.dimension) || (BrandonsCore.proxy.isOp(ctx.getServerHandler().playerEntity.getCommandSenderName()) && !ConfigHandler.speedLimitops)) return new SpeedRequestPacket(20F);
|
||||
LogHelper.info(ConfigHandler.speedLimitops);
|
||||
return new SpeedRequestPacket(ConfigHandler.maxPlayerSpeed);
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Teleporter.TeleportLocation;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@@ -138,7 +138,7 @@ public class TeleporterPacket implements IMessage
|
||||
|
||||
if (message.function == ADDDESTINATION){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
message.location.setDimentionName(DraconicEvolution.proxy.getMCServer().worldServerForDimension(message.location.getDimension()).provider.getDimensionName());
|
||||
message.location.setDimentionName(BrandonsCore.proxy.getMCServer().worldServerForDimension(message.location.getDimension()).provider.getDimensionName());
|
||||
message.location.writeToNBT(tag);
|
||||
list.appendTag(tag);
|
||||
compound.setTag("Locations", list);
|
||||
@@ -172,7 +172,7 @@ public class TeleporterPacket implements IMessage
|
||||
|
||||
if (message.function == UPDATEDESTINATION){
|
||||
NBTTagCompound tag = list.getCompoundTagAt(message.data);
|
||||
message.location.setDimentionName(DraconicEvolution.proxy.getMCServer().worldServerForDimension(message.location.getDimension()).provider.getDimensionName());
|
||||
message.location.setDimentionName(BrandonsCore.proxy.getMCServer().worldServerForDimension(message.location.getDimension()).provider.getDimensionName());
|
||||
message.location.writeToNBT(tag);
|
||||
list.func_150304_a(message.data, tag);
|
||||
compound.setTag("Locations", list);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDataSync;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
|
||||
import com.brandon3055.draconicevolution.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI
|
||||
API.hideItem(new ItemStack(ModItems.creativeStructureSpawner));
|
||||
API.hideItem(new ItemStack(ModItems.dezilsMarshmallow));
|
||||
API.hideItem(new ItemStack(ModItems.creativeStructureSpawner, 1, 1));
|
||||
API.hideItem(new ItemStack(ModBlocks.portal));
|
||||
LogHelper.info("Added NEI integration");
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -166,7 +166,11 @@ public abstract class CustomSpawnerBaseLogic {
|
||||
}
|
||||
} else ((EntityLiving) par1Entity).onSpawnWithEgg(null);
|
||||
|
||||
if (!requiresPlayer)((EntityLiving)par1Entity).func_110163_bv();
|
||||
if (!requiresPlayer) {
|
||||
((EntityLiving)par1Entity).func_110163_bv();
|
||||
par1Entity.getEntityData().setLong("SpawnedByDESpawner", getSpawnerWorld().getTotalWorldTime());
|
||||
}
|
||||
|
||||
this.getSpawnerWorld().spawnEntityInWorld(par1Entity);
|
||||
}
|
||||
|
||||
@@ -242,7 +246,7 @@ public abstract class CustomSpawnerBaseLogic {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Entity getEntityForRenderer() {
|
||||
if (this.renderedEntity == null) {
|
||||
Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), (World) null);
|
||||
Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), getSpawnerWorld());
|
||||
entity = this.spawnEntity(entity);
|
||||
if (entity instanceof EntitySkeleton) ((EntitySkeleton)entity).setSkeletonType(skeletonType);
|
||||
this.renderedEntity = entity;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChes
|
||||
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
|
||||
import com.brandon3055.draconicevolution.common.utills.EnergyStorage;
|
||||
import com.brandon3055.draconicevolution.common.utills.ICustomItemData;
|
||||
import com.brandon3055.draconicevolution.common.utills.InventoryUtils;
|
||||
import com.brandon3055.brandonscore.common.utills.InventoryUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
+5
@@ -277,4 +277,9 @@ public class TileParticleGenerator extends TileEntity {
|
||||
beam_length = compound.getFloat("beam_length");
|
||||
beam_rotation = compound.getFloat("beam_rotation");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 655360.0D;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBe
|
||||
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField;
|
||||
import com.brandon3055.draconicevolution.common.utills.EnergyStorage;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
|
||||
-1
@@ -157,7 +157,6 @@ public class TileWeatherController extends TileEntity implements IInventory {
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
|
||||
{
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
//==============================================INVENTORY====================================================//
|
||||
|
||||
+3
@@ -1,5 +1,8 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.energynet;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.Wrench;
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyFi
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.Wrench;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.Utills;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -66,7 +66,7 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase {
|
||||
receiver.particleEnergyCounter -= particleValue;
|
||||
|
||||
//todo detect box size
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.TransceiverParticle(worldObj, xCoord + 0.5, yCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), zCoord + 0.5, receiver.xCoord + worldObj.rand.nextDouble(), receiver.yCoord + worldObj.rand.nextDouble(), receiver.zCoord + worldObj.rand.nextDouble()));
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.TransceiverParticle(worldObj, xCoord + 0.5, yCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4), zCoord + 0.5, receiver.xCoord + worldObj.rand.nextDouble(), receiver.yCoord + worldObj.rand.nextDouble(), receiver.zCoord + worldObj.rand.nextDouble()), 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.Teleporter;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
|
||||
import com.brandon3055.draconicevolution.common.utills.PortalHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 22/5/2015.
|
||||
*/
|
||||
public class TileDislocatorReceptacle extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack dislocator;
|
||||
public PortalHelper.PortalStructure structure = null;
|
||||
public boolean isActive = false;
|
||||
public boolean updating = false;
|
||||
public int coolDown = 0;
|
||||
public int ticksTillStart = -1;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.isRemote) return;
|
||||
if (coolDown > 0) coolDown--;
|
||||
if (ticksTillStart > -1) ticksTillStart--;
|
||||
if (ticksTillStart == 0) worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord), 1);
|
||||
}
|
||||
|
||||
public void validateActivePortal() {
|
||||
if (updating) return;
|
||||
if (structure == null) {
|
||||
isActive = false;
|
||||
return;
|
||||
}
|
||||
isActive = structure.checkFrameIsValid(worldObj, xCoord, yCoord, zCoord) && structure.scanPortal(worldObj, xCoord, yCoord, zCoord, false, true);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public void updateState(){
|
||||
if (structure == null || !isActive) structure = PortalHelper.getValidStructure(worldObj, xCoord, yCoord, zCoord);
|
||||
if (structure == null) {
|
||||
isActive = false;
|
||||
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, blockType);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isActive){
|
||||
if (getStackInSlot(0) == null || !structure.checkFrameIsValid(worldObj, xCoord, yCoord, zCoord)) isActive = false;
|
||||
}else {
|
||||
boolean frameValid = structure.checkFrameIsValid(worldObj, xCoord, yCoord, zCoord);
|
||||
boolean portalEmpty = structure.scanPortal(worldObj, xCoord, yCoord, zCoord, false, false);
|
||||
|
||||
if (getLocation() != null && frameValid && portalEmpty)
|
||||
{
|
||||
isActive = true;
|
||||
structure.scanPortal(worldObj, xCoord, yCoord, zCoord, true, false);
|
||||
}
|
||||
}
|
||||
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, blockType);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public Teleporter.TeleportLocation getLocation(){
|
||||
if (getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof TeleporterMKI) return ((TeleporterMKI)getStackInSlot(0).getItem()).getLocation(getStackInSlot(0));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setBoolean("IsActive", isActive);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
isActive = pkt.func_148857_g().getBoolean("IsActive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return i == 0 ? dislocator : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int count) {
|
||||
ItemStack itemstack = getStackInSlot(i);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.stackSize <= count)
|
||||
{
|
||||
setInventorySlotContents(i, null);
|
||||
} else
|
||||
{
|
||||
itemstack = itemstack.splitStack(count);
|
||||
if (itemstack.stackSize == 0)
|
||||
{
|
||||
setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isActive) updateState();
|
||||
else ticksTillStart = 1;
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
ItemStack item = getStackInSlot(i);
|
||||
if (item != null) setInventorySlotContents(i, null);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
if (i != 0) return;
|
||||
dislocator = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
if (isActive) updateState();
|
||||
else ticksTillStart = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if (worldObj == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return itemstack != null && itemstack.getItem() instanceof TeleporterMKI && ((TeleporterMKI)itemstack.getItem()).getLocation(itemstack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
compound.setBoolean("IsActive", isActive);
|
||||
|
||||
if (dislocator != null) {
|
||||
NBTTagCompound stack = new NBTTagCompound();
|
||||
dislocator.writeToNBT(stack);
|
||||
compound.setTag("Dislocator", stack);
|
||||
}
|
||||
|
||||
if (structure != null){
|
||||
compound.setBoolean("HasStructure", true);
|
||||
structure.writeToNBT(compound);
|
||||
}
|
||||
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
isActive = compound.getBoolean("IsActive");
|
||||
|
||||
if (compound.hasKey("Dislocator")) dislocator = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("Dislocator"));
|
||||
|
||||
if (compound.hasKey("HasStructure")) {
|
||||
structure = new PortalHelper.PortalStructure();
|
||||
structure.readFromNBT(compound);
|
||||
}
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 24/5/2015.
|
||||
*/
|
||||
public class TilePortalBlock extends TileEntity {
|
||||
|
||||
public int masterX = 0;
|
||||
public int masterY = 0;
|
||||
public int masterZ = 0;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.SERVER)
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateEntity() {
|
||||
if (!worldObj.isRemote) return;
|
||||
double distanceMod = Utills.getDistanceAtoB(xCoord+0.5, yCoord+0.5, zCoord+0.5, RenderManager.renderPosX, RenderManager.renderPosY, RenderManager.renderPosZ);
|
||||
if (worldObj.rand.nextInt(Math.max((int)(distanceMod * (distanceMod/5D)), 1)) == 0)
|
||||
{
|
||||
if (blockMetadata == -1) blockMetadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
|
||||
double rD1 = worldObj.rand.nextDouble();
|
||||
double rD2 = worldObj.rand.nextDouble();
|
||||
double rO1 = -0.1 + worldObj.rand.nextDouble() * 0.2;
|
||||
double rO2 = -0.1 + worldObj.rand.nextDouble() * 0.2;
|
||||
|
||||
|
||||
if (blockMetadata == 1 && RenderManager.renderPosZ < zCoord + 0.5)
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord + rD2, zCoord, xCoord + rD1 + rO1, yCoord + rD2 + rO2, zCoord + 0.75), 256);
|
||||
else if (blockMetadata == 1 && RenderManager.renderPosZ > zCoord + 0.5)
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord + rD2, zCoord + 1, xCoord + rD1 + rO1, yCoord + rD2 + rO2, zCoord + 0.25), 256);
|
||||
else if (blockMetadata == 2 && RenderManager.renderPosX < xCoord + 0.5)
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord, yCoord + rD1, zCoord + rD2, xCoord + 0.75, yCoord + rD1 + rO1, zCoord + rD2 + rO2), 256);
|
||||
else if (blockMetadata == 2 && RenderManager.renderPosX > xCoord + 0.5)
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + 1, yCoord + rD1, zCoord + rD2, xCoord + 0.25, yCoord + rD1 + rO1, zCoord + rD2 + rO2), 256);
|
||||
else if (blockMetadata == 3 && RenderManager.renderPosY > yCoord + 0.5)
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord + 1, zCoord + rD2, xCoord + rD1 + rO1, yCoord + 0.25, zCoord + rD2 + rO2), 256);
|
||||
else if (blockMetadata == 3 && RenderManager.renderPosY < yCoord + 0.5)
|
||||
DraconicEvolution.proxy.spawnParticle(new Particles.PortalParticle(worldObj, xCoord + rD1, yCoord, zCoord + rD2, xCoord + rD1 + rO1, yCoord + 0.75, zCoord + rD2 + rO2), 256);
|
||||
}
|
||||
}
|
||||
|
||||
public TileDislocatorReceptacle getMaster(){
|
||||
return worldObj.getTileEntity(masterX, masterY, masterZ) instanceof TileDislocatorReceptacle ? (TileDislocatorReceptacle)worldObj.getTileEntity(masterX, masterY, masterZ) : null;
|
||||
}
|
||||
|
||||
public boolean isPortalStillValid(){
|
||||
TileDislocatorReceptacle master = getMaster();
|
||||
if (master == null || !master.isActive) return false;
|
||||
master.validateActivePortal();
|
||||
return master.isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("MasterX", masterX);
|
||||
compound.setInteger("MasterY", masterY);
|
||||
compound.setInteger("MasterZ", masterZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
masterX = compound.getInteger("MasterX");
|
||||
masterY = compound.getInteger("MasterY");
|
||||
masterZ = compound.getInteger("MasterZ");
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 16/6/2015.
|
||||
*/
|
||||
public class TileReactorCore extends TileEntity {
|
||||
public float renderRotation = 0;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.isRemote) renderRotation += 0.2F;
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 31/12/2014.
|
||||
*/
|
||||
public class DataUtills {
|
||||
|
||||
public static DataUtills instance = new DataUtills();
|
||||
|
||||
public void writeObjectToBytes(ByteBuf bytes, int dataType, Object object){
|
||||
switch (dataType){
|
||||
case References.BYTE_ID:
|
||||
bytes.writeByte((Byte)object);
|
||||
break;
|
||||
case References.SHORT_ID:
|
||||
bytes.writeShort((Short) object);
|
||||
break;
|
||||
case References.INT_ID:
|
||||
bytes.writeInt((Integer) object);
|
||||
break;
|
||||
case References.LONG_ID:
|
||||
bytes.writeLong((Long) object);
|
||||
break;
|
||||
case References.FLOAT_ID:
|
||||
bytes.writeFloat((Float) object);
|
||||
break;
|
||||
case References.DOUBLE_ID:
|
||||
bytes.writeDouble((Double) object);
|
||||
break;
|
||||
case References.CHAR_ID:
|
||||
bytes.writeChar((Character) object);
|
||||
break;
|
||||
case References.STRING_ID:
|
||||
ByteBufUtils.writeUTF8String(bytes, (String) object);
|
||||
break;
|
||||
case References.BOOLEAN_ID:
|
||||
bytes.writeBoolean((Boolean) object);
|
||||
break;
|
||||
case References.INT_PAIR_ID:
|
||||
bytes.writeInt(((IntPair)object).i1);
|
||||
bytes.writeInt(((IntPair)object).i2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Object readObjectFromBytes(ByteBuf bytes, int dataType){
|
||||
switch (dataType){
|
||||
case References.BYTE_ID:
|
||||
return bytes.readByte();
|
||||
case References.SHORT_ID:
|
||||
return bytes.readShort();
|
||||
case References.INT_ID:
|
||||
return bytes.readInt();
|
||||
case References.LONG_ID:
|
||||
return bytes.readLong();
|
||||
case References.FLOAT_ID:
|
||||
return bytes.readFloat();
|
||||
case References.DOUBLE_ID:
|
||||
return bytes.readDouble();
|
||||
case References.CHAR_ID:
|
||||
return bytes.readChar();
|
||||
case References.STRING_ID:
|
||||
return ByteBufUtils.readUTF8String(bytes);
|
||||
case References.BOOLEAN_ID:
|
||||
return bytes.readBoolean();
|
||||
case References.INT_PAIR_ID:
|
||||
IntPair tx = new IntPair(0, 0);
|
||||
tx.i1 = bytes.readInt();
|
||||
tx.i2 = bytes.readInt();
|
||||
return tx;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeObjectToItem(ItemStack stack, Object value, int datatype, String name){
|
||||
switch (datatype){
|
||||
case References.BYTE_ID:
|
||||
ItemNBTHelper.setByte(stack, name, (Byte) value);
|
||||
break;
|
||||
case References.SHORT_ID:
|
||||
ItemNBTHelper.setShort(stack, name, (Short) value);
|
||||
break;
|
||||
case References.INT_ID:
|
||||
ItemNBTHelper.setInteger(stack, name, (Integer) value);
|
||||
break;
|
||||
case References.LONG_ID:
|
||||
ItemNBTHelper.setLong(stack, name, (Long) value);
|
||||
break;
|
||||
case References.FLOAT_ID:
|
||||
ItemNBTHelper.setFloat(stack, name, (Float) value);
|
||||
break;
|
||||
case References.DOUBLE_ID:
|
||||
ItemNBTHelper.setDouble(stack, name, (Double) value);
|
||||
break;
|
||||
// case References.CHAR_ID:
|
||||
// ItemNBTHelper.setChar(stack, value.name, (Byte)value.value);
|
||||
// break;
|
||||
case References.STRING_ID:
|
||||
ItemNBTHelper.setString(stack, name, (String) value);
|
||||
break;
|
||||
case References.BOOLEAN_ID:
|
||||
ItemNBTHelper.setBoolean(stack, name, (Boolean) value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object readObjectFromItem(ItemStack stack, int dataType, String name, Object defaultExpected){
|
||||
switch (dataType){
|
||||
case References.BYTE_ID:
|
||||
return ItemNBTHelper.getByte(stack, name, (Byte)defaultExpected);
|
||||
case References.SHORT_ID:
|
||||
return ItemNBTHelper.getShort(stack, name, (Short)defaultExpected);
|
||||
case References.INT_ID:
|
||||
return ItemNBTHelper.getInteger(stack, name, (Integer)defaultExpected);
|
||||
case References.LONG_ID:
|
||||
return ItemNBTHelper.getLong(stack, name, (Long)defaultExpected);
|
||||
case References.FLOAT_ID:
|
||||
return ItemNBTHelper.getFloat(stack, name, (Float)defaultExpected);
|
||||
case References.DOUBLE_ID:
|
||||
return ItemNBTHelper.getDouble(stack, name, (Double)defaultExpected);
|
||||
//case References.CHAR_ID:
|
||||
case References.STRING_ID:
|
||||
return ItemNBTHelper.getString(stack, name, (String)defaultExpected);
|
||||
case References.BOOLEAN_ID:
|
||||
return ItemNBTHelper.getBoolean(stack, name, (Boolean)defaultExpected);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object readObjectFromItem(ItemStack stack, int dataType, String name){
|
||||
switch (dataType){
|
||||
case References.BYTE_ID:
|
||||
return ItemNBTHelper.getByte(stack, name, (byte)0);
|
||||
case References.SHORT_ID:
|
||||
return ItemNBTHelper.getShort(stack, name, (short)0);
|
||||
case References.INT_ID:
|
||||
return ItemNBTHelper.getInteger(stack, name, 0);
|
||||
case References.LONG_ID:
|
||||
return ItemNBTHelper.getLong(stack, name, 0L);
|
||||
case References.FLOAT_ID:
|
||||
return ItemNBTHelper.getFloat(stack, name, 0F);
|
||||
case References.DOUBLE_ID:
|
||||
return ItemNBTHelper.getDouble(stack, name, 0D);
|
||||
//case References.CHAR_ID:
|
||||
case References.STRING_ID:
|
||||
return ItemNBTHelper.getString(stack, name, "");
|
||||
case References.BOOLEAN_ID:
|
||||
return ItemNBTHelper.getBoolean(stack, name, false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class IntPair
|
||||
{
|
||||
public int i1;
|
||||
public int i2;
|
||||
|
||||
public IntPair(int i1, int i2)
|
||||
{
|
||||
this.i1 = i1;
|
||||
this.i2 = i2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 28/06/2014.
|
||||
*/
|
||||
public class GuiHelper {
|
||||
public static boolean isInRect(int x, int y, int xSize, int ySize, int mouseX, int mouseY){
|
||||
return ((mouseX >= x && mouseX <= x+xSize) && (mouseY >= y && mouseY <= y+ySize));
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.draconicevolution.common.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(energy);//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);
|
||||
}
|
||||
|
||||
public static boolean isCtrlKeyDown() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
||||
}
|
||||
|
||||
@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;}
|
||||
}
|
||||
@@ -1,720 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
/**
|
||||
* Everything in this class is copied from openblocks
|
||||
*/
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.InventoryLargeChest;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class InventoryUtils {
|
||||
|
||||
/***
|
||||
* Try to merge the supplied stack into the supplied slot in the target
|
||||
* inventory
|
||||
*
|
||||
* @param targetInventory
|
||||
* Although it doesn't return anything, it'll REDUCE the stack
|
||||
* size of the stack that you pass in
|
||||
*
|
||||
* @param slot
|
||||
* @param stack
|
||||
*/
|
||||
public static void tryInsertStack(IInventory targetInventory, int slot, ItemStack stack, boolean canMerge) {
|
||||
if (targetInventory.isItemValidForSlot(slot, stack)) {
|
||||
ItemStack targetStack = targetInventory.getStackInSlot(slot);
|
||||
if (targetStack == null) {
|
||||
targetInventory.setInventorySlotContents(slot, stack.copy());
|
||||
stack.stackSize = 0;
|
||||
} else if (canMerge) {
|
||||
if (targetInventory.isItemValidForSlot(slot, stack) &&
|
||||
areMergeCandidates(stack, targetStack)) {
|
||||
int space = targetStack.getMaxStackSize()
|
||||
- targetStack.stackSize;
|
||||
int mergeAmount = Math.min(space, stack.stackSize);
|
||||
ItemStack copy = targetStack.copy();
|
||||
copy.stackSize += mergeAmount;
|
||||
targetInventory.setInventorySlotContents(slot, copy);
|
||||
stack.stackSize -= mergeAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean areItemAndTagEqual(final ItemStack stackA, ItemStack stackB) {
|
||||
return stackA.isItemEqual(stackB) && ItemStack.areItemStackTagsEqual(stackA, stackB);
|
||||
}
|
||||
|
||||
public static boolean areMergeCandidates(ItemStack source, ItemStack target) {
|
||||
return areItemAndTagEqual(source, target) && target.stackSize < target.getMaxStackSize();
|
||||
}
|
||||
|
||||
public static void insertItemIntoInventory(IInventory inventory, ItemStack stack) {
|
||||
insertItemIntoInventory(inventory, stack, ForgeDirection.UNKNOWN, -1);
|
||||
}
|
||||
|
||||
public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot) {
|
||||
insertItemIntoInventory(inventory, stack, side, intoSlot, true);
|
||||
}
|
||||
|
||||
public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, boolean doMove) {
|
||||
insertItemIntoInventory(inventory, stack, side, intoSlot, doMove, true);
|
||||
}
|
||||
|
||||
public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, boolean doMove, boolean canStack) {
|
||||
if (stack == null) return;
|
||||
|
||||
final int sideId = side.ordinal();
|
||||
IInventory targetInventory = inventory;
|
||||
|
||||
// if we're not meant to move, make a clone of the inventory
|
||||
if (!doMove) {
|
||||
GenericInventory copy = new GenericInventory("temporary.inventory", false, targetInventory.getSizeInventory());
|
||||
copy.copyFrom(inventory);
|
||||
targetInventory = copy;
|
||||
}
|
||||
|
||||
final Set<Integer> attemptSlots = Sets.newTreeSet();
|
||||
|
||||
// if it's a sided inventory, get all the accessible slots
|
||||
final boolean isSidedInventory = inventory instanceof ISidedInventory && side != ForgeDirection.UNKNOWN;
|
||||
|
||||
if (isSidedInventory) {
|
||||
int[] accessibleSlots = ((ISidedInventory)inventory).getAccessibleSlotsFromSide(sideId);
|
||||
for (int slot : accessibleSlots)
|
||||
attemptSlots.add(slot);
|
||||
} else {
|
||||
// if it's just a standard inventory, get all slots
|
||||
for (int a = 0; a < inventory.getSizeInventory(); a++) {
|
||||
attemptSlots.add(a);
|
||||
}
|
||||
}
|
||||
|
||||
// if we've defining a specific slot, we'll just use that
|
||||
if (intoSlot > -1) attemptSlots.retainAll(ImmutableSet.of(intoSlot));
|
||||
|
||||
if (attemptSlots.isEmpty()) return;
|
||||
|
||||
for (Integer slot : attemptSlots) {
|
||||
if (stack.stackSize <= 0) break;
|
||||
if (isSidedInventory && !((ISidedInventory)inventory).canInsertItem(slot, stack, sideId)) continue;
|
||||
tryInsertStack(targetInventory, slot, stack, canStack);
|
||||
}
|
||||
}
|
||||
|
||||
public static int moveItemInto(IInventory fromInventory, int fromSlot, Object target, int intoSlot, int maxAmount, ForgeDirection direction, boolean doMove) {
|
||||
return moveItemInto(fromInventory, fromSlot, target, intoSlot, maxAmount, direction, doMove, true);
|
||||
}
|
||||
|
||||
/***
|
||||
* Move an item from the fromInventory, into the target. The target can be
|
||||
* an inventory or pipe.
|
||||
* Double checks are automagically wrapped. If you're not bothered what slot
|
||||
* you insert into, pass -1 for intoSlot. If you're passing false for
|
||||
* doMove, it'll create a dummy inventory and its calculations on that
|
||||
* instead
|
||||
*
|
||||
* @param fromInventory
|
||||
* the inventory the item is coming from
|
||||
* @param fromSlot
|
||||
* the slot the item is coming from
|
||||
* @param target
|
||||
* the inventory you want the item to be put into. can be BC pipe
|
||||
* or IInventory
|
||||
* @param intoSlot
|
||||
* the target slot. Pass -1 for any slot
|
||||
* @param maxAmount
|
||||
* The maximum amount you wish to pass
|
||||
* @param direction
|
||||
* The direction of the move. Pass UNKNOWN if not applicable
|
||||
* @param doMove
|
||||
* @param canStack
|
||||
* @return The amount of items moved
|
||||
*/
|
||||
public static int moveItemInto(IInventory fromInventory, int fromSlot, Object target, int intoSlot, int maxAmount, ForgeDirection direction, boolean doMove, boolean canStack) {
|
||||
|
||||
fromInventory = InventoryUtils.getInventory(fromInventory);
|
||||
|
||||
// if we dont have a stack in the source location, return 0
|
||||
ItemStack sourceStack = fromInventory.getStackInSlot(fromSlot);
|
||||
if (sourceStack == null) { return 0; }
|
||||
|
||||
if (fromInventory instanceof ISidedInventory
|
||||
&& !((ISidedInventory)fromInventory).canExtractItem(fromSlot, sourceStack, direction.ordinal())) return 0;
|
||||
|
||||
// create a clone of our source stack and set the size to either
|
||||
// maxAmount or the stackSize
|
||||
ItemStack clonedSourceStack = sourceStack.copy();
|
||||
clonedSourceStack.stackSize = Math.min(clonedSourceStack.stackSize, maxAmount);
|
||||
int amountToMove = clonedSourceStack.stackSize;
|
||||
int inserted = 0;
|
||||
|
||||
if (target instanceof IInventory) {
|
||||
IInventory targetInventory = getInventory((IInventory)target);
|
||||
ForgeDirection side = direction.getOpposite();
|
||||
// try insert the item into the target inventory. this'll reduce the
|
||||
// stackSize of our stack
|
||||
InventoryUtils.insertItemIntoInventory(targetInventory, clonedSourceStack, side, intoSlot, doMove, canStack);
|
||||
inserted = amountToMove - clonedSourceStack.stackSize;
|
||||
|
||||
}
|
||||
|
||||
// if we've done the move, reduce/remove the stack from our source
|
||||
// inventory
|
||||
if (doMove) {
|
||||
ItemStack newSourcestack = sourceStack.copy();
|
||||
newSourcestack.stackSize -= inserted;
|
||||
if (newSourcestack.stackSize == 0) {
|
||||
fromInventory.setInventorySlotContents(fromSlot, null);
|
||||
} else {
|
||||
fromInventory.setInventorySlotContents(fromSlot, newSourcestack);
|
||||
}
|
||||
}
|
||||
|
||||
return inserted;
|
||||
}
|
||||
|
||||
private static IInventory doubleChestFix(TileEntity te) {
|
||||
final World world = te.getWorldObj();
|
||||
final int x = te.xCoord;
|
||||
final int y = te.yCoord;
|
||||
final int z = te.zCoord;
|
||||
if (world.getBlock(x - 1, y, z) == Blocks.chest) return new InventoryLargeChest("Large chest", (IInventory)world.getTileEntity(x - 1, y, z), (IInventory)te);
|
||||
if (world.getBlock(x + 1, y, z) == Blocks.chest) return new InventoryLargeChest("Large chest", (IInventory)te, (IInventory)world.getTileEntity(x + 1, y, z));
|
||||
if (world.getBlock(x, y, z - 1) == Blocks.chest) return new InventoryLargeChest("Large chest", (IInventory)world.getTileEntity(x, y, z - 1), (IInventory)te);
|
||||
if (world.getBlock(x, y, z + 1) == Blocks.chest) return new InventoryLargeChest("Large chest", (IInventory)te, (IInventory)world.getTileEntity(x, y, z + 1));
|
||||
return (te instanceof IInventory)? (IInventory)te : null;
|
||||
}
|
||||
|
||||
public static IInventory getInventory(World world, int x, int y, int z) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityChest) return doubleChestFix(tileEntity);
|
||||
if (tileEntity instanceof IInventory) return (IInventory)tileEntity;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IInventory getInventory(World world, int x, int y, int z, ForgeDirection direction) {
|
||||
if (direction != null) {
|
||||
x += direction.offsetX;
|
||||
y += direction.offsetY;
|
||||
z += direction.offsetZ;
|
||||
}
|
||||
return getInventory(world, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
public static IInventory getInventory(IInventory inventory) {
|
||||
if (inventory instanceof TileEntityChest) return doubleChestFix((TileEntity)inventory);
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public static List<ItemStack> getInventoryContents(IInventory inventory) {
|
||||
List<ItemStack> result = Lists.newArrayList();
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack slot = inventory.getStackInSlot(i);
|
||||
if (slot != null) result.add(slot);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/***
|
||||
* Get the indexes of all slots containing a stack of the supplied item
|
||||
* type.
|
||||
*
|
||||
* @param inventory
|
||||
* @param stack
|
||||
* @return Returns a set of the slot indexes
|
||||
*/
|
||||
public static Set<Integer> getSlotsWithStack(IInventory inventory, ItemStack stack) {
|
||||
inventory = getInventory(inventory);
|
||||
Set<Integer> slots = Sets.newHashSet();
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = inventory.getStackInSlot(i);
|
||||
if (stackInSlot != null && stackInSlot.isItemEqual(stack)) slots.add(i);
|
||||
}
|
||||
return slots;
|
||||
}
|
||||
|
||||
/***
|
||||
* Get the first slot containing an item type matching the supplied type.
|
||||
*
|
||||
* @param inventory
|
||||
* @param stack
|
||||
* @return Returns -1 if none found
|
||||
*/
|
||||
public static int getFirstSlotWithStack(IInventory inventory, ItemStack stack) {
|
||||
inventory = getInventory(inventory);
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = inventory.getStackInSlot(i);
|
||||
if (stackInSlot != null && stackInSlot.isItemEqual(stack)) { return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/***
|
||||
* Consume ONE of the supplied item types
|
||||
*
|
||||
* @param inventory
|
||||
* @param stack
|
||||
* @return Returns whether or not it was able to
|
||||
*/
|
||||
public static boolean consumeInventoryItem(IInventory inventory, ItemStack stack) {
|
||||
int slotWithStack = getFirstSlotWithStack(inventory, stack);
|
||||
if (slotWithStack > -1) {
|
||||
ItemStack stackInSlot = inventory.getStackInSlot(slotWithStack);
|
||||
stackInSlot.stackSize--;
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
inventory.setInventorySlotContents(slotWithStack, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first slot index in an inventory with an item
|
||||
*
|
||||
* @param invent
|
||||
* @return The slot index, or -1 if the inventory is empty
|
||||
*/
|
||||
public static int getSlotIndexOfNextStack(IInventory invent) {
|
||||
for (int i = 0; i < invent.getSizeInventory(); i++) {
|
||||
ItemStack stack = invent.getStackInSlot(i);
|
||||
if (stack != null) { return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/***
|
||||
* Removes an item stack from the inventory and returns a copy of it
|
||||
*
|
||||
* @param invent
|
||||
* @return A copy of the stack it removed
|
||||
*/
|
||||
public static ItemStack removeNextItemStack(IInventory invent) {
|
||||
int nextFilledSlot = getSlotIndexOfNextStack(invent);
|
||||
if (nextFilledSlot > -1) {
|
||||
ItemStack copy = invent.getStackInSlot(nextFilledSlot).copy();
|
||||
invent.setInventorySlotContents(nextFilledSlot, null);
|
||||
return copy;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int moveItemsFromOneOfSides(TileEntity te, IInventory inv, int maxAmount, int intoSlot, Set<ForgeDirection> sides) {
|
||||
return moveItemsFromOneOfSides(te, inv, null, maxAmount, intoSlot, sides);
|
||||
}
|
||||
|
||||
public static int moveItemsFromOneOfSides(TileEntity te, IInventory inv, ItemStack filterStack, int maxAmount, int intoSlot, Set<ForgeDirection> sides) {
|
||||
List<ForgeDirection> shuffledSides = Lists.newArrayList(sides);
|
||||
Collections.shuffle(shuffledSides);
|
||||
|
||||
IInventory ourInventory = getInventory(inv);
|
||||
|
||||
// loop through the shuffled sides
|
||||
for (ForgeDirection dir : sides) {
|
||||
TileEntity tileOnSurface = getTileInDirection(te, dir);
|
||||
// if it's an inventory
|
||||
if (tileOnSurface instanceof IInventory) {
|
||||
final IInventory neighbor = (IInventory)tileOnSurface;
|
||||
|
||||
Set<Integer> slots;
|
||||
|
||||
if (filterStack == null) slots = getAllSlots(neighbor);
|
||||
else slots = getSlotsWithStack(neighbor, filterStack);
|
||||
|
||||
for (Integer slot : slots) {
|
||||
int moved = InventoryUtils.moveItemInto(neighbor, slot, ourInventory, intoSlot, maxAmount, dir.getOpposite(), true);
|
||||
if (moved > 0) return moved;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if an item stack can be inserted in to an inventory Does not
|
||||
* perform the insertion, only tests the possibility
|
||||
*
|
||||
* @param inventory
|
||||
* The inventory to insert the stack into
|
||||
* @param item
|
||||
* the stack to insert
|
||||
* @return the amount of items that could be put in to the stack
|
||||
*/
|
||||
public static int testInventoryInsertion(IInventory inventory, ItemStack item) {
|
||||
if (item == null || item.stackSize == 0) return 0;
|
||||
if (inventory == null) return 0;
|
||||
int slotCount = inventory.getSizeInventory();
|
||||
/*
|
||||
* Allows counting down the item size, without cloning or changing the
|
||||
* object
|
||||
*/
|
||||
int itemSizeCounter = item.stackSize;
|
||||
for (int i = 0; i < slotCount && itemSizeCounter > 0; i++) {
|
||||
|
||||
if (!inventory.isItemValidForSlot(i, item)) continue;
|
||||
ItemStack inventorySlot = inventory.getStackInSlot(i);
|
||||
/*
|
||||
* If the slot is empty, dump the biggest stack we can, taking in to
|
||||
* consideration, the remaining amount of stack
|
||||
*/
|
||||
if (inventorySlot == null) {
|
||||
itemSizeCounter -= Math.min(Math.min(itemSizeCounter, inventory.getInventoryStackLimit()), item.getMaxStackSize());
|
||||
}
|
||||
/* If the slot is not empty, check that these items stack */
|
||||
else if (areMergeCandidates(item, inventorySlot)) {
|
||||
/* If they stack, decrement by the amount of space that remains */
|
||||
|
||||
int space = inventorySlot.getMaxStackSize()
|
||||
- inventorySlot.stackSize;
|
||||
itemSizeCounter -= Math.min(itemSizeCounter, space);
|
||||
}
|
||||
}
|
||||
// itemSizeCounter might be less than zero here. It shouldn't be, but I
|
||||
// don't trust me. -NC
|
||||
if (itemSizeCounter != item.stackSize) {
|
||||
itemSizeCounter = Math.max(itemSizeCounter, 0);
|
||||
return item.stackSize - itemSizeCounter;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static Set<Integer> getAllSlots(IInventory inventory) {
|
||||
inventory = getInventory(inventory);
|
||||
Set<Integer> slots = new HashSet<Integer>();
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
slots.add(i);
|
||||
}
|
||||
return slots;
|
||||
}
|
||||
|
||||
public static Map<Integer, ItemStack> getAllItems(IInventory inventory) {
|
||||
Map<Integer, ItemStack> result = Maps.newHashMap();
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack != null) result.put(i, stack);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public static int moveItemsToOneOfSides(TileEntity te, IInventory inv, int fromSlot, int maxAmount, Set<ForgeDirection> sides) {
|
||||
// wrap it. Sure, we dont need to really as this'll never be a double
|
||||
// chest but, whatevs. (M?)
|
||||
final IInventory inventory = getInventory(inv);
|
||||
|
||||
// if we've not got a stack in that slot, we dont care.
|
||||
if (inventory.getStackInSlot(fromSlot) == null) return 0;
|
||||
|
||||
// shuffle the sides that have been passed in
|
||||
List<ForgeDirection> shuffledSides = Lists.newArrayList(sides);
|
||||
Collections.shuffle(shuffledSides);
|
||||
|
||||
for (ForgeDirection dir : shuffledSides) {
|
||||
// grab the tile in the current direction
|
||||
TileEntity tileOnSurface = getTileInDirection(te, dir);
|
||||
if (tileOnSurface == null) { return 0; }
|
||||
|
||||
int moved = InventoryUtils.moveItemInto(inventory, fromSlot, tileOnSurface, -1, maxAmount, dir, true);
|
||||
// move the object from our inventory, in the specified slot, to a
|
||||
// pipe or any slot in an inventory in a particular direction
|
||||
if (moved > 0) return moved;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean inventoryIsEmpty(IInventory inventory) {
|
||||
for (int i = 0, l = inventory.getSizeInventory(); i < l; i++)
|
||||
if (inventory.getStackInSlot(i) != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean tryMergeStacks(ItemStack stackToMerge, ItemStack stackInSlot) {
|
||||
if (stackInSlot == null || !stackInSlot.isItemEqual(stackToMerge) || !ItemStack.areItemStackTagsEqual(stackToMerge, stackInSlot)) return false;
|
||||
|
||||
int newStackSize = stackInSlot.stackSize + stackToMerge.stackSize;
|
||||
|
||||
final int maxStackSize = stackToMerge.getMaxStackSize();
|
||||
if (newStackSize <= maxStackSize) {
|
||||
stackToMerge.stackSize = 0;
|
||||
stackInSlot.stackSize = newStackSize;
|
||||
return true;
|
||||
} else if (stackInSlot.stackSize < maxStackSize) {
|
||||
stackToMerge.stackSize -= maxStackSize - stackInSlot.stackSize;
|
||||
stackInSlot.stackSize = maxStackSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack returnItem(ItemStack stack) {
|
||||
return (stack == null || stack.stackSize <= 0)? null : stack.copy();
|
||||
}
|
||||
|
||||
public static void swapStacks(IInventory inventory, int slot1, int slot2) {
|
||||
swapStacks(inventory, slot1, slot2, true, true);
|
||||
}
|
||||
|
||||
public static void swapStacks(IInventory inventory, int slot1, int slot2, boolean copy, boolean validate) {
|
||||
Preconditions.checkElementIndex(slot1, inventory.getSizeInventory(), "input slot id");
|
||||
Preconditions.checkElementIndex(slot2, inventory.getSizeInventory(), "output slot id");
|
||||
|
||||
ItemStack stack1 = inventory.getStackInSlot(slot1);
|
||||
ItemStack stack2 = inventory.getStackInSlot(slot2);
|
||||
|
||||
if (validate) {
|
||||
isItemValid(inventory, slot2, stack1);
|
||||
isItemValid(inventory, slot1, stack2);
|
||||
}
|
||||
|
||||
if (copy) {
|
||||
if (stack1 != null) stack1 = stack1.copy();
|
||||
if (stack2 != null) stack2 = stack2.copy();
|
||||
}
|
||||
|
||||
inventory.setInventorySlotContents(slot1, stack2);
|
||||
inventory.setInventorySlotContents(slot2, stack1);
|
||||
inventory.markDirty();
|
||||
}
|
||||
|
||||
public static void swapStacks(ISidedInventory inventory, int slot1, ForgeDirection side1, int slot2, ForgeDirection side2) {
|
||||
swapStacks(inventory, slot1, side1, slot2, side2, true, true);
|
||||
}
|
||||
|
||||
public static void swapStacks(ISidedInventory inventory, int slot1, ForgeDirection side1, int slot2, ForgeDirection side2, boolean copy, boolean validate) {
|
||||
Preconditions.checkElementIndex(slot1, inventory.getSizeInventory(), "input slot id");
|
||||
Preconditions.checkElementIndex(slot2, inventory.getSizeInventory(), "output slot id");
|
||||
|
||||
ItemStack stack1 = inventory.getStackInSlot(slot1);
|
||||
ItemStack stack2 = inventory.getStackInSlot(slot2);
|
||||
|
||||
if (validate) {
|
||||
isItemValid(inventory, slot2, stack1);
|
||||
isItemValid(inventory, slot1, stack2);
|
||||
|
||||
canExtract(inventory, slot1, side1, stack1);
|
||||
canInsert(inventory, slot2, side2, stack1);
|
||||
|
||||
canExtract(inventory, slot2, side2, stack2);
|
||||
canInsert(inventory, slot1, side1, stack2);
|
||||
}
|
||||
|
||||
if (copy) {
|
||||
if (stack1 != null) stack1 = stack1.copy();
|
||||
if (stack2 != null) stack2 = stack2.copy();
|
||||
}
|
||||
|
||||
inventory.setInventorySlotContents(slot1, stack2);
|
||||
inventory.setInventorySlotContents(slot2, stack1);
|
||||
inventory.markDirty();
|
||||
}
|
||||
|
||||
protected static void isItemValid(IInventory inventory, int slot, ItemStack stack) {
|
||||
Preconditions.checkArgument(inventory.isItemValidForSlot(slot, stack), "Slot %s cannot accept item", slot);
|
||||
}
|
||||
|
||||
protected static void canInsert(ISidedInventory inventory, int slot, ForgeDirection side, ItemStack stack) {
|
||||
Preconditions.checkArgument(inventory.canInsertItem(slot, stack, side.ordinal()),
|
||||
"Item cannot be inserted into slot %s on side %s", slot, side);
|
||||
}
|
||||
|
||||
protected static void canExtract(ISidedInventory inventory, int slot, ForgeDirection side, ItemStack stack) {
|
||||
Preconditions.checkArgument(inventory.canExtractItem(slot, stack, side.ordinal()),
|
||||
"Item cannot be extracted from slot %s on side %s", slot, side);
|
||||
}
|
||||
|
||||
public static TileEntity getTileInDirection(TileEntity tile, ForgeDirection direction) {
|
||||
int targetX = tile.xCoord + direction.offsetX;
|
||||
int targetY = tile.yCoord + direction.offsetY;
|
||||
int targetZ = tile.zCoord + direction.offsetZ;
|
||||
return tile.getWorldObj().getTileEntity(targetX, targetY, targetZ);
|
||||
}
|
||||
|
||||
public static class GenericInventory implements IInventory {
|
||||
|
||||
protected String inventoryTitle;
|
||||
protected int slotsCount;
|
||||
protected ItemStack[] inventoryContents;
|
||||
protected boolean isInvNameLocalized;
|
||||
|
||||
public GenericInventory(String name, boolean isInvNameLocalized, int size) {
|
||||
this.isInvNameLocalized = isInvNameLocalized;
|
||||
this.slotsCount = size;
|
||||
this.inventoryTitle = name;
|
||||
this.inventoryContents = new ItemStack[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int par1, int par2)
|
||||
{
|
||||
if (this.inventoryContents[par1] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.inventoryContents[par1].stackSize <= par2)
|
||||
{
|
||||
itemstack = this.inventoryContents[par1];
|
||||
this.inventoryContents[par1] = null;
|
||||
return itemstack;
|
||||
}
|
||||
itemstack = this.inventoryContents[par1].splitStack(par2);
|
||||
if (this.inventoryContents[par1].stackSize == 0)
|
||||
{
|
||||
this.inventoryContents[par1] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slotsCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return this.inventoryContents[i];
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot(Enum<?> i) {
|
||||
return getStackInSlot(i.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if (i >= this.inventoryContents.length) { return null; }
|
||||
if (this.inventoryContents[i] != null) {
|
||||
ItemStack itemstack = this.inventoryContents[i];
|
||||
this.inventoryContents[i] = null;
|
||||
return itemstack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isItem(int slot, Item item) {
|
||||
return inventoryContents[slot] != null
|
||||
&& inventoryContents[slot].getItem() == item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void clearAndSetSlotCount(int amount) {
|
||||
this.slotsCount = amount;
|
||||
inventoryContents = new ItemStack[amount];
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
if (tag.hasKey("size")) {
|
||||
this.slotsCount = tag.getInteger("size");
|
||||
}
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
inventoryContents = new ItemStack[slotsCount];
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
NBTTagCompound stacktag = nbttaglist.getCompoundTagAt(i);
|
||||
int j = stacktag.getByte("Slot");
|
||||
if (j >= 0 && j < inventoryContents.length) {
|
||||
inventoryContents[j] = ItemStack.loadItemStackFromNBT(stacktag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
this.inventoryContents[i] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("size", getSizeInventory());
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
for (int i = 0; i < inventoryContents.length; i++) {
|
||||
if (inventoryContents[i] != null) {
|
||||
NBTTagCompound stacktag = new NBTTagCompound();
|
||||
stacktag.setByte("Slot", (byte)i);
|
||||
inventoryContents[i].writeToNBT(stacktag);
|
||||
nbttaglist.appendTag(stacktag);
|
||||
}
|
||||
}
|
||||
tag.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
/**
|
||||
* This bastard never even gets called, so don't rely on it.
|
||||
*/
|
||||
@Override
|
||||
public void markDirty() {
|
||||
}
|
||||
|
||||
public void copyFrom(IInventory inventory) {
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
if (i < getSizeInventory()) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
setInventorySlotContents(i, stack.copy());
|
||||
} else {
|
||||
setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<ItemStack> contents() {
|
||||
return Arrays.asList(inventoryContents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.inventoryTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.isInvNameLocalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
public final class ItemNBTHelper {
|
||||
|
||||
|
||||
|
||||
// SETTERS ///////////////////////////////////////////////////////////////////
|
||||
public static NBTTagCompound getCompound(ItemStack stack){
|
||||
if (stack.getTagCompound() == null) stack.setTagCompound(new NBTTagCompound());
|
||||
return stack.getTagCompound();
|
||||
}
|
||||
|
||||
public static ItemStack setByte(ItemStack stack, String tag, byte b)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setByte(tag, b);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
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 ItemStack setShort(ItemStack stack, String tag, short s)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setShort(tag, s);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
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 ItemStack setLong(ItemStack stack, String tag, long i)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setLong(tag, i);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
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 ItemStack setDouble(ItemStack stack, String tag, double d)
|
||||
{
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setDouble(tag, d);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack setString(ItemStack stack, String tag, String s) {
|
||||
NBTTagCompound compound = getCompound(stack);
|
||||
compound.setString(tag, s);
|
||||
stack.setTagCompound(compound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
// GETTERS ///////////////////////////////////////////////////////////////////
|
||||
|
||||
public static boolean verifyExistance(ItemStack stack, String tag) {
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
if (compound == null)
|
||||
return false;
|
||||
else
|
||||
return stack.getTagCompound().hasKey(tag);
|
||||
}
|
||||
|
||||
public static byte getByte(ItemStack stack, String tag, byte defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getByte(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getBoolean(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static short getShort(ItemStack stack, String tag, short defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getShort(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static int getInteger(ItemStack stack, String tag, int defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getInteger(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static long getLong(ItemStack stack, String tag, long defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getLong(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static float getFloat(ItemStack stack, String tag, float defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getFloat(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static double getDouble(ItemStack stack, String tag, double defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getDouble(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static String getString(ItemStack stack, String tag, String defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? stack.getTagCompound().getString(tag) : defaultExpected;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 23/5/2015.
|
||||
*/
|
||||
public class PortalHelper {
|
||||
|
||||
static int iterationNow = 0;
|
||||
|
||||
public static boolean isFrame(Block block) { return block == ModBlocks.infusedObsidian; }
|
||||
|
||||
public static boolean isReceptacle(Block block) { return block == ModBlocks.dislocatorReceptacle; }
|
||||
|
||||
public static boolean isPortal(Block block) { return block == ModBlocks.portal; }
|
||||
|
||||
public static PortalStructure getValidStructure(World world, int x, int y, int z) {
|
||||
if (world.isRemote) return null;
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){
|
||||
for (ForgeDirection plane : ForgeDirection.VALID_DIRECTIONS){
|
||||
if (plane != direction && plane != direction.getOpposite()) {
|
||||
PortalStructure structure = traceFrame(world, x, y, z, direction, plane);
|
||||
if (structure != null && structure.scanPortal(world, x, y, z, false, false)) return structure;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PortalStructure traceFrame(World world, int x, int y, int z, ForgeDirection startDir, ForgeDirection plane){
|
||||
int MAX_SIZE = 150;
|
||||
int startX = x + startDir.offsetX;
|
||||
int startY = y + startDir.offsetY;
|
||||
int startZ = z + startDir.offsetZ;
|
||||
|
||||
//Check that the trace is starting from a receptacle
|
||||
if (!world.isAirBlock(startX, startY, startZ)) return null;
|
||||
|
||||
int xSize = 0;
|
||||
int ySize = 0;
|
||||
int yOffset = 0;
|
||||
|
||||
//Get X size
|
||||
for (int i = 0; i <= MAX_SIZE; i++){
|
||||
Block block = world.getBlock(startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ);
|
||||
if (isFrame(block)) {
|
||||
xSize = i;
|
||||
break;
|
||||
}
|
||||
else if (!world.isAirBlock(startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ)) return null;
|
||||
}
|
||||
|
||||
//Get Y size above receptacle
|
||||
for (int i = 0; i <= MAX_SIZE; i++){
|
||||
Block block = world.getBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ);
|
||||
if (isFrame(block)) {
|
||||
ySize = i;
|
||||
break;
|
||||
}
|
||||
else if (!world.isAirBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ)) return null;
|
||||
}
|
||||
|
||||
//Get Y size below receptacle and get y offset
|
||||
for (int i = 0; i <= MAX_SIZE; i++){
|
||||
Block block = world.getBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ);
|
||||
if (isFrame(block)) {
|
||||
ySize += i - 1;
|
||||
yOffset = i;
|
||||
break;
|
||||
}
|
||||
else if (!world.isAirBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ)) return null;
|
||||
|
||||
}
|
||||
|
||||
if (xSize == 0 || ySize == 0 || ySize > MAX_SIZE) return null;
|
||||
|
||||
PortalStructure structure = new PortalStructure(xSize, ySize, yOffset, startDir, plane);
|
||||
|
||||
if (!structure.checkFrameIsValid(world, x, y, z) || !structure.scanPortal(world, x, y, z, false, false)) return null;
|
||||
|
||||
|
||||
return structure;
|
||||
}
|
||||
|
||||
public static class PortalStructure {
|
||||
|
||||
public int xSize;
|
||||
public int ySize;
|
||||
public int yOffset;
|
||||
public ForgeDirection startDir;
|
||||
public ForgeDirection plane;
|
||||
|
||||
public PortalStructure(){}
|
||||
|
||||
public PortalStructure(int xSize, int ySize, int yOffset, ForgeDirection startDir, ForgeDirection plane){
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.yOffset = yOffset;
|
||||
this.startDir = startDir;
|
||||
this.plane = plane;
|
||||
}
|
||||
|
||||
public boolean checkFrameIsValid(World world, int x, int y, int z) {
|
||||
|
||||
int startX = x + startDir.offsetX;
|
||||
int startY = y + startDir.offsetY;
|
||||
int startZ = z + startDir.offsetZ;
|
||||
|
||||
//Check structure for y size
|
||||
for (int y1 = 1; y1 <= ySize; y1++){
|
||||
int y2 = y1 - yOffset;
|
||||
|
||||
int inX = startX + y2 * plane.offsetX - startDir.offsetX;
|
||||
int inY = startY + y2 * plane.offsetY - startDir.offsetY;
|
||||
int inZ = startZ + y2 * plane.offsetZ - startDir.offsetZ;
|
||||
|
||||
int outX = startX + y2 * plane.offsetX + (xSize) * startDir.offsetX;
|
||||
int outY = startY + y2 * plane.offsetY + (xSize) * startDir.offsetY;
|
||||
int outZ = startZ + y2 * plane.offsetZ + (xSize) * startDir.offsetZ;
|
||||
|
||||
if (!isFrame(world.getBlock(inX, inY, inZ)) && !(inX == x && inY == y && inZ == z)) return false;
|
||||
if (!isFrame(world.getBlock(outX, outY, outZ))) return false;
|
||||
}
|
||||
|
||||
//Check structure for x size
|
||||
for (int x1 = 0; x1 < xSize; x1++){
|
||||
int upX = startX + x1 * startDir.offsetX - yOffset * plane.offsetX;
|
||||
int upY = startY + x1 * startDir.offsetY - yOffset * plane.offsetY;
|
||||
int upZ = startZ + x1 * startDir.offsetZ - yOffset * plane.offsetZ;
|
||||
|
||||
int downX = startX + x1 * startDir.offsetX + (ySize - yOffset + 1) * plane.offsetX;
|
||||
int downY = startY + x1 * startDir.offsetY + (ySize - yOffset + 1) * plane.offsetY;
|
||||
int downZ = startZ + x1 * startDir.offsetZ + (ySize - yOffset + 1) * plane.offsetZ;
|
||||
|
||||
if (!isFrame(world.getBlock(upX, upY, upZ))) return false;
|
||||
if (!isFrame(world.getBlock(downX, downY, downZ))) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean scanPortal(World world, int x, int y, int z, boolean setPortalBlocks, boolean checkPortalBlocks){
|
||||
int startX = x + startDir.offsetX;
|
||||
int startY = y + startDir.offsetY;
|
||||
int startZ = z + startDir.offsetZ;
|
||||
|
||||
TileDislocatorReceptacle receptacle = (TileDislocatorReceptacle) world.getTileEntity(x, y, z);
|
||||
if (receptacle == null) return false;
|
||||
if (setPortalBlocks) receptacle.updating = true;
|
||||
|
||||
for (int x1 = 0; x1 < xSize; x1++){
|
||||
for (int y1 = 1; y1 <= ySize; y1++)
|
||||
{
|
||||
int y2 = y1 - yOffset;
|
||||
int X = (startX + x1 * startDir.offsetX) + y2 * plane.offsetX;
|
||||
int Y = (startY + x1 * startDir.offsetY) + y2 * plane.offsetY;
|
||||
int Z = (startZ + x1 * startDir.offsetZ) + y2 * plane.offsetZ;
|
||||
|
||||
Block block = world.getBlock(X, Y, Z);
|
||||
|
||||
if (checkPortalBlocks){
|
||||
if (!isPortal(block)) return false;
|
||||
}
|
||||
else if (setPortalBlocks) {
|
||||
world.setBlock(X, Y, Z, ModBlocks.portal);
|
||||
Chunk chunk = world.getChunkFromBlockCoords(X, Z);
|
||||
TilePortalBlock tile = (TilePortalBlock) chunk.func_150806_e(X & 15, Y, Z & 15);
|
||||
tile.masterX = x;
|
||||
tile.masterY = y;
|
||||
tile.masterZ = z;
|
||||
}
|
||||
else if (!world.isAirBlock(X, Y, Z)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (setPortalBlocks) receptacle.updating = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("XSize", xSize);
|
||||
compound.setInteger("YSize", ySize);
|
||||
compound.setInteger("YOffset", yOffset);
|
||||
compound.setString("StartDir", startDir.name());
|
||||
compound.setString("Plane", plane.name());
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
xSize = compound.getInteger("XSize");
|
||||
ySize = compound.getInteger("YSize");
|
||||
yOffset = compound.getInteger("YOffset");
|
||||
startDir = ForgeDirection.valueOf(compound.getString("StartDir"));
|
||||
plane = ForgeDirection.valueOf(compound.getString("Plane"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
Loaded 100 of 138 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user