mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-10-27 14:53:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9cc367623 | ||
|
|
7757790b84 | ||
|
|
bcdbec5b89 | ||
|
|
3fcb927201 | ||
|
|
b374f0b23c | ||
|
|
e9c4c416f5 | ||
|
|
1b7d64a7b5 | ||
|
|
7b05cfd2f7 | ||
|
|
66fc9fbc9f | ||
|
|
aa1ecd8c13 | ||
|
|
c3453981c3 | ||
|
|
870eaf8725 | ||
|
|
2d07fea3ad | ||
|
|
95be941803 | ||
|
|
be16bf4491 | ||
|
|
ce6aa27f44 | ||
|
|
bf179c91d9 | ||
|
|
5fc1b10298 | ||
|
|
23b8f8b892 | ||
|
|
1598946632 | ||
|
|
aad6dbaa3f | ||
|
|
ca6cc89015 | ||
|
|
7a22f1d939 | ||
|
|
feda84fbc6 | ||
|
|
f7b36e11d1 | ||
|
|
cfbab6b988 | ||
|
|
3978a068d1 | ||
|
|
9d2d0af432 | ||
|
|
d451309170 | ||
|
|
c82dd0fbfb | ||
|
|
803911e10a | ||
|
|
29eedf9011 | ||
|
|
882848a00f | ||
|
|
4d253e1dd6 | ||
|
|
4d7988ee0f | ||
|
|
fcad67a1c2 | ||
|
|
1bd3b61df9 | ||
|
|
060ca1eb80 | ||
|
|
98a2d9c65e | ||
|
|
eb010094ca | ||
|
|
e6cbced8a2 | ||
|
|
d300078227 | ||
|
|
65c7f0242c | ||
|
|
c4140ef9c3 | ||
|
|
389e5e01e7 | ||
|
|
a55b2645b7 | ||
|
|
9a36381ce0 | ||
|
|
2565eea5ba | ||
|
|
13ae9ece47 | ||
|
|
d3e87b1aaf | ||
|
|
990d4990db | ||
|
|
ce232e808e | ||
|
|
31574a9c6e | ||
|
|
cd9a4110ee | ||
|
|
6b35ff2ba1 | ||
|
|
5133e721cc | ||
|
|
09ced92f5b | ||
|
|
12477a7711 | ||
|
|
b7dc4d9144 | ||
|
|
da48d317ff | ||
|
|
5bfb11e952 | ||
|
|
4dffb9f352 | ||
|
|
beadb47539 | ||
|
|
6301d3c193 | ||
|
|
883863e047 | ||
|
|
2c14f02151 | ||
|
|
00771b1a42 | ||
|
|
46ec2f2740 | ||
|
|
ac653d46c1 | ||
|
|
63d9935d01 | ||
|
|
ba695b977d | ||
|
|
6b1dfb1596 | ||
|
|
fff02be71d | ||
|
|
0e5b9e4957 | ||
|
|
3415030fbf |
No files matched your search
@@ -2,4 +2,4 @@ mcversion=1.7.10
|
||||
forgeversion=10.13.3.1370-1.7.10
|
||||
version_major=3
|
||||
version_minor=6
|
||||
version_patch=0
|
||||
version_patch=3
|
||||
+5
-1
@@ -70,6 +70,10 @@ repositories {
|
||||
name = "ic2"
|
||||
url = "http://maven.ic2.player.to/"
|
||||
}
|
||||
ivy {
|
||||
name "BuildCraft"
|
||||
artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -79,7 +83,7 @@ configurations {
|
||||
|
||||
dependencies {
|
||||
api 'net.industrial-craft:industrialcraft-2:2.2.713-experimental:api'
|
||||
api 'com.mod-buildcraft:buildcraft:6.4.10:dev'
|
||||
api name: "buildcraft", version: "6.4.10", classifier: "dev"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
private static final int MAX_POLLINATION_ATTEMPTS = 20;
|
||||
private static final int totalBreedingTime = Defaults.APIARY_BREEDING_TIME;
|
||||
private static final int ticksPerCheckCanWork = 10;
|
||||
private static final int ticksPerCheckQueenCanWork = 10;
|
||||
|
||||
private final IBeeHousing housing;
|
||||
private final boolean housingSupportsMultipleErrorStates;
|
||||
@@ -53,8 +54,8 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
// Cached flowers check
|
||||
private boolean hasFlowersCached = false;
|
||||
private int hasFlowersCooldown = 0;
|
||||
private boolean canWorkCached = false;
|
||||
private int canWorkCooldown = 0;
|
||||
private Set<IErrorState> queenCanWorkCached = Collections.emptySet();
|
||||
private int queenCanWorkCooldown = 0;
|
||||
|
||||
public BeekeepingLogic(IBeeHousing housing) {
|
||||
this.housing = housing;
|
||||
@@ -128,16 +129,6 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
@Override
|
||||
public boolean canWork() {
|
||||
if (canWorkCooldown > 0) {
|
||||
canWorkCooldown--;
|
||||
} else {
|
||||
canWorkCached = checkCanWork();
|
||||
canWorkCooldown = ticksPerCheckCanWork;
|
||||
}
|
||||
return canWorkCached;
|
||||
}
|
||||
|
||||
private boolean checkCanWork() {
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
Set<IErrorState> errorStates = housing.getErrorStates();
|
||||
for (IErrorState errorState : errorStates) {
|
||||
@@ -183,7 +174,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
if (hasFlowersCooldown <= 0) {
|
||||
hasFlowersCached = queen.hasFlower(housing);
|
||||
hasFlowersCooldown = PluginApiculture.ticksPerBeeWorkCycle / ticksPerCheckCanWork;
|
||||
hasFlowersCooldown = PluginApiculture.ticksPerBeeWorkCycle;
|
||||
|
||||
// check more often if we haven't found flowers
|
||||
if (!hasFlowersCached) {
|
||||
@@ -318,7 +309,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
ItemStack queenStack = housing.getQueen();
|
||||
|
||||
if (queenStack == null || !ForestryItem.beeQueenGE.isItemEqual(housing.getQueen())) {
|
||||
if (queenStack == null || !ForestryItem.beeQueenGE.isItemEqual(queenStack)) {
|
||||
housingErrorState = EnumErrorCode.NOQUEEN;
|
||||
hasQueen = false;
|
||||
queen = null;
|
||||
@@ -367,30 +358,46 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
private boolean queenCanWork() {
|
||||
if (queen == null) {
|
||||
return false;
|
||||
if (queenCanWorkCooldown > 0) {
|
||||
queenCanWorkCooldown--;
|
||||
} else {
|
||||
if (queen == null) {
|
||||
return false;
|
||||
}
|
||||
queenCanWorkCached = checkQueenCanWork();
|
||||
queenCanWorkCooldown = ticksPerCheckQueenCanWork;
|
||||
}
|
||||
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
try {
|
||||
Set<IErrorState> errorStates = queen.getCanWork(housing);
|
||||
Set<IErrorState> errorStates = queenCanWorkCached;
|
||||
|
||||
if (errorStates.size() > 0) {
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
for (IErrorState errorState : errorStates) {
|
||||
housing.setErrorCondition(true, errorState);
|
||||
}
|
||||
|
||||
return (errorStates.size() == 0);
|
||||
} catch (Throwable ignored) {
|
||||
// queen might not support getCanWork(housing)
|
||||
} else {
|
||||
IErrorState state = errorStates.iterator().next();
|
||||
housing.setErrorState(state);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private Set<IErrorState> checkQueenCanWork() {
|
||||
try {
|
||||
return queen.getCanWork(housing);
|
||||
} catch (Throwable ignored) {
|
||||
// queen might not support getCanWork
|
||||
}
|
||||
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state);
|
||||
return false;
|
||||
return Collections.singleton(state);
|
||||
}
|
||||
|
||||
return true;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
// / BREEDING
|
||||
|
||||
Executable → Regular
File mode changed.
Executable → Regular
File mode changed.
Executable → Regular
File mode changed.
@@ -1,29 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.hives.IHiveGen;
|
||||
|
||||
public abstract class HiveGen implements IHiveGen {
|
||||
|
||||
@Override
|
||||
public boolean canReplace(World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Material material = block.getMaterial();
|
||||
return (material.isReplaceable() && !material.isLiquid()) ||
|
||||
material == Material.air ||
|
||||
material == Material.plants;
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.hives.IHiveGen;
|
||||
|
||||
public abstract class HiveGen implements IHiveGen {
|
||||
|
||||
@Override
|
||||
public boolean canReplace(World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Material material = block.getMaterial();
|
||||
return (material.isReplaceable() && !material.isLiquid()) ||
|
||||
material == Material.air ||
|
||||
material == Material.plants;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,31 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import forestry.api.apiculture.hives.IHiveGen;
|
||||
import forestry.api.apiculture.hives.IHiveGenHelper;
|
||||
|
||||
public class HiveGenHelper implements IHiveGenHelper {
|
||||
|
||||
private static final IHiveGen treeGen = new HiveGenTree();
|
||||
|
||||
@Override
|
||||
public IHiveGen ground(Block... validGroundBlocks) {
|
||||
return new HiveGenGround(validGroundBlocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHiveGen tree() {
|
||||
return treeGen;
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import forestry.api.apiculture.hives.IHiveGen;
|
||||
import forestry.api.apiculture.hives.IHiveGenHelper;
|
||||
|
||||
public class HiveGenHelper implements IHiveGenHelper {
|
||||
|
||||
private static final IHiveGen treeGen = new HiveGenTree();
|
||||
|
||||
@Override
|
||||
public IHiveGen ground(Block... validGroundBlocks) {
|
||||
return new HiveGenGround(validGroundBlocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHiveGen tree() {
|
||||
return treeGen;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import forestry.api.genetics.IFruitBearer;
|
||||
import forestry.arboriculture.gadgets.TileFruitPod;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class EventHandlerArboriculture {
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleBonemeal(BonemealEvent event) {
|
||||
|
||||
if (!Proxies.common.isSimulating(event.world)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileFruitPod) {
|
||||
if (((TileFruitPod) tile).canMature()) {
|
||||
((TileFruitPod) tile).mature();
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
} else if (tile instanceof IFruitBearer) {
|
||||
IFruitBearer bearer = (IFruitBearer) tile;
|
||||
if (bearer.getRipeness() < 1.0f) {
|
||||
bearer.addRipeness(1.0f);
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -139,4 +139,30 @@ public class BlockFruitPod extends BlockCocoa {
|
||||
return PluginArboriculture.modelIdPods;
|
||||
}
|
||||
|
||||
/* IGrowable */
|
||||
|
||||
@Override
|
||||
// canFertilize
|
||||
public boolean func_149851_a(World world, int x, int y, int z, boolean isClient) {
|
||||
TileFruitPod podTile = getPodTile(world, x, y, z);
|
||||
if (podTile != null) {
|
||||
return podTile.canMature();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
// shouldFertilize
|
||||
public boolean func_149852_a(World world, Random random, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
// fertilize
|
||||
public void func_149853_b(World world, Random random, int x, int y, int z) {
|
||||
TileFruitPod podTile = getPodTile(world, x, y, z);
|
||||
if (podTile != null) {
|
||||
podTile.mature();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockNewLeaf;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -49,7 +50,7 @@ import forestry.core.utils.StackUtils;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
import forestry.plugins.PluginLepidopterology;
|
||||
|
||||
public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProvider {
|
||||
public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProvider, IGrowable {
|
||||
|
||||
public ForestryBlockLeaves() {
|
||||
this.setCreativeTab(Tabs.tabArboriculture);
|
||||
@@ -328,4 +329,30 @@ public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProv
|
||||
return super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9);
|
||||
}
|
||||
|
||||
/* IGrowable */
|
||||
|
||||
@Override
|
||||
// canFertilize
|
||||
public boolean func_149851_a(World world, int x, int y, int z, boolean isClient) {
|
||||
TileLeaves leafTile = getLeafTile(world, x, y, z);
|
||||
if (leafTile != null) {
|
||||
return leafTile.hasFruit() && leafTile.getRipeness() < 1.0f;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
// shouldFertilize
|
||||
public boolean func_149852_a(World world, Random random, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
// fertilize
|
||||
public void func_149853_b(World world, Random random, int x, int y, int z) {
|
||||
TileLeaves leafTile = getLeafTile(world, x, y, z);
|
||||
if (leafTile != null) {
|
||||
leafTile.addRipeness(1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,14 @@ public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamabl
|
||||
Proxies.net.sendNetworkPacket(new PacketRipeningUpdate(this));
|
||||
}
|
||||
|
||||
public void fromRipeningPacket(int newMaturity) {
|
||||
if (newMaturity == maturity) {
|
||||
return;
|
||||
}
|
||||
maturity = (short) newMaturity;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/* IFRUITBEARER */
|
||||
@Override
|
||||
public boolean hasFruit() {
|
||||
|
||||
@@ -328,7 +328,11 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return getTree().getGenome().getPrimary().getUnlocalizedName();
|
||||
ITree tree = getTree();
|
||||
if (tree == null) {
|
||||
return "for.leaves.corrupted";
|
||||
}
|
||||
return tree.getGenome().getPrimary().getUnlocalizedName();
|
||||
}
|
||||
|
||||
/* NETWORK */
|
||||
@@ -417,8 +421,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
}
|
||||
}
|
||||
|
||||
public void fromRipeningPacket(PacketRipeningUpdate packet) {
|
||||
int newColourFruits = packet.getValue();
|
||||
public void fromRipeningPacket(int newColourFruits) {
|
||||
if (newColourFruits == colourFruits) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package forestry.arboriculture.items;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.arboriculture.gadgets.TileLeaves;
|
||||
@@ -35,7 +36,7 @@ public class ItemLeavesBlock extends ItemForestryBlock {
|
||||
}
|
||||
|
||||
String grammar = StringUtil.localize("trees.grammar.leaves");
|
||||
String localizedName = StringUtil.localize(unlocalizedName);
|
||||
String localizedName = StatCollector.translateToLocal(unlocalizedName);
|
||||
|
||||
return grammar.replaceAll("%SPECIES", localizedName).replaceAll("%TYPE", type);
|
||||
}
|
||||
|
||||
@@ -13,13 +13,10 @@ package forestry.arboriculture.network;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.arboriculture.gadgets.TileLeaves;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.IPacketHandler;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class PacketHandlerArboriculture implements IPacketHandler {
|
||||
|
||||
@@ -28,8 +25,7 @@ public class PacketHandlerArboriculture implements IPacketHandler {
|
||||
|
||||
switch (packetID) {
|
||||
case RIPENING_UPDATE: {
|
||||
PacketRipeningUpdate packet = new PacketRipeningUpdate(data);
|
||||
onRipeningUpdate(packet);
|
||||
PacketRipeningUpdate.onPacketData(data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -37,10 +33,4 @@ public class PacketHandlerArboriculture implements IPacketHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void onRipeningUpdate(PacketRipeningUpdate packet) {
|
||||
TileEntity tile = packet.getTarget(Proxies.common.getRenderWorld());
|
||||
if (tile instanceof TileLeaves) {
|
||||
((TileLeaves) tile).fromRipeningPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,24 @@ package forestry.arboriculture.network;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.arboriculture.gadgets.TileFruitPod;
|
||||
import forestry.arboriculture.gadgets.TileLeaves;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.PacketCoordinates;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class PacketRipeningUpdate extends PacketCoordinates {
|
||||
|
||||
private int value;
|
||||
|
||||
public static void onPacketData(DataInputStreamForestry data) throws IOException {
|
||||
new PacketRipeningUpdate(data);
|
||||
}
|
||||
|
||||
public PacketRipeningUpdate(DataInputStreamForestry data) throws IOException {
|
||||
super(data);
|
||||
}
|
||||
@@ -40,13 +47,20 @@ public class PacketRipeningUpdate extends PacketCoordinates {
|
||||
@Override
|
||||
public void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeInt(value);
|
||||
data.writeVarInt(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
super.readData(data);
|
||||
value = data.readInt();
|
||||
value = data.readVarInt();
|
||||
|
||||
TileEntity tile = getTarget(Proxies.common.getRenderWorld());
|
||||
if (tile instanceof TileLeaves) {
|
||||
((TileLeaves) tile).fromRipeningPacket(value);
|
||||
} else if (tile instanceof TileFruitPod) {
|
||||
((TileFruitPod) tile).fromRipeningPacket(value);
|
||||
}
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
|
||||
Executable → Regular
+1
-1
@@ -113,7 +113,7 @@ public class Config {
|
||||
public static float getBeehivesRate() {
|
||||
return generateBeehivesRate;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isExUtilEnderLilyEnabled() {
|
||||
return ExUtilEnderLily;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,9 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Defaults;
|
||||
@@ -39,6 +37,7 @@ import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.interfaces.IItemStackDisplay;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
@@ -48,10 +47,12 @@ import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketItemStackDisplay;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.GuiUtil;
|
||||
|
||||
public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer, IItemStackDisplay {
|
||||
|
||||
/* CONSTANTS */
|
||||
public static final int TIME_TO_ANALYZE = 125;
|
||||
@@ -148,7 +149,8 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
|
||||
if (added) {
|
||||
setInventorySlotContents(SLOT_ANALYZE, null);
|
||||
setNeedsNetworkUpdate();
|
||||
PacketItemStackDisplay packet = new PacketItemStackDisplay(this, getIndividualOnDisplay());
|
||||
Proxies.net.sendNetworkPacket(packet);
|
||||
}
|
||||
|
||||
setErrorCondition(!added, EnumErrorCode.NOSPACE);
|
||||
@@ -183,7 +185,8 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
}
|
||||
setInventorySlotContents(SLOT_ANALYZE, inputStack);
|
||||
slot.setStackInSlot(null);
|
||||
setNeedsNetworkUpdate();
|
||||
PacketItemStackDisplay packet = new PacketItemStackDisplay(this, getIndividualOnDisplay());
|
||||
Proxies.net.sendNetworkPacket(packet);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -202,39 +205,19 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
public void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeData(data);
|
||||
ItemStack displayStack = getIndividualOnDisplay();
|
||||
if (displayStack == null) {
|
||||
data.writeBoolean(false);
|
||||
} else {
|
||||
data.writeBoolean(true);
|
||||
|
||||
IIndividual displayIndividual = AlleleManager.alleleRegistry.getIndividual(displayStack);
|
||||
int type = BeeManager.beeRoot.getType(displayStack).ordinal();
|
||||
|
||||
data.writeUTF(displayIndividual.getIdent());
|
||||
data.writeShort(type);
|
||||
data.writeShort(displayStack.stackSize);
|
||||
}
|
||||
data.writeItemStack(displayStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
super.readData(data);
|
||||
individualOnDisplayClient = data.readItemStack();
|
||||
}
|
||||
|
||||
ItemStack newIndividualOnDisplay = null;
|
||||
if (data.readBoolean()) {
|
||||
String individualUID = data.readUTF();
|
||||
int type = data.readShort();
|
||||
int stackSize = data.readShort();
|
||||
|
||||
IAllele[] template = BeeManager.beeRoot.getTemplate(individualUID);
|
||||
IIndividual individual = BeeManager.beeRoot.templateAsIndividual(template);
|
||||
|
||||
newIndividualOnDisplay = BeeManager.beeRoot.getMemberStack(individual, type);
|
||||
newIndividualOnDisplay.stackSize = stackSize;
|
||||
}
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(newIndividualOnDisplay, individualOnDisplayClient)) {
|
||||
individualOnDisplayClient = newIndividualOnDisplay;
|
||||
@Override
|
||||
public void handleItemStackForDisplay(ItemStack itemStack) {
|
||||
if (!ItemStack.areItemStacksEqual(itemStack, individualOnDisplayClient)) {
|
||||
individualOnDisplayClient = itemStack;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ public class ContainerTile<T extends TileForestry> extends ContainerForestry {
|
||||
|
||||
protected final T tile;
|
||||
|
||||
public ContainerTile(T tileForestry) {
|
||||
this.tile = tileForestry;
|
||||
}
|
||||
|
||||
public ContainerTile(T tileForestry, InventoryPlayer playerInventory, int xInv, int yInv) {
|
||||
this.tile = tileForestry;
|
||||
|
||||
|
||||
Executable → Regular
File mode changed.
@@ -61,11 +61,11 @@ public class PacketHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPacket(ClientCustomPacketEvent event) {
|
||||
onPacketData(event.packet, null);
|
||||
onPacketData(event.packet, Proxies.common.getPlayer());
|
||||
}
|
||||
|
||||
/** Returns true if the packet has been handled */
|
||||
private static boolean onPacketData(FMLProxyPacket fmlPacket, EntityPlayerMP player) {
|
||||
private static boolean onPacketData(FMLProxyPacket fmlPacket, EntityPlayer player) {
|
||||
InputStream is = new ByteBufInputStream(fmlPacket.payload());
|
||||
DataInputStreamForestry data = new DataInputStreamForestry(is);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class PacketHandler {
|
||||
|
||||
case PIPETTE_CLICK: {
|
||||
PacketSlotClick packet = new PacketSlotClick(data);
|
||||
onPipetteClick(packet, player);
|
||||
onPipetteClick(packet, (EntityPlayerMP) player);
|
||||
return true;
|
||||
}
|
||||
case SOLDERING_IRON_CLICK: {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BlockUtil {
|
||||
if (!(tile instanceof IEnergyReceiver)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
IEnergyReceiver receptor = (IEnergyReceiver) tile;
|
||||
return receptor.canConnectEnergy(side);
|
||||
}
|
||||
|
||||
@@ -41,23 +41,23 @@ import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class GeneticsUtil {
|
||||
|
||||
private static Set<Material> ersatzSpecimenMaterials;
|
||||
private static Set<Block> ersatzSpecimenBlocks;
|
||||
|
||||
private static Set<Material> getErsatzSpecimenMaterials() {
|
||||
if (ersatzSpecimenMaterials == null) {
|
||||
ersatzSpecimenMaterials = new HashSet<Material>();
|
||||
private static Set<Block> getErsatzBlocks() {
|
||||
if (ersatzSpecimenBlocks == null) {
|
||||
ersatzSpecimenBlocks = new HashSet<Block>();
|
||||
for (ItemStack ersatzSpecimen : AlleleManager.ersatzSpecimen.keySet()) {
|
||||
Block ersatzBlock = StackUtils.getBlock(ersatzSpecimen);
|
||||
if (ersatzBlock != null) {
|
||||
ersatzSpecimenMaterials.add(ersatzBlock.getMaterial());
|
||||
ersatzSpecimenBlocks.add(ersatzBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ersatzSpecimenMaterials;
|
||||
return ersatzSpecimenBlocks;
|
||||
}
|
||||
|
||||
private static boolean isErsatzMaterial(Block block) {
|
||||
return block != null && getErsatzSpecimenMaterials().contains(block.getMaterial());
|
||||
private static boolean isErsatzBlock(Block block) {
|
||||
return block != null && getErsatzBlocks().contains(block);
|
||||
}
|
||||
|
||||
public static boolean hasNaturalistEye(EntityPlayer player) {
|
||||
@@ -127,7 +127,7 @@ public class GeneticsUtil {
|
||||
|
||||
public static ITree getErsatzPollen(World world, final int x, final int y, final int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!isErsatzMaterial(block)) {
|
||||
if (!isErsatzBlock(block)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
File mode changed.
Executable → Regular
+1
-1
@@ -98,7 +98,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
craftPreviewInventory = new InventoryCraftResult();
|
||||
setInternalInventory(new CarpenterInventoryAdapter(this));
|
||||
|
||||
InvTools.configureSided(getInternalInventory(), Defaults.FACINGS, SLOT_BOX, 20);
|
||||
InvTools.configureSided(getInternalInventory(), Defaults.FACINGS, SLOT_BOX, 21);
|
||||
|
||||
tankManager = new TankManager(resourceTank);
|
||||
}
|
||||
|
||||
Executable → Regular
File mode changed.
Executable → Regular
File mode changed.
@@ -76,7 +76,7 @@ public class GuiHandlerMail extends GuiHandlerBase {
|
||||
case TraderGUI:
|
||||
return new GuiTrader(player.inventory, getTileForestry(world, x, y, z, player, MachineTrader.class));
|
||||
case TraderNameGUI:
|
||||
return new GuiTradeName(player.inventory, getTileForestry(world, x, y, z, player, MachineTrader.class));
|
||||
return new GuiTradeName(getTileForestry(world, x, y, z, player, MachineTrader.class));
|
||||
default:
|
||||
return null;
|
||||
|
||||
@@ -122,7 +122,7 @@ public class GuiHandlerMail extends GuiHandlerBase {
|
||||
case TraderGUI:
|
||||
return new ContainerTrader(player.inventory, getTileForestry(world, x, y, z, player, MachineTrader.class));
|
||||
case TraderNameGUI:
|
||||
return new ContainerTradeName(player.inventory, getTileForestry(world, x, y, z, player, MachineTrader.class));
|
||||
return new ContainerTradeName(getTileForestry(world, x, y, z, player, MachineTrader.class));
|
||||
default:
|
||||
return null;
|
||||
|
||||
|
||||
@@ -14,19 +14,21 @@ import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.IPacketHandler;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.network.PacketString;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.mail.gadgets.MachineTrader;
|
||||
import forestry.mail.gui.ContainerCatalogue;
|
||||
import forestry.mail.gui.ContainerLetter;
|
||||
import forestry.mail.gui.ContainerTradeName;
|
||||
import forestry.mail.gui.GuiMailboxInfo;
|
||||
import forestry.mail.network.PacketLetterInfo;
|
||||
import forestry.mail.network.PacketPOBoxInfo;
|
||||
import forestry.mail.network.PacketRequestLetterInfo;
|
||||
import forestry.mail.network.PacketTraderAddress;
|
||||
|
||||
public class PacketHandlerMail implements IPacketHandler {
|
||||
|
||||
@@ -55,8 +57,8 @@ public class PacketHandlerMail implements IPacketHandler {
|
||||
return true;
|
||||
}
|
||||
case TRADING_ADDRESS_SET: {
|
||||
PacketString packet = new PacketString(data);
|
||||
onAddressSet(player, packet);
|
||||
PacketTraderAddress packet = new PacketTraderAddress(data);
|
||||
handleTradeAddressSet(player, packet);
|
||||
return true;
|
||||
}
|
||||
case POBOX_INFO_REQUEST: {
|
||||
@@ -83,12 +85,15 @@ public class PacketHandlerMail implements IPacketHandler {
|
||||
GuiMailboxInfo.instance.setPOBoxInfo(packet.poboxInfo);
|
||||
}
|
||||
|
||||
private static void onAddressSet(EntityPlayer player, PacketString packet) {
|
||||
if (!(player.openContainer instanceof ContainerTradeName)) {
|
||||
private static void handleTradeAddressSet(EntityPlayer player, PacketTraderAddress packet) {
|
||||
TileEntity tile = packet.getTarget(player.worldObj);
|
||||
if (!(tile instanceof MachineTrader)) {
|
||||
return;
|
||||
}
|
||||
|
||||
((ContainerTradeName) player.openContainer).handleSetAddress(packet);
|
||||
String addressName = packet.getAddressName();
|
||||
|
||||
((MachineTrader) tile).handleSetAddress(addressName);
|
||||
}
|
||||
|
||||
private static void onLetterText(EntityPlayer player, PacketString packet) {
|
||||
|
||||
@@ -36,9 +36,11 @@ import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.mail.MailAddress;
|
||||
import forestry.mail.TradeStation;
|
||||
import forestry.mail.network.PacketTraderAddress;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
@@ -94,14 +96,23 @@ public class MachineTrader extends TileBase {
|
||||
@Override
|
||||
public void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeUTF(address.getName());
|
||||
String name = null;
|
||||
if (address != null) {
|
||||
name = address.getName();
|
||||
}
|
||||
if (name == null) {
|
||||
name = "";
|
||||
}
|
||||
data.writeUTF(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
super.readData(data);
|
||||
String address = data.readUTF();
|
||||
this.address = PostManager.postRegistry.getMailAddress(address);
|
||||
if (address.length() > 0) {
|
||||
this.address = PostManager.postRegistry.getMailAddress(address);
|
||||
}
|
||||
}
|
||||
|
||||
/* UPDATING */
|
||||
@@ -240,6 +251,22 @@ public class MachineTrader extends TileBase {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void handleSetAddress(String addressName) {
|
||||
IMailAddress address = PostManager.postRegistry.getMailAddress(addressName);
|
||||
setAddress(address);
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
IMailAddress newAddress = getAddress();
|
||||
if (newAddress != null) {
|
||||
String newAddressName = newAddress.getName();
|
||||
if (newAddressName != null && newAddressName.equals(addressName)) {
|
||||
PacketTraderAddress packetResponse = new PacketTraderAddress(this, addressName);
|
||||
Proxies.net.sendNetworkPacket(packetResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setAddress(IMailAddress address) {
|
||||
if (address == null) {
|
||||
throw new NullPointerException("address must not be null");
|
||||
@@ -260,6 +287,8 @@ public class MachineTrader extends TileBase {
|
||||
this.address = address;
|
||||
PostManager.postRegistry.getOrCreateTradeStation(worldObj, getOwner(), address);
|
||||
}
|
||||
} else {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,6 +302,15 @@ public class MachineTrader extends TileBase {
|
||||
return (TradeStation) PostManager.postRegistry.getOrCreateTradeStation(worldObj, getOwner(), address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAccess getAccess() {
|
||||
if (isLinked()) {
|
||||
return super.getAccess();
|
||||
} else {
|
||||
return EnumAccess.PRIVATE;
|
||||
}
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
|
||||
@@ -10,52 +10,33 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.gui;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.network.PacketString;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.mail.gadgets.MachineTrader;
|
||||
|
||||
public class ContainerTradeName extends Container {
|
||||
public class ContainerTradeName extends ContainerTile<MachineTrader> {
|
||||
|
||||
protected final MachineTrader machine;
|
||||
|
||||
public ContainerTradeName(InventoryPlayer player, MachineTrader tile) {
|
||||
machine = tile;
|
||||
public ContainerTradeName(MachineTrader tile) {
|
||||
super(tile);
|
||||
}
|
||||
|
||||
public IMailAddress getAddress() {
|
||||
return machine.getAddress();
|
||||
}
|
||||
|
||||
public void setAddress(String addressName) {
|
||||
|
||||
if (StringUtils.isBlank(addressName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PacketString packet = new PacketString(PacketId.TRADING_ADDRESS_SET, addressName);
|
||||
Proxies.net.sendToServer(packet);
|
||||
|
||||
IMailAddress address = PostManager.postRegistry.getMailAddress(addressName);
|
||||
machine.setAddress(address);
|
||||
}
|
||||
|
||||
public void handleSetAddress(PacketString packet) {
|
||||
String addressName = packet.getString();
|
||||
IMailAddress address = PostManager.postRegistry.getMailAddress(addressName);
|
||||
machine.setAddress(address);
|
||||
return tile.getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityPlayer) {
|
||||
return machine.isOwner(entityPlayer);
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if (tile.isLinked()) {
|
||||
for (Object crafter : crafters) {
|
||||
if (crafter instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) crafter;
|
||||
tile.openGui(player, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable → Regular
File mode changed.
@@ -13,23 +13,22 @@ package forestry.mail.gui;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.mail.gadgets.MachineTrader;
|
||||
import forestry.mail.network.PacketTraderAddress;
|
||||
|
||||
public class GuiTradeName extends GuiForestry<ContainerTradeName, MachineTrader> {
|
||||
|
||||
private GuiTextField addressNameField;
|
||||
|
||||
private boolean addressNameFocus;
|
||||
|
||||
public GuiTradeName(InventoryPlayer inventoryplayer, MachineTrader tile) {
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/tradername.png", new ContainerTradeName(inventoryplayer, tile), tile);
|
||||
public GuiTradeName(MachineTrader tile) {
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/tradername.png", new ContainerTradeName(tile), tile);
|
||||
this.xSize = 176;
|
||||
this.ySize = 90;
|
||||
}
|
||||
@@ -51,8 +50,7 @@ public class GuiTradeName extends GuiForestry<ContainerTradeName, MachineTrader>
|
||||
// Set focus or enter text into address
|
||||
if (addressNameField.isFocused()) {
|
||||
if (eventKey == Keyboard.KEY_RETURN) {
|
||||
addressNameFocus = true;
|
||||
addressNameField.setFocused(false);
|
||||
setAddress();
|
||||
} else {
|
||||
addressNameField.textboxKeyTyped(eventCharacter, eventKey);
|
||||
}
|
||||
@@ -70,36 +68,24 @@ public class GuiTradeName extends GuiForestry<ContainerTradeName, MachineTrader>
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
|
||||
// Close gui screen if we linked up.
|
||||
if (container.machine.isLinked()) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
this.mc.setIngameFocus();
|
||||
}
|
||||
|
||||
// Check for focus changes
|
||||
if (addressNameFocus && !addressNameField.isFocused()) {
|
||||
this.setAddress();
|
||||
}
|
||||
addressNameFocus = addressNameField.isFocused();
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(var1, var2, var3);
|
||||
|
||||
String prompt = StringUtil.localize("gui.mail.nametrader");
|
||||
fontRendererObj.drawString(prompt, guiLeft + this.getCenteredOffset(prompt), guiTop + 16, fontColor.get("gui.mail.text"));
|
||||
addressNameField.drawTextBox();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
setAddress();
|
||||
super.onGuiClosed();
|
||||
setAddress();
|
||||
}
|
||||
|
||||
private void setAddress() {
|
||||
String address = addressNameField.getText();
|
||||
if (StringUtils.isNotBlank(address)) {
|
||||
container.setAddress(address);
|
||||
PacketTraderAddress packet = new PacketTraderAddress(inventory, address);
|
||||
Proxies.net.sendToServer(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,12 +111,20 @@ public class ItemLetter extends ItemInventoried {
|
||||
|
||||
public static LetterState getState(int meta) {
|
||||
int ordinal = meta & 0x0f;
|
||||
return LetterState.values()[ordinal];
|
||||
LetterState[] values = LetterState.values();
|
||||
if (ordinal >= values.length) {
|
||||
ordinal = 0;
|
||||
}
|
||||
return values[ordinal];
|
||||
}
|
||||
|
||||
public static LetterSize getSize(int meta) {
|
||||
int ordinal = meta >> 4;
|
||||
return LetterSize.values()[ordinal];
|
||||
LetterSize[] values = LetterSize.values();
|
||||
if (ordinal >= values.length) {
|
||||
ordinal = 0;
|
||||
}
|
||||
return values[ordinal];
|
||||
}
|
||||
|
||||
public static LetterSize getSize(ILetter letter) {
|
||||
@@ -167,23 +175,24 @@ public class ItemLetter extends ItemInventoried {
|
||||
switch (state) {
|
||||
case OPENED:
|
||||
if (letter.countAttachments() <= 0) {
|
||||
int meta = encodeMeta(LetterState.EMPTIED, size);
|
||||
parent.setItemDamage(meta);
|
||||
state = LetterState.EMPTIED;
|
||||
}
|
||||
break;
|
||||
case FRESH:
|
||||
case STAMPED:
|
||||
if (letter.isMailable() && letter.isPostPaid()) {
|
||||
int meta = encodeMeta(LetterState.STAMPED, size);
|
||||
parent.setItemDamage(meta);
|
||||
state = LetterState.STAMPED;
|
||||
} else {
|
||||
int meta = encodeMeta(LetterState.FRESH, size);
|
||||
parent.setItemDamage(meta);
|
||||
state = LetterState.FRESH;
|
||||
}
|
||||
size = getSize(letter);
|
||||
break;
|
||||
case EMPTIED:
|
||||
}
|
||||
|
||||
int meta = encodeMeta(state, size);
|
||||
parent.setItemDamage(meta);
|
||||
|
||||
letter.writeToNBT(parent.getTagCompound());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.mail.network;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.PacketCoordinates;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.mail.gadgets.MachineTrader;
|
||||
|
||||
public class PacketTraderAddress extends PacketCoordinates {
|
||||
|
||||
private String addressName;
|
||||
|
||||
public PacketTraderAddress(DataInputStreamForestry data) throws IOException {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public PacketTraderAddress(MachineTrader tile, String addressName) {
|
||||
super(PacketId.TRADING_ADDRESS_SET, tile);
|
||||
|
||||
this.addressName = addressName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeUTF(addressName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readData(DataInputStreamForestry data) throws IOException {
|
||||
super.readData(data);
|
||||
|
||||
addressName = data.readUTF();
|
||||
}
|
||||
|
||||
public String getAddressName() {
|
||||
return addressName;
|
||||
}
|
||||
}
|
||||
@@ -297,6 +297,8 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
createAlleles();
|
||||
BeeDefinition.initBees();
|
||||
|
||||
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.speciesArgrarian", BeeDefinition.AGRARIAN.getGenome().getPrimary());
|
||||
|
||||
// Hives
|
||||
createHives();
|
||||
registerBeehiveDrops();
|
||||
|
||||
@@ -23,7 +23,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
@@ -48,7 +47,6 @@ import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.EventHandlerArboriculture;
|
||||
import forestry.arboriculture.FruitProviderNone;
|
||||
import forestry.arboriculture.FruitProviderPod;
|
||||
import forestry.arboriculture.FruitProviderPod.EnumPodType;
|
||||
@@ -338,8 +336,6 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
GameRegistry.registerTileEntity(TileFruitPod.class, "forestry.Pods");
|
||||
definitionChest.register();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandlerArboriculture());
|
||||
|
||||
if (Config.enableVillager) {
|
||||
VillagerRegistry.instance().registerVillagerId(Defaults.ID_VILLAGER_LUMBERJACK);
|
||||
Proxies.render.registerVillagerSkin(Defaults.ID_VILLAGER_LUMBERJACK, Defaults.TEXTURE_SKIN_LUMBERJACK);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PluginBuildCraftRecipes extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return Proxies.common.isAPILoaded("buildcraft.api.recipes", "[2.0, 3.0)");
|
||||
return Proxies.common.isAPILoaded("buildcraft.api.recipes", "[2.0, 4.0)");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,6 +97,10 @@ public class PluginManager {
|
||||
PLANTMEGAPACK(new PluginPlantMegaPack()),
|
||||
WITCHERY(new PluginWitchery());
|
||||
|
||||
static {
|
||||
ForestryAPI.enabledPlugins = new HashSet<String>();
|
||||
}
|
||||
|
||||
private final ForestryPlugin instance;
|
||||
private final boolean canBeDisabled;
|
||||
|
||||
@@ -220,7 +224,6 @@ public class PluginManager {
|
||||
unloadedModules.removeAll(toLoad);
|
||||
loadedModules.addAll(toLoad);
|
||||
|
||||
ForestryAPI.enabledPlugins = new HashSet<String>();
|
||||
for (Module m : loadedModules) {
|
||||
ForestryAPI.enabledPlugins.add(m.toString());
|
||||
}
|
||||
|
||||
Executable → Regular
File mode changed.
Reference in new issue
Block a user