mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 03:25:07 +00:00
Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2
This commit is contained in:
commit
09fa488cff
16 files changed
+85
-154
No files matched your search
@@ -13,7 +13,9 @@ public class FlowerFactory implements IFlowerFactory {
|
||||
|
||||
@Override
|
||||
public IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies parentFlower0, IAlleleFlowerSpecies parentFlower1, IAllele[] result, int chance) {
|
||||
return new FlowerMutation(parentFlower0, parentFlower1, result, chance);
|
||||
FlowerMutation mutation = new FlowerMutation(parentFlower0, parentFlower1, result, chance);
|
||||
FlowerManager.flowerRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package binnie.botany.network;
|
||||
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.network.packet.MessageCoordinates;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
//TODO Remove this after test the PacketFlowerUpdate
|
||||
public class MessageFlowerUpdate extends MessageCoordinates {
|
||||
public TileEntityFlower.RenderInfo render;
|
||||
|
||||
public MessageFlowerUpdate(final int posX, final int posY, final int posZ, final TileEntityFlower.RenderInfo render) {
|
||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||
this.render = render;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageBinnie GetMessage() {
|
||||
return super.GetMessage();
|
||||
}
|
||||
|
||||
public MessageFlowerUpdate(final MessageBinnie message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(final ByteBuf data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeByte(this.render.primary.getID());
|
||||
data.writeByte(this.render.secondary.getID());
|
||||
data.writeByte(this.render.stem.getID());
|
||||
data.writeByte(this.render.type.ordinal());
|
||||
data.writeByte(this.render.age);
|
||||
data.writeByte(this.render.section);
|
||||
data.writeBoolean(this.render.wilted);
|
||||
data.writeBoolean(this.render.flowered);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(final ByteBuf data) throws IOException {
|
||||
super.readData(data);
|
||||
this.render = new TileEntityFlower.RenderInfo();
|
||||
this.render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.type = EnumFlowerType.values()[data.readByte()];
|
||||
this.render.age = data.readByte();
|
||||
this.render.section = data.readByte();
|
||||
this.render.wilted = data.readBoolean();
|
||||
this.render.flowered = data.readBoolean();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package binnie.botany.network;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.IPacketID;
|
||||
@@ -10,30 +10,28 @@ import binnie.core.network.packet.MessageNBT;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public enum PacketID implements IPacketID {
|
||||
Encylopedia,
|
||||
FlowerUpdate;
|
||||
FIELDKIT;
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageBinnie message, final MessageContext context) {
|
||||
if (this == PacketID.Encylopedia && context.side == Side.CLIENT) {
|
||||
final MessageNBT packet = new MessageNBT(message);
|
||||
final NBTTagCompound data = packet.getTagCompound();
|
||||
final EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||
if (this == PacketID.FIELDKIT && context.side == Side.CLIENT) {
|
||||
MessageNBT packet = new MessageNBT(message);
|
||||
NBTTagCompound data = packet.getTagCompound();
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
String info = "";
|
||||
if (data.hasNoTags()) {
|
||||
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
||||
info += Binnie.Language.localise("botany.flowers.species.not.discover");
|
||||
} else {
|
||||
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||
final IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||
final float age = data.getFloat("Age");
|
||||
final EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||
final EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
||||
IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||
IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||
float age = data.getFloat("Age");
|
||||
EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||
EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
||||
if (primary == null || secondary == null) {
|
||||
return;
|
||||
}
|
||||
@@ -55,22 +53,16 @@ public enum PacketID implements IPacketID {
|
||||
if (primary == secondary) {
|
||||
info = info + " " + primary.getName();
|
||||
} else {
|
||||
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
||||
info = info + " " + primary.getName() + "-" + secondary.getName() + " " + Binnie.Language.localise("botany.flowers.species.hybrid");
|
||||
}
|
||||
if (age == 0.0f) {
|
||||
info += " Germling";
|
||||
info += " " + Binnie.Language.localise("botany.flowers.species.germling");
|
||||
}
|
||||
if (data.getBoolean("Wilting")) {
|
||||
info += ". Shame it is Wilting!";
|
||||
info += ". " + Binnie.Language.localise("botany.flowers.species.wilting");
|
||||
}
|
||||
}
|
||||
player.addChatMessage(new TextComponentString(info));
|
||||
} else if (this == PacketID.FlowerUpdate) {
|
||||
final MessageFlowerUpdate packet2 = new MessageFlowerUpdate(message);
|
||||
final TileEntity tile = packet2.getTileEntity(BinnieCore.proxy.getWorld());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).setRender(packet2.render);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -61,6 +62,7 @@ public final class BinnieCore extends AbstractMod {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
MinecraftForge.EVENT_BUS.register(Binnie.Liquid);
|
||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
||||
for (final FluidContainer container : FluidContainer.values()) {
|
||||
final Item item = new ItemFluidContainer(container);
|
||||
|
||||
@@ -37,36 +37,39 @@ public class ModuleItems implements IInitializable {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onUseFieldKit(final PlayerInteractEvent.RightClickBlock event) {
|
||||
public void onUseFieldKit(PlayerInteractEvent.RightClickBlock event) {
|
||||
if (!BinnieCore.isBotanyActive()) {
|
||||
return;
|
||||
}
|
||||
BlockPos pos = event.getPos();
|
||||
World world = event.getWorld();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
||||
if (player != null) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if(heldItem != null && heldItem.getItem() == BinnieCore.fieldKit && player.isSneaking()){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
IFlower flower = tileFlower.getFlower();
|
||||
if (flower != null && flower.getGenome() != null) {
|
||||
IFlowerGenome flowerGenome = flower.getGenome();
|
||||
NBTTagCompound info = new NBTTagCompound();
|
||||
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||
info.setBoolean("Wilting", flower.isWilted());
|
||||
info.setBoolean("Flowered", flower.hasFlowered());
|
||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.Encylopedia.ordinal(), info), player);
|
||||
heldItem.damageItem(1, event.getEntityPlayer());
|
||||
}
|
||||
if(!world.isRemote){
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
||||
if (player != null) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if(heldItem != null && heldItem.getItem() == BinnieCore.fieldKit && player.isSneaking()){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
IFlower flower = tileFlower.getFlower();
|
||||
if (flower != null && flower.getGenome() != null) {
|
||||
IFlowerGenome flowerGenome = flower.getGenome();
|
||||
NBTTagCompound info = new NBTTagCompound();
|
||||
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||
info.setBoolean("Wilting", flower.isWilted());
|
||||
info.setBoolean("Flowered", flower.hasFlowered());
|
||||
//TODO: Find out why minecraft post 2 messages
|
||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
|
||||
heldItem.damageItem(1, event.getEntityPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,7 @@ package binnie.core.liquid;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IFluidType {
|
||||
// IIcon getIcon();
|
||||
//
|
||||
// void registerIcon(final IIconRegister p0);
|
||||
public interface IFluidType{
|
||||
|
||||
ResourceLocation getFlowing();
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package binnie.core.liquid;
|
||||
|
||||
import binnie.core.ManagerBase;
|
||||
import forestry.core.render.TextureManager;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -40,18 +45,6 @@ public class ManagerLiquid extends ManagerBase {
|
||||
return FluidRegistry.getFluidStack(name.toLowerCase(), amount);
|
||||
}
|
||||
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void reloadIcons(final IIconRegister register) {
|
||||
// for (final IFluidType type : this.fluids.values()) {
|
||||
// final Fluid fluid = this.getLiquidStack(type.getIdentifier(), 1).getFluid();
|
||||
// type.registerIcon(register);
|
||||
// if (fluid == null) {
|
||||
// throw new RuntimeException("[Binnie] Liquid not registered properly - " + type.getIdentifier());
|
||||
// }
|
||||
// fluid.setIcons(type.getIcon());
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
@@ -70,4 +63,13 @@ public class ManagerLiquid extends ManagerBase {
|
||||
public IFluidType getFluidType(final String liquid) {
|
||||
return this.fluids.get(liquid.toLowerCase());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites(TextureStitchEvent event){
|
||||
for (IFluidType fluid : this.fluids.values()) {
|
||||
TextureManager.registerSprite(fluid.getFlowing());
|
||||
TextureManager.registerSprite(fluid.getStill());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,6 @@ public final class BinnieProxyClient extends BinnieProxy implements IBinnieProxy
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta, modelResourceLocation);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void bindTexture(final BinnieResource texture) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.extrabees.liquids;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.Constants;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.ILiquidType;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
@@ -23,12 +24,12 @@ public enum ExtraBeeLiquid implements ILiquidType {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowing() {
|
||||
return new ResourceLocation("liquids/" + this.getIdentifier());
|
||||
return new ResourceLocation(Constants.EXTRA_BEES_MOD_ID, "liquids/" + this.getIdentifier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getStill() {
|
||||
return new ResourceLocation("liquids/" + this.getIdentifier());
|
||||
return new ResourceLocation(Constants.EXTRA_BEES_MOD_ID, "liquids/" + this.getIdentifier());
|
||||
}
|
||||
// @Override
|
||||
// public IIcon getIcon() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.Constants;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
@@ -84,12 +85,12 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
|
||||
//TODO TEXTURE
|
||||
@Override
|
||||
public ResourceLocation getFlowing() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getStill() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.Constants;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -74,12 +75,12 @@ public enum Juice implements IFluidType, ICocktailLiquid {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowing() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getStill() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.Constants;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -74,12 +75,12 @@ public enum Liqueur implements IFluidType, ICocktailLiquid {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowing() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getStill() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,16 +44,6 @@ public enum MiscFluid implements IFluidType, ICocktailLiquid {
|
||||
return container == FluidContainer.Glass;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public IIcon getIcon() {
|
||||
// return this.icon;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void registerIcon(final IIconRegister register) {
|
||||
// this.icon = ExtraTrees.proxy.getIcon(register, "liquids/liquid");
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowing() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.extratrees.alcohol;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.Constants;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.IFluidType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -65,24 +66,14 @@ public enum Spirit implements IFluidType, ICocktailLiquid {
|
||||
return container == FluidContainer.Glass;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public IIcon getIcon() {
|
||||
// return this.icon;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void registerIcon(final IIconRegister register) {
|
||||
// this.icon = ExtraTrees.proxy.getIcon(register, "liquids/liquid");
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowing() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getStill() {
|
||||
return new ResourceLocation("liquids/liquid");
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/liquid");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.extratrees.item;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.Constants;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.ILiquidType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -36,12 +37,12 @@ public enum ExtraTreeLiquid implements ILiquidType {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getStill() {
|
||||
return new ResourceLocation("liquids/" + this.getIdentifier());
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/" + this.getIdentifier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowing() {
|
||||
return new ResourceLocation("liquids/" + this.getIdentifier());
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "liquids/" + this.getIdentifier());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user