mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-27 23:46:10 +00:00
Chisel 1.5.3
This commit is contained in:
1 parent
1525907cdd
commit
48e0c168b6
20 files changed
+1301
-1839
No files matched your search
@@ -1,65 +0,0 @@
|
||||
package info.jbcs.minecraft.utilities;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class ContainerTileEntity<T extends TileEntity & IInventory> extends Container {
|
||||
public final IInventory playerInventory;
|
||||
public final T entity;
|
||||
public int playerSlotsCount;
|
||||
|
||||
public ContainerTileEntity(IInventory playerInv, T tileEntity,int startX,int startY) {
|
||||
playerInventory = playerInv;
|
||||
entity = tileEntity;
|
||||
|
||||
for (int k = 0; k < 3; k++) {
|
||||
for (int j1 = 0; j1 < 9; j1++) {
|
||||
addSlotToContainer(new Slot(playerInv, j1 + k * 9 + 9, startX + j1 * 18, startY + k * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < 9; l++) {
|
||||
addSlotToContainer(new Slot(playerInv, l, startX + l * 18, startY + 142-84));
|
||||
}
|
||||
|
||||
playerSlotsCount=inventorySlots.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return entity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer entityplayer, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(i);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (i < playerSlotsCount) {
|
||||
if (!mergeItemStack(itemstack1, playerSlotsCount, inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (!mergeItemStack(itemstack1, 0, playerSlotsCount, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package info.jbcs.minecraft.utilities;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class Infodata {
|
||||
public String name;
|
||||
|
||||
public Hashtable<String, String> fields = new Hashtable<String, String>();
|
||||
public String[] lines;
|
||||
|
||||
public Infodata(String n) {
|
||||
name = n;
|
||||
}
|
||||
|
||||
public Infodata(String n,int lineCount) {
|
||||
name = n;
|
||||
lines = new String[lineCount];
|
||||
}
|
||||
|
||||
public String field(String key,String dflt) {
|
||||
String n = key.toLowerCase();
|
||||
|
||||
if (fields.containsKey(n)) return fields.get(n);
|
||||
|
||||
return dflt;
|
||||
}
|
||||
|
||||
public String field(String key) {
|
||||
return field(key, null);
|
||||
}
|
||||
|
||||
public int value(String key) {
|
||||
return Integer.parseInt(field(key, null));
|
||||
}
|
||||
|
||||
public void set(String key,String value) {
|
||||
fields.put(key.length() == 1 ? key : key.toLowerCase(), value);
|
||||
}
|
||||
|
||||
public void set(String key,int value) {
|
||||
fields.put(key.length() == 1 ? key : key.toLowerCase(), "" + value);
|
||||
}
|
||||
|
||||
public void write(Writer writer,int linebreakEvery) throws IOException {
|
||||
writer.write(name + " {\n");
|
||||
|
||||
Enumeration<String> keys = fields.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = keys.nextElement();
|
||||
if (key.length() == 1) continue;
|
||||
|
||||
writer.write("\t" + key + " = " + fields.get(key) + "\n");
|
||||
}
|
||||
|
||||
writer.write("\n");
|
||||
int linesWritten = 0;
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
writer.write("\t" + lines[i] + "\n");
|
||||
linesWritten++;
|
||||
if (linebreakEvery != 0 && linesWritten % linebreakEvery == 0) writer.write("\n");
|
||||
}
|
||||
writer.write("\n");
|
||||
|
||||
keys = fields.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = keys.nextElement();
|
||||
if (key.length() != 1) continue;
|
||||
|
||||
writer.write("\t" + key + " = " + fields.get(key) + "\n");
|
||||
}
|
||||
writer.write("}");
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package info.jbcs.minecraft.utilities;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Infofile {
|
||||
static String[] stringArray=new String[0];
|
||||
public ArrayList<Infodata> data=new ArrayList<Infodata>();
|
||||
|
||||
public Infofile(File file) throws IOException {
|
||||
LineReader reader = new LineReader(file);
|
||||
String line;
|
||||
|
||||
Infodata d=null;
|
||||
ArrayList<String> lines=new ArrayList<String>();
|
||||
|
||||
int state = 0;
|
||||
|
||||
try{
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if((line=line.trim()).isEmpty()) continue;
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
if (line.charAt(line.length() - 1) != '{') {
|
||||
reader.die("unexpected: \""+line+"\" (expecting name and opening bracket)");
|
||||
}
|
||||
|
||||
|
||||
line=line.substring(0,line.length()-1).trim();
|
||||
state=1;
|
||||
|
||||
d=new Infodata(line);
|
||||
|
||||
lines.clear();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (line.equals("}")) {
|
||||
state=0;
|
||||
|
||||
d.lines=lines.toArray(stringArray);
|
||||
data.add(d);
|
||||
continue;
|
||||
}
|
||||
|
||||
int index=line.indexOf('=');
|
||||
if(index!=-1){
|
||||
String key=line.substring(0, index).trim().toLowerCase();
|
||||
String val=line.substring(index+1,line.length()).trim();
|
||||
|
||||
d.fields.put(key,val);
|
||||
} else{
|
||||
lines.add(line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} finally{
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
package info.jbcs.minecraft.utilities;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class InventoryStatic implements IInventory {
|
||||
public final ItemStack items[];
|
||||
|
||||
public InventoryStatic(int size) {
|
||||
items = new ItemStack[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onInventoryChanged(int slot) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return items.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return items[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (items[i] != null) {
|
||||
if (items[i].stackSize <= j) {
|
||||
ItemStack itemstack = items[i];
|
||||
items[i] = null;
|
||||
onInventoryChanged();
|
||||
onInventoryChanged(i);
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
ItemStack itemstack1 = items[i].splitStack(j);
|
||||
|
||||
if (items[i].stackSize == 0) {
|
||||
items[i] = null;
|
||||
}
|
||||
|
||||
onInventoryChanged();
|
||||
onInventoryChanged(i);
|
||||
return itemstack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
items[i] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
onInventoryChanged();
|
||||
onInventoryChanged(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", 10);
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.getCompoundTagAt(i);
|
||||
int j = nbttagcompound1.getByte("slot") & 0xff;
|
||||
|
||||
if (j >= 0 && j < items.length) {
|
||||
items[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
onInventoryChanged();
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i] == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("slot", (byte) i);
|
||||
items[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
|
||||
nbttagcompound.setTag("items", nbttaglist);
|
||||
}
|
||||
|
||||
private int getFirstEmptyStack(int start, int end) {
|
||||
for (int i = start; i <= end; i++) {
|
||||
if (items[i] == null) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int storeItemStack(ItemStack itemstack, int start, int end) {
|
||||
for (int i = start; i <= end; i++) {
|
||||
if (items[i] != null && items[i].getItem().equals(itemstack.getItem() )&& items[i].isStackable() && items[i].stackSize < items[i].getMaxStackSize() && items[i].stackSize < getInventoryStackLimit() && (!items[i].getHasSubtypes() || items[i].getItemDamage() == itemstack.getItemDamage())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int storePartialItemStack(ItemStack itemstack, int start, int end) {
|
||||
Item i = itemstack.getItem();
|
||||
int j = itemstack.stackSize;
|
||||
int k = storeItemStack(itemstack, start, end);
|
||||
|
||||
if (k < 0) {
|
||||
k = getFirstEmptyStack(start, end);
|
||||
}
|
||||
|
||||
if (k < 0) {
|
||||
return j;
|
||||
}
|
||||
|
||||
if (items[k] == null) {
|
||||
items[k] = new ItemStack(i, 0, itemstack.getItemDamage());
|
||||
}
|
||||
|
||||
int l = j;
|
||||
|
||||
if (l > items[k].getMaxStackSize() - items[k].stackSize) {
|
||||
l = items[k].getMaxStackSize() - items[k].stackSize;
|
||||
}
|
||||
|
||||
if (l > getInventoryStackLimit() - items[k].stackSize) {
|
||||
l = getInventoryStackLimit() - items[k].stackSize;
|
||||
}
|
||||
|
||||
if (l == 0) {
|
||||
return j;
|
||||
} else {
|
||||
j -= l;
|
||||
items[k].stackSize += l;
|
||||
items[k].animationsToGo = 5;
|
||||
onInventoryChanged();
|
||||
onInventoryChanged(k);
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addItemStackToInventory(ItemStack itemstack, int start, int end) {
|
||||
if (itemstack == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!itemstack.isItemDamaged()) {
|
||||
int i;
|
||||
|
||||
do {
|
||||
i = itemstack.stackSize;
|
||||
itemstack.stackSize = storePartialItemStack(itemstack, start, end);
|
||||
} while (itemstack.stackSize > 0 && itemstack.stackSize < i);
|
||||
|
||||
return itemstack.stackSize < i;
|
||||
}
|
||||
|
||||
int j = getFirstEmptyStack(start, end);
|
||||
|
||||
if (j >= 0) {
|
||||
items[j] = ItemStack.copyItemStack(itemstack);
|
||||
items[j].animationsToGo = 5;
|
||||
itemstack.stackSize = 0;
|
||||
onInventoryChanged();
|
||||
onInventoryChanged(j);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addItemStackToInventory(ItemStack itemstack) {
|
||||
return addItemStackToInventory(itemstack, 0, items.length - 1);
|
||||
}
|
||||
|
||||
public ItemStack takeItems(Item item, int damage, int count) {
|
||||
ItemStack res = null;
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i] == null || !items[i].getItem().equals(item) || items[i].getItemDamage() != damage) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (res == null) {
|
||||
res = new ItemStack(item, 0, damage);
|
||||
}
|
||||
|
||||
while (items[i] != null && res.stackSize < count && items[i].stackSize > 0) {
|
||||
res.stackSize++;
|
||||
items[i].stackSize--;
|
||||
|
||||
if (items[i].stackSize == 0) {
|
||||
items[i] = null;
|
||||
}
|
||||
|
||||
onInventoryChanged(i);
|
||||
}
|
||||
|
||||
if (res.stackSize >= count) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onInventoryChanged();
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onInventoryChanged() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i] != null && items[i].getItem() != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void throwItems(World world, int x, int y, int z){
|
||||
if(world.isRemote) return;
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
ItemStack itemstack = items[i];
|
||||
if (itemstack == null) continue;
|
||||
|
||||
items[i]=null;
|
||||
|
||||
float xx = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float yy = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float zz = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
while (itemstack.stackSize > 0) {
|
||||
int c = world.rand.nextInt(21) + 10;
|
||||
if (c > itemstack.stackSize) {
|
||||
c = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= c;
|
||||
EntityItem entityitem = new EntityItem(world, x + xx, y + yy, z + zz, new ItemStack(itemstack.getItem(), c, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) world.rand.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) world.rand.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) world.rand.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
onInventoryChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package info.jbcs.minecraft.utilities;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
public class LineReader extends BufferedReader {
|
||||
String filename;
|
||||
int line = 0;
|
||||
|
||||
public LineReader(File file) throws FileNotFoundException {
|
||||
super(new FileReader(file));
|
||||
|
||||
filename = file.getName();
|
||||
}
|
||||
|
||||
@Override public String readLine() {
|
||||
line++;
|
||||
|
||||
try {
|
||||
return super.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
String where(){
|
||||
return filename+", line "+line;
|
||||
}
|
||||
|
||||
public void die(String cause) throws IOException{
|
||||
throw new IOException(where()+": "+cause);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package info.jbcs.minecraft.utilities.packets;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class PacketData {
|
||||
ByteArrayOutputStream s = new ByteArrayOutputStream();
|
||||
byte packetIndex;
|
||||
|
||||
public abstract void data(DataOutputStream stream) throws IOException;
|
||||
|
||||
ByteArrayOutputStream getData() {
|
||||
DataOutputStream stream = new DataOutputStream(s);
|
||||
|
||||
try {
|
||||
stream.writeByte(packetIndex);
|
||||
data(stream);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
package info.jbcs.minecraft.utilities.packets;
|
||||
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.management.ServerConfigurationManager;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public abstract class PacketHandler implements Comparable {
|
||||
/*static ArrayList<PacketHandler> items = new ArrayList<PacketHandler>();
|
||||
|
||||
public static final String channel = "AUTO:Multi";
|
||||
public static final String channelDummy = "AUTO:-";
|
||||
|
||||
int index;
|
||||
Object mod;
|
||||
String name;
|
||||
|
||||
public PacketHandler(String n) {
|
||||
items.add(this);
|
||||
name = n;
|
||||
}
|
||||
|
||||
public void create() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object a) {
|
||||
return name.compareTo(((PacketHandler) a).name);
|
||||
}
|
||||
|
||||
public void sendToPlayer(EntityPlayerMP player,PacketData data) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() != Side.SERVER)
|
||||
return;
|
||||
|
||||
|
||||
data.packetIndex = (byte) index;
|
||||
ByteArrayOutputStream stream = data.getData();
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = channel;
|
||||
packet.data = stream.toByteArray();
|
||||
packet.length = stream.size();
|
||||
player.playerNetServerHandler.sendPacketToPlayer(packet);
|
||||
}
|
||||
|
||||
public void sendToPlayers(double posX,double posY,double posZ,int dimension,double distance,PacketData data) {
|
||||
ServerConfigurationManager mgr = MinecraftServer.getServer().getConfigurationManager();
|
||||
for (int j = 0; j < mgr.playerEntityList.size(); ++j) {
|
||||
EntityPlayerMP p = (EntityPlayerMP) mgr.playerEntityList.get(j);
|
||||
|
||||
if (p.dimension != dimension) continue;
|
||||
if (! General.isInRange(distance, p.posX, p.posY, p.posZ, posX, posY, posZ)) continue;
|
||||
|
||||
sendToPlayer(p,data);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendToServer(PacketData data) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
data.packetIndex = (byte) index;
|
||||
ByteArrayOutputStream stream = data.getData();
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = channel;
|
||||
packet.data = stream.toByteArray();
|
||||
packet.length = stream.size();
|
||||
PacketHandlerClient.send(packet);
|
||||
}
|
||||
|
||||
public static void register(Object mod) {
|
||||
Collections.sort(items);
|
||||
int index = 0;
|
||||
|
||||
for (PacketHandler h : items) {
|
||||
if(h.mod==null)
|
||||
h.mod = mod;
|
||||
h.index = index++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void onPacketData(INetworkManager manager, Packet250CustomPayload packet, EntityPlayer player) {
|
||||
if (!packet.channel.equals(channel))
|
||||
return;
|
||||
packet.channel=channelDummy;
|
||||
|
||||
|
||||
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
|
||||
|
||||
try {
|
||||
byte index = inputStream.readByte();
|
||||
|
||||
if (index >= items.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
items.get(index).onData(inputStream, player);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onData(DataInputStream stream, EntityPlayer player) throws IOException;
|
||||
*/
|
||||
}
|
||||
Reference in new issue
Block a user