mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 06:53:24 +00:00
Update to 1.7.10_pre4 (Forge 1138)
This commit is contained in:
1 parent
7647c57825
commit
21421910e3
24 files changed
+122
-115
No files matched your search
@@ -346,7 +346,7 @@ public class GuiEnderface extends GuiScreen {
|
||||
}
|
||||
|
||||
private boolean updateCamera(float partialTick) {
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int vpx = guiLeft * scaledresolution.getScaleFactor();
|
||||
int vpy = guiTop * scaledresolution.getScaleFactor();
|
||||
int vpw = (int) ((float) gw / width * mc.displayWidth);
|
||||
@@ -389,7 +389,7 @@ public class GuiEnderface extends GuiScreen {
|
||||
private float portalFade = 1;
|
||||
|
||||
private void drawEffectOverlay(float partialTick) {
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
|
||||
|
||||
@@ -264,7 +264,7 @@ public class IoConfigRenderer {
|
||||
|
||||
private void renderOverlay(int mx, int my) {
|
||||
Rectangle vp = camera.getViewport();
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
int vpx = vp.x / scaledresolution.getScaleFactor();
|
||||
int vph = vp.height / scaledresolution.getScaleFactor();
|
||||
|
||||
@@ -68,7 +68,7 @@ public class GuiOverlayIoConfig implements IGuiOverlay {
|
||||
|
||||
RenderUtil.renderQuad2D(bounds.x, bounds.y, 0, bounds.width, bounds.height, ColorUtil.getRGB(Color.black));
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
int vpx = ( (screen.getGuiLeft() + bounds.x)* scaledresolution.getScaleFactor());
|
||||
int vpy = (screen.getGuiTop() + 4) * scaledresolution.getScaleFactor();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package crazypants.enderio.machine.farm;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -17,8 +19,10 @@ import com.mojang.authlib.GameProfile;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class FakeFarmPlayer extends EntityPlayerMP {
|
||||
|
||||
private static GameProfile DUMMY_PROFILE = new GameProfile("EioFarmerID", "[EioFarmer]");
|
||||
|
||||
private static final UUID uuid = UUID.fromString("c1ddfd7f-120a-4437-8b64-38660d3ec62d");
|
||||
|
||||
private static GameProfile DUMMY_PROFILE = new GameProfile(uuid, "[EioFarmer]");
|
||||
|
||||
public FakeFarmPlayer(WorldServer world) {
|
||||
super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, DUMMY_PROFILE, new ItemInWorldManager(world));
|
||||
|
||||
@@ -3,6 +3,7 @@ package crazypants.enderio.machine.hypercube;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -158,7 +159,7 @@ public class BlockHyperCube extends BlockEio implements IGuiHandler, IResourceTo
|
||||
tag.setString("channelName", chan.name);
|
||||
tag.setBoolean("channelIsPublic", chan.isPublic());
|
||||
if(!chan.isPublic()) {
|
||||
tag.setString("channelUser", chan.user);
|
||||
tag.setString("channelUser", chan.user.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,9 +198,9 @@ public class BlockHyperCube extends BlockEio implements IGuiHandler, IResourceTo
|
||||
return null;
|
||||
}
|
||||
|
||||
String user = null;
|
||||
UUID user = null;
|
||||
if(!tag.getBoolean("channelIsPublic")) {
|
||||
user = tag.getString("channelUser");
|
||||
user = UUID.fromString(tag.getString("channelUser"));
|
||||
}
|
||||
return new Channel(channelName, user);
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package crazypants.enderio.machine.hypercube;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Channel {
|
||||
|
||||
final String name;
|
||||
final String user;
|
||||
final UUID user;
|
||||
|
||||
Channel(String name, String user) {
|
||||
Channel(String name, UUID uuid) {
|
||||
this.name = trim(name);
|
||||
this.user = trim(user);
|
||||
this.user = uuid;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class HyperCubeConfig {
|
||||
|
||||
private final List<Channel> publicChannels = new ArrayList<Channel>();
|
||||
|
||||
private final Map<String, List<Channel>> userChannels = new HashMap<String, List<Channel>>();
|
||||
private final Map<UUID, List<Channel>> userChannels = new HashMap<UUID, List<Channel>>();
|
||||
|
||||
private final File file;
|
||||
|
||||
@@ -52,11 +53,11 @@ public class HyperCubeConfig {
|
||||
publicChannels.addAll(chans);
|
||||
}
|
||||
|
||||
public Map<String, List<Channel>> getUserChannels() {
|
||||
public Map<UUID, List<Channel>> getUserChannels() {
|
||||
return userChannels;
|
||||
}
|
||||
|
||||
public void setUserChannels(Map<String, List<Channel>> channels) {
|
||||
public void setUserChannels(Map<UUID, List<Channel>> channels) {
|
||||
userChannels.clear();
|
||||
userChannels.putAll(channels);
|
||||
}
|
||||
@@ -67,16 +68,14 @@ public class HyperCubeConfig {
|
||||
setChannelListProperty(KEY_PUBLIC_CHANNELS, publicChannels);
|
||||
|
||||
StringBuilder userListStr = new StringBuilder();
|
||||
Iterator<Entry<String, List<Channel>>> itr = userChannels.entrySet().iterator();
|
||||
Iterator<Entry<UUID, List<Channel>>> itr = userChannels.entrySet().iterator();
|
||||
while (itr.hasNext()) {
|
||||
Entry<String, List<Channel>> entry = itr.next();
|
||||
String user = entry.getKey();
|
||||
if(user != null) {
|
||||
user = user.trim();
|
||||
}
|
||||
Entry<UUID, List<Channel>> entry = itr.next();
|
||||
UUID user = entry.getKey();
|
||||
|
||||
List<Channel> channels = entry.getValue();
|
||||
if(user != null && channels != null && !channels.isEmpty()) {
|
||||
userListStr.append(user);
|
||||
userListStr.append(user.toString());
|
||||
setChannelListProperty(user + KEY_USER_CHANNEL, channels);
|
||||
}
|
||||
if(itr.hasNext()) {
|
||||
@@ -135,18 +134,15 @@ public class HyperCubeConfig {
|
||||
loadChannelList(KEY_PUBLIC_CHANNELS, null, publicChannels);
|
||||
|
||||
userChannels.clear();
|
||||
List<String> users = new ArrayList<String>();
|
||||
List<UUID> users = new ArrayList<UUID>();
|
||||
String usersStr = props.getProperty(KEY_USERS, "");
|
||||
String[] usersSplit = usersStr.split(DELIM);
|
||||
for (String user : usersSplit) {
|
||||
if(user != null) {
|
||||
user = user.trim();
|
||||
if(!user.isEmpty()) {
|
||||
users.add(user);
|
||||
}
|
||||
users.add(UUID.fromString(user));
|
||||
}
|
||||
}
|
||||
for (String user : users) {
|
||||
for (UUID user : users) {
|
||||
List<Channel> channels = new ArrayList<Channel>();
|
||||
loadChannelList(user + KEY_USER_CHANNEL, user, channels);
|
||||
if(!channels.isEmpty()) {
|
||||
@@ -156,7 +152,7 @@ public class HyperCubeConfig {
|
||||
|
||||
}
|
||||
|
||||
private void loadChannelList(String key, String user, List<Channel> channels) {
|
||||
private void loadChannelList(String key, UUID user, List<Channel> channels) {
|
||||
String chans = props.getProperty(key, "");
|
||||
//chans = chans.replaceAll(DELIM_ESC, DELIM);
|
||||
String[] chanSplit = chans.split(DELIM);
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import crazypants.enderio.Log;
|
||||
@@ -23,7 +24,7 @@ public class HyperCubeRegister {
|
||||
private final List<Channel> publicChannels = new ArrayList<Channel>();
|
||||
private final List<Channel> publicChannelsRO = Collections.unmodifiableList(publicChannels);
|
||||
|
||||
private final Map<String, List<Channel>> userChannels = new HashMap<String, List<Channel>>();
|
||||
private final Map<UUID, List<Channel>> userChannels = new HashMap<UUID, List<Channel>>();
|
||||
|
||||
//private Configuration config;
|
||||
private HyperCubeConfig conf;
|
||||
@@ -44,7 +45,7 @@ public class HyperCubeRegister {
|
||||
userChannels.putAll(conf.getUserChannels());
|
||||
}
|
||||
|
||||
public synchronized List<Channel> getChannelsForUser(String user) {
|
||||
public synchronized List<Channel> getChannelsForUser(UUID user) {
|
||||
List<Channel> result = userChannels.get(user);
|
||||
if(result == null) {
|
||||
result = new ArrayList<Channel>();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package crazypants.enderio.machine.hypercube;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
@@ -28,7 +30,7 @@ public class PacketAddRemoveChannel implements IMessage, IMessageHandler<PacketA
|
||||
buf.writeBoolean(channel.isPublic());
|
||||
ByteBufUtils.writeUTF8String(buf, channel.name);
|
||||
if(!channel.isPublic()) {
|
||||
ByteBufUtils.writeUTF8String(buf, channel.user);
|
||||
ByteBufUtils.writeUTF8String(buf, channel.user.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +44,7 @@ public class PacketAddRemoveChannel implements IMessage, IMessageHandler<PacketA
|
||||
if(!isPublic) {
|
||||
user = ByteBufUtils.readUTF8String(data);
|
||||
}
|
||||
channel = new Channel(name, user);
|
||||
channel = new Channel(name, user == null ? null : UUID.fromString(user));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
@@ -15,7 +16,7 @@ public class PacketChannelList implements IMessage, IMessageHandler<PacketChanne
|
||||
|
||||
private boolean isPrivate;
|
||||
private List<Channel> channels;
|
||||
private String userId;
|
||||
private UUID userId;
|
||||
|
||||
public PacketChannelList() {
|
||||
}
|
||||
@@ -24,16 +25,16 @@ public class PacketChannelList implements IMessage, IMessageHandler<PacketChanne
|
||||
this(player.getGameProfile().getId(), isPrivate);
|
||||
}
|
||||
|
||||
public PacketChannelList(String userId, boolean isPrivate) {
|
||||
this.userId = userId;
|
||||
public PacketChannelList(UUID uuid, boolean isPrivate) {
|
||||
this.userId = uuid;
|
||||
this.isPrivate = isPrivate;
|
||||
if(isPrivate && userId == null || userId.trim().length() == 0) {
|
||||
if(isPrivate && uuid == null) {
|
||||
throw new RuntimeException("Null user ID.");
|
||||
}
|
||||
|
||||
List<Channel> res;
|
||||
if(isPrivate) {
|
||||
res = HyperCubeRegister.instance.getChannelsForUser(userId);
|
||||
res = HyperCubeRegister.instance.getChannelsForUser(uuid);
|
||||
} else {
|
||||
res = HyperCubeRegister.instance.getPublicChannels();
|
||||
}
|
||||
@@ -49,7 +50,7 @@ public class PacketChannelList implements IMessage, IMessageHandler<PacketChanne
|
||||
public void toBytes(ByteBuf buffer) {
|
||||
buffer.writeBoolean(isPrivate);
|
||||
if(isPrivate) {
|
||||
ByteBufUtils.writeUTF8String(buffer, userId);
|
||||
ByteBufUtils.writeUTF8String(buffer, userId.toString());
|
||||
}
|
||||
buffer.writeInt(channels.size());
|
||||
for (Channel channel : channels) {
|
||||
@@ -62,7 +63,7 @@ public class PacketChannelList implements IMessage, IMessageHandler<PacketChanne
|
||||
public void fromBytes(ByteBuf buffer) {
|
||||
isPrivate = buffer.readBoolean();
|
||||
if(isPrivate) {
|
||||
userId = ByteBufUtils.readUTF8String(buffer);
|
||||
userId = UUID.fromString(ByteBufUtils.readUTF8String(buffer));
|
||||
} else {
|
||||
userId = null;
|
||||
}
|
||||
@@ -71,7 +72,6 @@ public class PacketChannelList implements IMessage, IMessageHandler<PacketChanne
|
||||
for (int i = 0; i < numChannels; i++) {
|
||||
channels.add(new Channel(ByteBufUtils.readUTF8String(buffer), userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -50,7 +51,7 @@ public class PacketClientState implements IMessage, IMessageHandler<PacketClient
|
||||
if(selectedChannel.isPublic()) {
|
||||
ByteBufUtils.writeUTF8String(buf, "");
|
||||
} else {
|
||||
ByteBufUtils.writeUTF8String(buf, selectedChannel.user);
|
||||
ByteBufUtils.writeUTF8String(buf, selectedChannel.user.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ public class PacketClientState implements IMessage, IMessageHandler<PacketClient
|
||||
selectedChannel = null;
|
||||
if(name != null && name.trim().length() > 0) {
|
||||
if(user != null && user.trim().length() > 0) {
|
||||
selectedChannel = new Channel(name, user);
|
||||
selectedChannel = new Channel(name, UUID.fromString(user));
|
||||
} else {
|
||||
selectedChannel = new Channel(name, null);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -34,6 +35,7 @@ import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.ItemUtil;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.util.Util;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
|
||||
public class TileHyperCube extends TileEntityEio implements IInternalPowerReceptor, IFluidHandler, ISidedInventory, IRedstoneModeControlable {
|
||||
@@ -120,7 +122,7 @@ public class TileHyperCube extends TileEntityEio implements IInternalPowerRecept
|
||||
|
||||
private Channel channel = null;
|
||||
private Channel registeredChannel = null;
|
||||
private String owner;
|
||||
private UUID owner;
|
||||
|
||||
private boolean init = true;
|
||||
|
||||
@@ -184,7 +186,7 @@ public class TileHyperCube extends TileEntityEio implements IInternalPowerRecept
|
||||
HyperCubeRegister.instance.register(this);
|
||||
}
|
||||
|
||||
public void setOwner(String owner) {
|
||||
public void setOwner(UUID owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@@ -839,12 +841,12 @@ public class TileHyperCube extends TileEntityEio implements IInternalPowerRecept
|
||||
String channelName = nbtRoot.getString("channelName");
|
||||
String channelUser = nbtRoot.getString("channelUser");
|
||||
if(channelName != null && !channelName.isEmpty()) {
|
||||
channel = new Channel(channelName, channelUser == null || channelUser.isEmpty() ? null : channelUser);
|
||||
channel = new Channel(channelName, channelUser == null || channelUser.isEmpty() ? null : UUID.fromString(channelUser));
|
||||
} else {
|
||||
channel = null;
|
||||
}
|
||||
|
||||
owner = nbtRoot.getString("owner");
|
||||
owner = UUID.fromString(nbtRoot.getString("owner"));
|
||||
|
||||
for (SubChannel subChannel : SubChannel.values()) {
|
||||
String key = "subChannel" + subChannel.ordinal();
|
||||
@@ -868,11 +870,11 @@ public class TileHyperCube extends TileEntityEio implements IInternalPowerRecept
|
||||
if(channel != null) {
|
||||
nbtRoot.setString("channelName", channel.name);
|
||||
if(channel.user != null) {
|
||||
nbtRoot.setString("channelUser", channel.user);
|
||||
nbtRoot.setString("channelUser", channel.user.toString());
|
||||
}
|
||||
}
|
||||
if(owner != null && !(owner.isEmpty())) {
|
||||
nbtRoot.setString("owner", owner);
|
||||
if(owner != null) {
|
||||
nbtRoot.setString("owner", owner.toString());
|
||||
}
|
||||
|
||||
for (SubChannel subChannel : SubChannel.values()) {
|
||||
|
||||
@@ -355,7 +355,7 @@ public class BlockCapacitorBank extends BlockEio implements IGuiHandler, IAdvanc
|
||||
min.z = Math.min(min.z, bc.z);
|
||||
max.z = Math.max(max.z, bc.z + 1);
|
||||
}
|
||||
return AxisAlignedBB.getAABBPool().getAABB(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
return AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -162,7 +162,7 @@ public class BlockReservoir extends BlockContainer implements IResourceTooltipPr
|
||||
min.z = Math.min(min.z, bc.z);
|
||||
max.z = Math.max(max.z, bc.z + 1);
|
||||
}
|
||||
return AxisAlignedBB.getAABBPool().getAABB(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
return AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package crazypants.enderio.machine.spawner;
|
||||
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -27,9 +26,9 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
public static final float POWER_PER_TICK_THREE = Config.poweredSpawnerLevelThreePowerPerTick;
|
||||
public static final int MIN_PLAYER_DISTANCE = Config.poweredSpawnerMaxPlayerDistance;
|
||||
public static final boolean USE_VANILLA_SPAWN_CHECKS = Config.poweredSpawnerUseVanillaSpawChecks;
|
||||
|
||||
|
||||
private final MobSpawnerBaseLogic logic = new SpawnerLogic();
|
||||
|
||||
|
||||
private static final String NULL_ENTITY_NAME = "None";
|
||||
|
||||
public TilePoweredSpawner() {
|
||||
@@ -42,7 +41,7 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
@Override
|
||||
protected void taskComplete() {
|
||||
super.taskComplete();
|
||||
logic.spawnDelay = 0;
|
||||
logic.spawnDelay = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,8 +73,8 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
return POWER_PER_TICK_ONE;
|
||||
} else if(capacitorType.ordinal() == 1) {
|
||||
return POWER_PER_TICK_TWO;
|
||||
}
|
||||
return POWER_PER_TICK_THREE;
|
||||
}
|
||||
return POWER_PER_TICK_THREE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,19 +83,19 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canInsertResult(float chance, IMachineRecipe nextRecipe) {
|
||||
protected boolean canInsertResult(float chance, IMachineRecipe nextRecipe) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound nbtRoot) {
|
||||
super.readCustomNBT(nbtRoot);
|
||||
logic.readFromNBT(nbtRoot);
|
||||
super.readCustomNBT(nbtRoot);
|
||||
logic.readFromNBT(nbtRoot);
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeCustomNBT(nbtRoot);
|
||||
logic.writeToNBT(nbtRoot);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,12 +116,12 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, null);
|
||||
} else {
|
||||
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, mobType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEntity() {
|
||||
logic.updateSpawner();
|
||||
super.updateEntity();
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,23 +131,25 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) {
|
||||
return logic.setDelayToMin(p_145842_1_) ? true : super.receiveClientEvent(p_145842_1_, p_145842_2_);
|
||||
}
|
||||
|
||||
|
||||
protected IPoweredTask createTask(IMachineRecipe nextRecipe, float chance) {
|
||||
PoweredTask res = new PoweredTask(nextRecipe, chance, getInputs());
|
||||
|
||||
int ticksDelay = TilePoweredSpawner.MIN_SPAWN_DELAY_BASE + (int)Math.round((TilePoweredSpawner.MAX_SPAWN_DELAY_BASE - TilePoweredSpawner.MIN_SPAWN_DELAY_BASE) * Math.random());
|
||||
|
||||
int ticksDelay = TilePoweredSpawner.MIN_SPAWN_DELAY_BASE
|
||||
+ (int) Math.round((TilePoweredSpawner.MAX_SPAWN_DELAY_BASE - TilePoweredSpawner.MIN_SPAWN_DELAY_BASE) * Math.random());
|
||||
if(capacitorType.ordinal() == 1) {
|
||||
ticksDelay /= 2;
|
||||
} else if(capacitorType.ordinal() == 2) {
|
||||
ticksDelay /= 4;
|
||||
}
|
||||
int powerPerTick = (int)getPowerUsePerTick();
|
||||
res.setRequiredEnergy(powerPerTick * ticksDelay);
|
||||
int powerPerTick = (int) getPowerUsePerTick();
|
||||
res.setRequiredEnergy(powerPerTick * ticksDelay);
|
||||
return res;
|
||||
}
|
||||
|
||||
protected boolean canSpawnEntity(EntityLiving entityliving) {
|
||||
boolean spaceClear = worldObj.checkNoEntityCollision(entityliving.boundingBox) && worldObj.getCollidingBoundingBoxes(entityliving, entityliving.boundingBox).isEmpty() && !worldObj.isAnyLiquid(entityliving.boundingBox);
|
||||
|
||||
protected boolean canSpawnEntity(EntityLiving entityliving) {
|
||||
boolean spaceClear = worldObj.checkNoEntityCollision(entityliving.boundingBox)
|
||||
&& worldObj.getCollidingBoundingBoxes(entityliving, entityliving.boundingBox).isEmpty() && !worldObj.isAnyLiquid(entityliving.boundingBox);
|
||||
if(spaceClear && USE_VANILLA_SPAWN_CHECKS) {
|
||||
//Full checks for lighting, dimension etc
|
||||
spaceClear = entityliving.getCanSpawnHere();
|
||||
@@ -158,10 +159,10 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
|
||||
class SpawnerLogic extends MobSpawnerBaseLogic {
|
||||
|
||||
private int spawnCount = 4;
|
||||
private int spawnCount = 4;
|
||||
private int maxNearbyEntities = 6;
|
||||
private int spawnRange = 4;
|
||||
|
||||
|
||||
public void func_98267_a(int par1) {
|
||||
worldObj.addBlockEvent(xCoord, yCoord, zCoord, EnderIO.blockPoweredSpawner, par1, 0);
|
||||
}
|
||||
@@ -196,16 +197,17 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
public boolean isActivated() {
|
||||
if(MIN_PLAYER_DISTANCE > 0) {
|
||||
//TODO: Add this to main 'hasPower' like check so turn of the machine if the player is out of range?
|
||||
boolean playerInRange = worldObj.getClosestPlayer((double)getSpawnerX() + 0.5D, (double)getSpawnerY() + 0.5D, (double)getSpawnerZ() + 0.5D, (double)MIN_PLAYER_DISTANCE) != null;
|
||||
boolean playerInRange = worldObj.getClosestPlayer((double) getSpawnerX() + 0.5D, (double) getSpawnerY() + 0.5D, (double) getSpawnerZ() + 0.5D,
|
||||
(double) MIN_PLAYER_DISTANCE) != null;
|
||||
if(!playerInRange) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return isActive();
|
||||
return isActive();
|
||||
}
|
||||
|
||||
public void updateSpawner() {
|
||||
|
||||
|
||||
if(isActivated()) {
|
||||
double d2;
|
||||
|
||||
@@ -224,7 +226,7 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
field_98284_d = field_98287_c;
|
||||
field_98287_c = (field_98287_c + (double) (1000.0F / ((float) spawnDelay + 200.0F))) % 360.0D;
|
||||
} else {
|
||||
|
||||
|
||||
if(spawnDelay == -1) {
|
||||
resetTimer();
|
||||
}
|
||||
@@ -236,7 +238,7 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
boolean doTimerReset = false;
|
||||
|
||||
for (int i = 0; i < spawnCount; ++i) {
|
||||
|
||||
|
||||
Entity entity = EntityList.createEntityByName(getEntityNameToSpawn(), getSpawnerWorld());
|
||||
|
||||
if(entity == null) {
|
||||
@@ -245,10 +247,8 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
|
||||
int j = getSpawnerWorld().getEntitiesWithinAABB(
|
||||
entity.getClass(),
|
||||
AxisAlignedBB
|
||||
.getAABBPool()
|
||||
.getAABB((double) getSpawnerX(), (double) getSpawnerY(), (double) getSpawnerZ(), (double) (getSpawnerX() + 1),
|
||||
(double) (getSpawnerY() + 1), (double) (getSpawnerZ() + 1)).expand((double) (spawnRange * 2), 4.0D, (double) (spawnRange * 2))).size();
|
||||
AxisAlignedBB.getBoundingBox((double) getSpawnerX(), (double) getSpawnerY(), (double) getSpawnerZ(), (double) (getSpawnerX() + 1),
|
||||
(double) (getSpawnerY() + 1), (double) (getSpawnerZ() + 1)).expand((double) (spawnRange * 2), 4.0D, (double) (spawnRange * 2))).size();
|
||||
|
||||
if(j >= maxNearbyEntities) {
|
||||
resetTimer();
|
||||
@@ -282,7 +282,7 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
|
||||
}
|
||||
|
||||
void resetTimer() {
|
||||
spawnDelay = Integer.MAX_VALUE;
|
||||
spawnDelay = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTSizeTracker;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
@@ -21,7 +22,8 @@ public class NetworkUtil {
|
||||
} else {
|
||||
byte[] buffer = new byte[size];
|
||||
dataIn.readBytes(buffer);
|
||||
return CompressedStreamTools.decompress(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));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
FMLCommonHandler.instance().raiseException(e, "Custom Packet", true);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio.teleport;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -21,7 +22,7 @@ public class GuiTravelAuth extends GuiContainerBase {
|
||||
|
||||
private final String title;
|
||||
private final ITravelAccessable ta;
|
||||
private final String username;
|
||||
private final UUID username;
|
||||
private boolean failed = false;
|
||||
private final EntityPlayer player;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package crazypants.enderio.teleport;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import crazypants.enderio.teleport.TileTravelAnchor.AccessMode;
|
||||
@@ -29,7 +31,7 @@ public interface ITravelAccessable {
|
||||
|
||||
void setItemLabel(ItemStack lableIcon);
|
||||
|
||||
String getPlacedBy();
|
||||
UUID getPlacedBy();
|
||||
|
||||
// void setPlacedBy(String placedBy);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package crazypants.enderio.teleport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -28,9 +29,9 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
|
||||
private ItemStack itemLabel;
|
||||
|
||||
private String placedBy;
|
||||
private UUID placedBy;
|
||||
|
||||
private List<String> authorisedUsers = new ArrayList<String>();
|
||||
private List<UUID> authorisedUsers = new ArrayList<UUID>();
|
||||
|
||||
@Override
|
||||
public boolean canBlockBeAccessed(EntityPlayer playerName) {
|
||||
@@ -131,7 +132,7 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlacedBy() {
|
||||
public UUID getPlacedBy() {
|
||||
return placedBy;
|
||||
}
|
||||
|
||||
@@ -165,10 +166,10 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
if(root.hasKey("accessMode")) {
|
||||
accessMode = AccessMode.values()[root.getShort("accessMode")];
|
||||
} else {
|
||||
//keep behaviour the same for blocks placed prior to this update
|
||||
//keep behavior the same for blocks placed prior to this update
|
||||
accessMode = AccessMode.PUBLIC;
|
||||
}
|
||||
placedBy = root.getString("placedBy");
|
||||
placedBy = UUID.fromString(root.getString("placedBy"));
|
||||
for (int i = 0; i < password.length; i++) {
|
||||
if(root.hasKey("password" + i)) {
|
||||
NBTTagCompound stackRoot = (NBTTagCompound) root.getTag("password" + i);
|
||||
@@ -185,7 +186,7 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
if(user != null) {
|
||||
user = user.trim();
|
||||
if(user.length() > 0) {
|
||||
authorisedUsers.add(user);
|
||||
authorisedUsers.add(UUID.fromString(user));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,8 +203,8 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
@Override
|
||||
protected void writeCustomNBT(NBTTagCompound root) {
|
||||
root.setShort("accessMode", (short) accessMode.ordinal());
|
||||
if(placedBy != null && placedBy.trim().length() > 0) {
|
||||
root.setString("placedBy", placedBy);
|
||||
if(placedBy != null) {
|
||||
root.setString("placedBy", placedBy.toString());
|
||||
}
|
||||
for (int i = 0; i < password.length; i++) {
|
||||
ItemStack stack = password[i];
|
||||
@@ -214,9 +215,9 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
}
|
||||
}
|
||||
StringBuffer userStr = new StringBuffer();
|
||||
for (String user : authorisedUsers) {
|
||||
if(user != null && user.trim().length() > 0) {
|
||||
userStr.append(user);
|
||||
for (UUID user : authorisedUsers) {
|
||||
if(user != null) {
|
||||
userStr.append(user.toString());
|
||||
userStr.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public abstract class GuiScrollableList<T> {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
|
||||
ScaledResolution sr = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int sx = minX * sr.getScaleFactor();
|
||||
int sw = width * sr.getScaleFactor();
|
||||
int sy = mc.displayHeight - (maxY * sr.getScaleFactor());
|
||||
|
||||
@@ -21,7 +21,7 @@ public class IconToggleButton extends IconButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHoverState(boolean par1) {
|
||||
public int getHoverState(boolean par1) {
|
||||
int result = 1;
|
||||
if(!enabled || selected) {
|
||||
result = 0;
|
||||
@@ -30,5 +30,4 @@ public class IconToggleButton extends IconButton {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package crazypants.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3Pool;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -32,11 +31,6 @@ public class IBlockAccessWrapper implements IBlockAccess {
|
||||
return wrapped.isAirBlock(var1, var2, var3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3Pool getWorldVec3Pool() {
|
||||
return wrapped.getWorldVec3Pool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(int var1, int var2, int var3) {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package crazypants.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -15,6 +16,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
@@ -38,7 +40,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static ItemStack consumeItem(ItemStack stack) {
|
||||
if (stack.getItem() instanceof ItemPotion) {
|
||||
if(stack.getItem() instanceof ItemPotion) {
|
||||
if(stack.stackSize == 1) {
|
||||
return new ItemStack(Items.glass_bottle);
|
||||
} else {
|
||||
@@ -76,11 +78,11 @@ public class Util {
|
||||
|
||||
// derived from ItemBlock.onItemUse
|
||||
public static BlockCoord canPlaceItem(ItemStack itemUsed, Block blockIdToBePlaced, EntityPlayer player, World world, int x, int y, int z, int side) {
|
||||
|
||||
|
||||
if(blockIdToBePlaced == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if(block == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 7) < 1) {
|
||||
@@ -289,19 +291,16 @@ public class Util {
|
||||
|
||||
public static boolean isEquipped(EntityPlayer player, Class<? extends Item> class1) {
|
||||
if(player == null || player.inventory == null || player.inventory.getCurrentItem() == null) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
//player.inventory.getCurrentItem().getClass().getItem().isAssignableFrom(class1)
|
||||
return class1.isAssignableFrom(player.inventory.getCurrentItem().getItem().getClass());
|
||||
}
|
||||
|
||||
|
||||
public static boolean isType(ItemStack stack, Class<? extends Item> class1) {
|
||||
if(stack == null || class1 == null) {
|
||||
return false;
|
||||
}
|
||||
return class1.isAssignableFrom(stack.getItem().getClass());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user