mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-21 04:32:18 +00:00
Merge remote-tracking branch 'origin/master' into Telepad
Conflicts: src/main/java/crazypants/enderio/teleport/BlockTravelAnchor.java
This commit is contained in:
commit
e4c6034476
10 files changed
+20
-289
No files matched your search
+1
-1
@@ -7,7 +7,7 @@ mod_version=2.2.8
|
||||
#mod_appendix=beta
|
||||
|
||||
buildcraft_version=6.1.5
|
||||
waila_version=1.5.8a_1.7.10
|
||||
waila_version=1.5.9_dev1_1.7.10
|
||||
ae2_version=rv1-stable-1
|
||||
ttCore_version=MC1.7.10-0.1.0-55
|
||||
forestry_version=forestry_1.7.10:3.3.0.423-unstable
|
||||
|
||||
@@ -87,13 +87,13 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
System.out.println("AbstractItemConduit.onItemUse: Bundle null");
|
||||
return false;
|
||||
}
|
||||
IConduit con = createConduit(stack, player);
|
||||
if(con == null) {
|
||||
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
|
||||
return false;
|
||||
}
|
||||
if(bundle.getConduit(con.getBaseConduitType()) == null) {
|
||||
if(!bundle.hasType(getBaseConduitType())) {
|
||||
if(!world.isRemote) {
|
||||
IConduit con = createConduit(stack, player);
|
||||
if(con == null) {
|
||||
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
|
||||
return false;
|
||||
}
|
||||
bundle.addConduit(con);
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
|
||||
@@ -23,6 +23,7 @@ import crazypants.enderio.enderface.te.MeProxy;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.Lang;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
|
||||
public class BlockEnderIO extends BlockEio implements IResourceTooltipProvider {
|
||||
|
||||
@@ -95,7 +96,7 @@ public class BlockEnderIO extends BlockEio implements IResourceTooltipProvider {
|
||||
entityPlayer.openGui(EnderIO.instance, GuiHandler.GUI_ID_TRAVEL_ACCESSABLE, world, x, y, z);
|
||||
} else {
|
||||
if(world.isRemote && !entityPlayer.isSneaking()) {
|
||||
entityPlayer.addChatComponentMessage(new ChatComponentText(Lang.localize("gui.travelAccessable.privateBlock1") + " " + ta.getPlacedBy() + " "
|
||||
entityPlayer.addChatComponentMessage(new ChatComponentText(Lang.localize("gui.travelAccessable.privateBlock1") + " " + UsernameCache.getLastKnownUsername(ta.getPlacedBy()) + " "
|
||||
+ Lang.localize("gui.travelAccessable.privateBlock2")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,10 @@ public class ItemDarkSteelAxe extends ItemAxe implements IEnergyContainerItem, I
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) {
|
||||
return ItemDarkSteelPickaxe.doRightClickItemPlace(player, world, x, y, z, side, par8, par9, par10);
|
||||
if (world.isRemote) {
|
||||
return ItemDarkSteelPickaxe.doRightClickItemPlace(player, world, x, y, z, side, par8, par9, par10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void applyDamage(EntityLivingBase entity, ItemStack stack, int damage, boolean isMultiharvest) {
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
package crazypants.enderio.machine.attractor;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.glDepthMask;
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
import static org.lwjgl.opengl.GL11.glScalef;
|
||||
import static org.lwjgl.opengl.GL11.glTranslated;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -15,7 +8,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -38,6 +30,7 @@ import crazypants.render.VertexTransform;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
import crazypants.vecmath.Vertex;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class ObeliskRenderer<T extends TileEntity> extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
|
||||
|
||||
@@ -120,6 +113,8 @@ public class ObeliskRenderer<T extends TileEntity> extends TileEntitySpecialRend
|
||||
ei.hoverStart = (float) world.getTotalWorldTime() * 0.05f + (tick * 0.05f);
|
||||
|
||||
glPushMatrix();
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
glTranslated(x + 0.5, y + 0.7, z + 0.5);
|
||||
glScalef(1.1f, 1.1f, 1.1f);
|
||||
glDepthMask(true);
|
||||
@@ -134,6 +129,7 @@ public class ObeliskRenderer<T extends TileEntity> extends TileEntitySpecialRend
|
||||
}
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(ei, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
glPopAttrib();
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package crazypants.enderio.machine.transceiver;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.util.PlayerUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class ClientChannelRegister extends ChannelRegister {
|
||||
|
||||
public static final ChannelRegister instance = new ClientChannelRegister();
|
||||
|
||||
@@ -22,8 +22,7 @@ public class NetworkUtil {
|
||||
} else {
|
||||
byte[] buffer = new byte[size];
|
||||
dataIn.readBytes(buffer);
|
||||
// TODO I have no idea what I'm doing (byte = 8 bits = buffer.length * 8 ???)
|
||||
return CompressedStreamTools.func_152457_a(buffer, new NBTSizeTracker(buffer.length * 8));
|
||||
return CompressedStreamTools.func_152457_a(buffer, NBTSizeTracker.field_152451_a);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
FMLCommonHandler.instance().raiseException(e, "Custom Packet", true);
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
package crazypants.enderio.teleport.anchor;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.api.teleport.ITravelAccessable;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.teleport.ConnectionHandler;
|
||||
import crazypants.enderio.teleport.ContainerTravelAccessable;
|
||||
import crazypants.enderio.teleport.ContainerTravelAuth;
|
||||
import crazypants.enderio.teleport.GuiTravelAccessable;
|
||||
import crazypants.enderio.teleport.GuiTravelAuth;
|
||||
import crazypants.enderio.teleport.packet.PacketAccessMode;
|
||||
import crazypants.enderio.teleport.packet.PacketConfigSync;
|
||||
import crazypants.enderio.teleport.packet.PacketDrainStaff;
|
||||
import crazypants.enderio.teleport.packet.PacketLabel;
|
||||
import crazypants.enderio.teleport.packet.PacketOpenAuthGui;
|
||||
import crazypants.enderio.teleport.packet.PacketTravelEvent;
|
||||
import crazypants.enderio.teleport.telepad.TileTelePad;
|
||||
import crazypants.util.IFacade;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEntityProvider, IResourceTooltipProvider, IFacade {
|
||||
|
||||
public static int renderId = -1;
|
||||
|
||||
public static BlockTravelAnchor create() {
|
||||
|
||||
PacketHandler.INSTANCE.registerMessage(PacketAccessMode.class, PacketAccessMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketLabel.class, PacketLabel.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketTravelEvent.class, PacketTravelEvent.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketDrainStaff.class, PacketDrainStaff.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketOpenAuthGui.class, PacketOpenAuthGui.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketConfigSync.class, PacketConfigSync.class, PacketHandler.nextID(), Side.CLIENT);
|
||||
|
||||
ConnectionHandler ch = new ConnectionHandler();
|
||||
FMLCommonHandler.instance().bus().register(ch);
|
||||
|
||||
BlockTravelAnchor result = new BlockTravelAnchor();
|
||||
result.init();
|
||||
return result;
|
||||
}
|
||||
|
||||
IIcon selectedOverlayIcon;
|
||||
IIcon highlightOverlayIcon;
|
||||
|
||||
private BlockTravelAnchor() {
|
||||
super(ModObject.blockTravelAnchor.unlocalisedName, TileTravelAnchor.class);
|
||||
if(!Config.travelAnchorEnabled) {
|
||||
setCreativeTab(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected BlockTravelAnchor(String unlocalisedName, Class<TileTelePad> teClass) {
|
||||
super(unlocalisedName, teClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_TRAVEL_ACCESSABLE, this);
|
||||
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_TRAVEL_AUTH, this);
|
||||
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iIconRegister) {
|
||||
super.registerBlockIcons(iIconRegister);
|
||||
highlightOverlayIcon = iIconRegister.registerIcon("enderio:blockTravelAnchorHighlight");
|
||||
selectedOverlayIcon = iIconRegister.registerIcon("enderio:blockTravelAnchorSelected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
TileTravelAnchor tef = (TileTravelAnchor) te;
|
||||
if(tef.getSourceBlock() != null) {
|
||||
return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata());
|
||||
}
|
||||
}
|
||||
return super.getIcon(world, x, y, z, blockSide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileTravelAnchor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack par6ItemStack) {
|
||||
if(entity instanceof EntityPlayer) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
TileTravelAnchor ta = (TileTravelAnchor) te;
|
||||
ta.setPlacedBy((EntityPlayer) entity);
|
||||
Block b = PainterUtil.getSourceBlock(par6ItemStack);
|
||||
ta.setSourceBlock(b);
|
||||
ta.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(par6ItemStack));
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openGui(World world, int x, int y, int z, EntityPlayer entityPlayer, int side) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof ITravelAccessable) {
|
||||
ITravelAccessable ta = (ITravelAccessable) te;
|
||||
if(ta.canUiBeAccessed(entityPlayer)) {
|
||||
entityPlayer.openGui(EnderIO.instance, GuiHandler.GUI_ID_TRAVEL_ACCESSABLE, world, x, y, z);
|
||||
} else {
|
||||
if(world.isRemote && !entityPlayer.isSneaking()) {
|
||||
entityPlayer.addChatComponentMessage(new ChatComponentText(Lang.localize("gui.travelAccessable.privateBlock1") + " " + ta.getPlacedBy() + " "
|
||||
+ Lang.localize("gui.travelAccessable.privateBlock2")));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof ITravelAccessable) {
|
||||
if(ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) {
|
||||
return new ContainerTravelAccessable(player.inventory, (ITravelAccessable) te, world);
|
||||
} else {
|
||||
return new ContainerTravelAuth(player.inventory);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof ITravelAccessable) {
|
||||
if(ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) {
|
||||
return new GuiTravelAccessable(player.inventory, (ITravelAccessable) te, world);
|
||||
} else {
|
||||
return new GuiTravelAuth(player, (ITravelAccessable) te, world);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processDrop(World world, int x, int y, int z, TileEntityEio te, ItemStack drop) {
|
||||
TileTravelAnchor anchor = (TileTravelAnchor) te;
|
||||
|
||||
if(anchor == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
Block srcBlk = anchor.getSourceBlock();
|
||||
if(srcBlk != null) {
|
||||
itemStack = createItemStackForSourceBlock(anchor.getSourceBlock(), anchor.getSourceBlockMetadata());
|
||||
drop.stackTagCompound = (NBTTagCompound) itemStack.stackTagCompound.copy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doNormalDrops(World world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
TileTravelAnchor tef = (TileTravelAnchor) te;
|
||||
if(tef.getSourceBlock() != null) {
|
||||
return tef.getSourceBlock().colorMultiplier(world, x, y, z);
|
||||
}
|
||||
}
|
||||
return super.colorMultiplier(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedNameForTooltip(ItemStack itemStack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
public ItemStack createItemStackForSourceBlock(Block block, int damage) {
|
||||
if(block == this) {
|
||||
return new ItemStack(this);
|
||||
}
|
||||
ItemStack result = new ItemStack(this, 1, damage);
|
||||
PainterUtil.setSourceBlock(result, block, damage);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final class PainterTemplate extends BasicPainterTemplate {
|
||||
|
||||
public PainterTemplate() {
|
||||
super(BlockTravelAnchor.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) {
|
||||
ItemStack paintSource = MachineRecipeInput.getInputForSlot(1, inputs);
|
||||
if(paintSource == null) {
|
||||
return new ResultStack[0];
|
||||
}
|
||||
return new ResultStack[] { new ResultStack(createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage())) };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
return ((TileTravelAnchor) te).getSourceBlockMetadata();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getFacade(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
return ((TileTravelAnchor) te).getSourceBlock();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.api.teleport.ITravelAccessable;
|
||||
import crazypants.enderio.teleport.ContainerTravelAccessable;
|
||||
import crazypants.enderio.teleport.ContainerTravelAuth;
|
||||
import crazypants.enderio.teleport.GuiTravelAccessable;
|
||||
import crazypants.enderio.teleport.GuiTravelAuth;
|
||||
import crazypants.enderio.teleport.anchor.BlockTravelAnchor;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
@@ -157,7 +157,7 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
|
||||
// let's get rid of WAILA's default RF stuff, once that works
|
||||
// let's get rid of WAILA's default RF stuff, only supported on WAILA 1.5.9+
|
||||
((ITaggedList<String, String>) currenttip).removeEntries("RFEnergyStorage");
|
||||
|
||||
if(te instanceof IIoConfigurable && block == accessor.getBlock()) {
|
||||
@@ -204,7 +204,7 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
info.getWailaInfo(currenttip, player, world, pos.blockX, pos.blockY, pos.blockZ);
|
||||
}
|
||||
|
||||
else {
|
||||
else {
|
||||
if(block instanceof IAdvancedTooltipProvider) {
|
||||
TooltipAddera.addInformation((IAdvancedTooltipProvider) block, itemStack, player, currenttip, false);
|
||||
} else if(item instanceof IAdvancedTooltipProvider) {
|
||||
|
||||
Reference in new issue
Block a user