Lots of compound fixes

This commit is contained in:
Michael Hillcox 2020-09-21 18:59:08 +01:00
parent 497b742b87
commit 26b021a5e9
No known key found for this signature in database
GPG key ID: 971C5B254742488F
7 changed files with 136 additions and 143 deletions

View file

@ -18,7 +18,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.OnlyIn;
public class BookletPage implements IBookletPage {
@ -60,7 +60,7 @@ public class BookletPage implements IBookletPage {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public String getInfoText() {
if (this.hasNoText) { return null; }
@ -78,55 +78,55 @@ public class BookletPage implements IBookletPage {
return base;
}
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
protected String getLocalizationKey() {
return "booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void actionPerformed(GuiBookletBase gui, GuiButton button) {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void initGui(GuiBookletBase gui, int startX, int startY) {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
}
@Override
@SideOnly(Side.CLIENT)
@OnlyIn(Side.CLIENT)
public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
}

View file

@ -8,16 +8,16 @@ import java.util.concurrent.ConcurrentHashMap;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public final class PlayerData {
public static PlayerSave getDataFromPlayer(EntityPlayer player) {
public static PlayerSave getDataFromPlayer(PlayerEntity player) {
WorldData worldData = WorldData.get(player.getEntityWorld());
ConcurrentHashMap<UUID, PlayerSave> data = worldData.playerSaveData;
UUID id = player.getUniqueID();
@ -47,24 +47,24 @@ public final class PlayerData {
public IBookletPage[] bookmarks = new IBookletPage[12];
public List<String> completedTrials = new ArrayList<>();
@SideOnly(Side.CLIENT)
@OnlyIn(Dist.CLIENT)
public GuiBooklet lastOpenBooklet;
public PlayerSave(UUID id) {
this.id = id;
}
public void readFromNBT(NBTTagCompound compound, boolean savingToFile) {
public void readFromNBT(CompoundNBT compound, boolean savingToFile) {
this.bookGottenAlready = compound.getBoolean("BookGotten");
this.didBookTutorial = compound.getBoolean("DidTutorial");
this.hasBatWings = compound.getBoolean("HasBatWings");
this.batWingsFlyTime = compound.getInteger("BatWingsFlyTime");
this.batWingsFlyTime = compound.getInt("BatWingsFlyTime");
NBTTagList bookmarks = compound.getTagList("Bookmarks", 8);
ListNBT bookmarks = compound.getList("Bookmarks", 8);
this.loadBookmarks(bookmarks);
NBTTagList trials = compound.getTagList("Trials", 8);
ListNBT trials = compound.getList("Trials", 8);
this.loadTrials(trials);
if (!savingToFile) {
@ -72,33 +72,33 @@ public final class PlayerData {
}
}
public void writeToNBT(NBTTagCompound compound, boolean savingToFile) {
compound.setBoolean("BookGotten", this.bookGottenAlready);
compound.setBoolean("DidTutorial", this.didBookTutorial);
public void writeToNBT(CompoundNBT compound, boolean savingToFile) {
compound.putBoolean("BookGotten", this.bookGottenAlready);
compound.putBoolean("DidTutorial", this.didBookTutorial);
compound.setBoolean("HasBatWings", this.hasBatWings);
compound.setInteger("BatWingsFlyTime", this.batWingsFlyTime);
compound.putBoolean("HasBatWings", this.hasBatWings);
compound.putInt("BatWingsFlyTime", this.batWingsFlyTime);
compound.setTag("Bookmarks", this.saveBookmarks());
compound.setTag("Trials", this.saveTrials());
compound.put("Bookmarks", this.saveBookmarks());
compound.put("Trials", this.saveTrials());
if (!savingToFile) {
compound.setBoolean("ShouldDisableWings", this.shouldDisableBatWings);
compound.putBoolean("ShouldDisableWings", this.shouldDisableBatWings);
}
}
public NBTTagList saveBookmarks() {
NBTTagList bookmarks = new NBTTagList();
public ListNBT saveBookmarks() {
ListNBT bookmarks = new ListNBT();
for (IBookletPage bookmark : this.bookmarks) {
bookmarks.appendTag(new NBTTagString(bookmark == null ? "" : bookmark.getIdentifier()));
bookmarks.add(StringNBT.valueOf(bookmark == null ? "" : bookmark.getIdentifier()));
}
return bookmarks;
}
public void loadBookmarks(NBTTagList bookmarks) {
for (int i = 0; i < bookmarks.tagCount(); i++) {
String strg = bookmarks.getStringTagAt(i);
if (strg != null && !strg.isEmpty()) {
public void loadBookmarks(ListNBT bookmarks) {
for (int i = 0; i < bookmarks.size(); i++) {
String strg = bookmarks.getString(i);
if (!strg.isEmpty()) {
IBookletPage page = BookletUtils.getBookletPageById(strg);
this.bookmarks[i] = page;
} else {
@ -107,20 +107,20 @@ public final class PlayerData {
}
}
public NBTTagList saveTrials() {
NBTTagList trials = new NBTTagList();
public ListNBT saveTrials() {
ListNBT trials = new ListNBT();
for (String trial : this.completedTrials) {
trials.appendTag(new NBTTagString(trial));
trials.add(StringNBT.valueOf(trial));
}
return trials;
}
public void loadTrials(NBTTagList trials) {
public void loadTrials(ListNBT trials) {
this.completedTrials.clear();
for (int i = 0; i < trials.tagCount(); i++) {
String strg = trials.getStringTagAt(i);
if (strg != null && !strg.isEmpty()) {
for (int i = 0; i < trials.size(); i++) {
String strg = trials.getString(i);
if (!strg.isEmpty()) {
this.completedTrials.add(strg);
}
}

View file

@ -8,8 +8,8 @@ import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
import de.ellpeck.actuallyadditions.common.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.common.misc.apiimpl.LaserRelayConnectionHandler;
import io.netty.util.internal.ConcurrentSet;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.world.storage.WorldSavedData;
@ -65,21 +65,21 @@ public class WorldData extends WorldSavedData {
}
@Override
public void readFromNBT(NBTTagCompound compound) {
public void read(CompoundNBT compound) {
this.laserRelayNetworks.clear();
NBTTagList networkList = compound.getTagList("Networks", 10);
for (int i = 0; i < networkList.tagCount(); i++) {
Network network = LaserRelayConnectionHandler.readNetworkFromNBT(networkList.getCompoundTagAt(i));
ListNBT networkList = compound.getList("Networks", 10);
for (int i = 0; i < networkList.size(); i++) {
Network network = LaserRelayConnectionHandler.readNetworkFromNBT(networkList.getCompound(i));
this.laserRelayNetworks.add(network);
}
this.playerSaveData.clear();
NBTTagList playerList = compound.getTagList("PlayerData", 10);
for (int i = 0; i < playerList.tagCount(); i++) {
NBTTagCompound player = playerList.getCompoundTagAt(i);
ListNBT playerList = compound.getList("PlayerData", 10);
for (int i = 0; i < playerList.size(); i++) {
CompoundNBT player = playerList.getCompound(i);
UUID id = player.getUniqueId("UUID");
NBTTagCompound data = player.getCompoundTag("Data");
CompoundNBT data = player.getCompound("Data");
PlayerSave save = new PlayerSave(id);
save.readFromNBT(data, true);
@ -88,27 +88,27 @@ public class WorldData extends WorldSavedData {
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
public CompoundNBT write(CompoundNBT compound) {
//Laser World Data
NBTTagList networkList = new NBTTagList();
ListNBT networkList = new ListNBT();
for (Network network : this.laserRelayNetworks) {
networkList.appendTag(LaserRelayConnectionHandler.writeNetworkToNBT(network));
networkList.add(LaserRelayConnectionHandler.writeNetworkToNBT(network));
}
compound.setTag("Networks", networkList);
compound.put("Networks", networkList);
//Player Data
NBTTagList playerList = new NBTTagList();
ListNBT playerList = new ListNBT();
for (PlayerSave save : this.playerSaveData.values()) {
NBTTagCompound player = new NBTTagCompound();
player.setUniqueId("UUID", save.id);
CompoundNBT player = new CompoundNBT();
player.putUniqueId("UUID", save.id);
NBTTagCompound data = new NBTTagCompound();
CompoundNBT data = new CompoundNBT();
save.writeToNBT(data, true);
player.setTag("Data", data);
player.put("Data", data);
playerList.appendTag(player);
playerList.add(player);
}
compound.setTag("PlayerData", playerList);
compound.put("PlayerData", playerList);
return compound;
}

View file

@ -7,32 +7,32 @@ import de.ellpeck.actuallyadditions.api.laser.Network;
import de.ellpeck.actuallyadditions.common.data.WorldData;
import de.ellpeck.actuallyadditions.common.tile.TileEntityLaserRelay;
import io.netty.util.internal.ConcurrentSet;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public final class LaserRelayConnectionHandler implements ILaserRelayConnectionHandler {
public static NBTTagCompound writeNetworkToNBT(Network network) {
NBTTagList list = new NBTTagList();
public static CompoundNBT writeNetworkToNBT(Network network) {
ListNBT list = new ListNBT();
for (IConnectionPair pair : network.connections) {
NBTTagCompound tag = new NBTTagCompound();
CompoundNBT tag = new CompoundNBT();
pair.writeToNBT(tag);
list.appendTag(tag);
list.add(tag);
}
NBTTagCompound compound = new NBTTagCompound();
compound.setTag("Network", list);
CompoundNBT compound = new CompoundNBT();
compound.put("Network", list);
return compound;
}
public static Network readNetworkFromNBT(NBTTagCompound tag) {
NBTTagList list = tag.getTagList("Network", 10);
public static Network readNetworkFromNBT(CompoundNBT tag) {
ListNBT list = tag.getList("Network", 10);
Network network = new Network();
for (int i = 0; i < list.tagCount(); i++) {
for (int i = 0; i < list.size(); i++) {
ConnectionPair pair = new ConnectionPair();
pair.readFromNBT(list.getCompoundTagAt(i));
pair.readFromNBT(list.getCompound(i));
network.connections.add(pair);
}
return network;

View file

@ -25,21 +25,19 @@ import de.ellpeck.actuallyadditions.common.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.common.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.common.util.StackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayerFactory;
public class MethodHandler implements IMethodHandler {
@ -48,10 +46,10 @@ public class MethodHandler implements IMethodHandler {
public boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient) {
boolean worked = false;
if (ingredient != null) {
PotionEffect[] effects = ingredient.getEffects();
EffectInstance[] effects = ingredient.getEffects();
if (effects != null && effects.length > 0) {
for (PotionEffect effect : effects) {
PotionEffect effectHas = this.getSameEffectFromStack(stack, effect);
for (EffectInstance effect : effects) {
EffectInstance effectHas = this.getSameEffectFromStack(stack, effect);
if (effectHas != null) {
if (effectHas.getAmplifier() < ingredient.getMaxAmplifier() - 1) {
this.addEffectProperties(stack, effect, false, true);
@ -68,10 +66,10 @@ public class MethodHandler implements IMethodHandler {
}
@Override
public PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect) {
PotionEffect[] effectsStack = this.getEffectsFromStack(stack);
public EffectInstance getSameEffectFromStack(ItemStack stack, EffectInstance effect) {
EffectInstance[] effectsStack = this.getEffectsFromStack(stack);
if (effectsStack != null && effectsStack.length > 0) {
for (PotionEffect effectStack : effectsStack) {
for (EffectInstance effectStack : effectsStack) {
if (effect.getPotion() == effectStack.getPotion()) { return effectStack; }
}
}
@ -79,66 +77,61 @@ public class MethodHandler implements IMethodHandler {
}
@Override
public void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp) {
PotionEffect[] effects = this.getEffectsFromStack(stack);
stack.setTagCompound(new NBTTagCompound());
public void addEffectProperties(ItemStack stack, EffectInstance effect, boolean addDur, boolean addAmp) {
EffectInstance[] effects = this.getEffectsFromStack(stack);
stack.setTag(new CompoundNBT());
for (int i = 0; i < effects.length; i++) {
if (effects[i].getPotion() == effect.getPotion()) {
effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration() + (addDur ? effect.getDuration() : 0), effects[i].getAmplifier() + (addAmp ? effect.getAmplifier() > 0 ? effect.getAmplifier() : 1 : 0));
effects[i] = new EffectInstance(effects[i].getPotion(), effects[i].getDuration() + (addDur ? effect.getDuration() : 0), effects[i].getAmplifier() + (addAmp ? effect.getAmplifier() > 0 ? effect.getAmplifier() : 1 : 0));
}
this.addEffectToStack(stack, effects[i]);
}
}
@Override
public void addEffectToStack(ItemStack stack, PotionEffect effect) {
NBTTagCompound tag = stack.getTagCompound();
if (tag == null) {
tag = new NBTTagCompound();
}
public void addEffectToStack(ItemStack stack, EffectInstance effect) {
CompoundNBT tag = stack.getOrCreateTag();
int prevCounter = tag.getInteger("Counter");
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("ID", Potion.getIdFromPotion(effect.getPotion()));
compound.setInteger("Duration", effect.getDuration());
compound.setInteger("Amplifier", effect.getAmplifier());
int prevCounter = tag.getInt("Counter");
CompoundNBT compound = new CompoundNBT();
compound.putInt("ID", Potion.getIdFromPotion(effect.getPotion()));
compound.putInt("Duration", effect.getDuration());
compound.putInt("Amplifier", effect.getAmplifier());
int counter = prevCounter + 1;
tag.setTag(counter + "", compound);
tag.setInteger("Counter", counter);
tag.put(counter + "", compound);
tag.putInt("Counter", counter);
stack.setTagCompound(tag);
stack.setTag(tag);
}
@Override
public PotionEffect[] getEffectsFromStack(ItemStack stack) {
ArrayList<PotionEffect> effects = new ArrayList<>();
NBTTagCompound tag = stack.getTagCompound();
if (tag != null) {
int counter = tag.getInteger("Counter");
public EffectInstance[] getEffectsFromStack(ItemStack stack) {
ArrayList<EffectInstance> effects = new ArrayList<>();
CompoundNBT tag = stack.getOrCreateTag();
int counter = tag.getInt("Counter");
while (counter > 0) {
NBTTagCompound compound = (NBTTagCompound) tag.getTag(counter + "");
PotionEffect effect = new PotionEffect(Potion.getPotionById(compound.getInteger("ID")), compound.getInteger("Duration"), compound.getByte("Amplifier"));
CompoundNBT compound = (CompoundNBT) tag.get(counter + "");
EffectInstance effect = new EffectInstance(Potion.getPotionById(compound.getInt("ID")), compound.getInt("Duration"), compound.getByte("Amplifier"));
effects.add(effect);
counter--;
}
}
return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null;
return effects.size() > 0 ? effects.toArray(new EffectInstance[effects.size()]) : null;
}
@Override
public boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
public boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
if (hitBlock != null) {
int range = 1;
int rangeX = 0;
int rangeY = 0;
int rangeZ = 0;
EnumFacing facing = tile.getOrientation();
if (facing != EnumFacing.UP && facing != EnumFacing.DOWN) {
Direction facing = tile.getOrientation();
if (facing != Direction.UP && facing != Direction.DOWN) {
rangeY = range;
if (facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH) {
if (facing == Direction.NORTH || facing == Direction.SOUTH) {
rangeX = range;
} else {
rangeZ = range;
@ -154,7 +147,7 @@ public class MethodHandler implements IMethodHandler {
for (int reachY = -rangeY; reachY <= rangeY; reachY++) {
BlockPos pos = new BlockPos(hitBlock.getX() + reachX, hitBlock.getY() + reachY, hitBlock.getZ() + reachZ);
if (!tile.getWorldObject().isAirBlock(pos)) {
IBlockState state = tile.getWorldObject().getBlockState(pos);
BlockState state = tile.getWorldObject().getBlockState(pos);
if (state.getBlock() instanceof BlockLaserRelay) continue;
LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)), tile.getLens());
if (recipe != null && tile.getEnergy() >= recipe.getEnergyUsed()) {
@ -164,12 +157,12 @@ public class MethodHandler implements IMethodHandler {
recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
if (output.getItem() instanceof ItemBlock) {
Block toPlace = Block.getBlockFromItem(output.getItem());
IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND);
tile.getWorldObject().setBlockState(pos, state2Place, 2);
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND);
tile.getWorld().setBlockState(pos, state2Place, 2);
} else {
EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy());
tile.getWorldObject().spawnEntity(item);
tile.getWorldObject().setBlockToAir(pos);
ItemEntity item = new ItemEntity(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy());
tile.getWorld().addEntity(item);
tile.getWorld().setBlockState(pos, Blocks.AIR.getDefaultState());
}
tile.extractEnergy(recipe.getEnergyUsed());
@ -185,30 +178,30 @@ public class MethodHandler implements IMethodHandler {
AxisAlignedBB aabb = new AxisAlignedBB(tile.getPosition().getX(), tile.getPosition().getY(), tile.getPosition().getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1);
Vec3i dir = tile.getOrientation().getDirectionVec();
aabb = aabb.grow(0.02, 0.02, 0.02).expand(dir.getX(), dir.getY(), dir.getZ());
List<EntityItem> items = tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, aabb);
for (EntityItem item : items) {
List<ItemEntity> items = tile.getWorldObject().getEntitiesWithinAABB(ItemEntity.class, aabb);
for (ItemEntity item : items) {
ItemStack stack = item.getItem();
if (!item.isDead && StackUtil.isValid(stack) && !item.getEntityData().getBoolean("aa_cnv")) {
if (item.isAlive() && StackUtil.isValid(stack) && !item.getEntityData().getBoolean("aa_cnv")) {
LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(stack, tile.getLens());
if (recipe != null) {
int itemsPossible = Math.min(tile.getEnergy() / recipe.getEnergyUsed(), stack.getCount());
if (itemsPossible > 0) {
recipe.transformHook(item.getItem(), null, item.getPosition(), tile);
item.setDead();
item.remove();
if (stack.getCount() - itemsPossible > 0) {
ItemStack stackCopy = stack.copy();
stackCopy.shrink(itemsPossible);
EntityItem inputLeft = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, stackCopy);
tile.getWorldObject().spawnEntity(inputLeft);
ItemEntity inputLeft = new ItemEntity(tile.getWorldObject(), item.posX, item.posY, item.posZ, stackCopy);
tile.getWorld().addEntity(inputLeft);
}
ItemStack outputCopy = recipe.getOutput().copy();
outputCopy.setCount(itemsPossible);
EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy);
ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy);
newItem.getEntityData().setBoolean("aa_cnv", true);
tile.getWorldObject().spawnEntity(newItem);
@ -226,7 +219,7 @@ public class MethodHandler implements IMethodHandler {
@Override
public boolean invokeReconstructor(IAtomicReconstructor tile) {
if (tile.getEnergy() >= TileEntityAtomicReconstructor.ENERGY_USE) {
EnumFacing sideToManipulate = tile.getOrientation();
Direction sideToManipulate = tile.getOrientation();
Lens currentLens = tile.getLens();
if (currentLens.canInvoke(tile, sideToManipulate, TileEntityAtomicReconstructor.ENERGY_USE)) {
tile.extractEnergy(TileEntityAtomicReconstructor.ENERGY_USE);

View file

@ -1,10 +1,10 @@
package de.ellpeck.actuallyadditions.common.network;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.fml.network.NetworkEvent;
public interface IDataHandler {
void handleData(NBTTagCompound compound, MessageContext context);
void handleData(CompoundNBT compound, NetworkEvent.Context context);
}

View file

@ -137,7 +137,7 @@ public final class PacketHandler {
int type = compound.getInteger("Type");
if (type == 0) {
data.loadBookmarks(compound.getTagList("Bookmarks", 8));
data.loadBookmarks(compound.getList("Bookmarks", 8));
} else if (type == 1) {
data.didBookTutorial = compound.getBoolean("DidBookTutorial");
} else if (type == 2) {