mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-14 17:24:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb96e7deae | ||
|
|
7643d11e14 | ||
|
|
4eb26e9d77 | ||
|
|
2b1843b74d | ||
|
|
0b312261db | ||
|
|
bd0746583a | ||
|
|
b4143fb0ef | ||
|
|
77c47e9071 | ||
|
|
f27b66c53f | ||
|
|
ad16588e3b | ||
|
|
5acbd0b977 | ||
|
|
7e22128279 | ||
|
|
65e11fa564 | ||
|
|
355c85598e |
No files matched your search
+4
-4
@@ -1,12 +1,12 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:ForestryMC:4.11.7:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.9.13:dev')
|
||||
api('com.github.GTNewHorizons:ForestryMC:4.11.28:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.11.19:dev')
|
||||
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.63-GTNH:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.105-GTNH:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.55:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.61:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e1118b4c7c2858d28154d086dbff010e/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/59a9771cad43219260d9aac9a8ec4d6a/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/832229f0f6f0be60ed817c5a5e5848eb/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/b96cb7670c095245220e7d01d5927b58/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
+1
-1
@@ -17,5 +17,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.19'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.26'
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
||||
return TileType.get(meta >>> 16 & 0xFF).icons[MultipassBlockRenderer.getLayer()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,6 +167,9 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta) {
|
||||
if (!MultipassBlockRenderer.isRendering()) {
|
||||
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
||||
}
|
||||
return colorMultiplier(meta);
|
||||
}
|
||||
|
||||
@@ -177,14 +180,14 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(int meta) {
|
||||
BlockType type = getType(meta);
|
||||
if (MultipassBlockRenderer.getLayer() == 0) {
|
||||
int layer = MultipassBlockRenderer.getLayer();
|
||||
if (layer == 0) {
|
||||
return 0xffffff;
|
||||
}
|
||||
if (MultipassBlockRenderer.getLayer() == 1) {
|
||||
return type.color1.getColor(false);
|
||||
if (layer == 1) {
|
||||
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
||||
}
|
||||
return type.color2.getColor(false);
|
||||
return EnumFlowerColor.get(meta >>> 8 & 0xFF).getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.config.BCConfig;
|
||||
import binnie.core.craftgui.minecraft.ModuleCraftGUI;
|
||||
import binnie.core.gui.BinnieCoreGUI;
|
||||
import binnie.core.gui.BinnieGUIHandler;
|
||||
@@ -78,7 +79,9 @@ public class BinnieCore extends AbstractMod {
|
||||
}
|
||||
|
||||
addModule(new ModuleCraftGUI());
|
||||
addModule(new ModuleStorage());
|
||||
if (!BCConfig.disableCompartments) {
|
||||
addModule(new ModuleStorage());
|
||||
}
|
||||
addModule(new ModuleItems());
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
addModule(new ModuleTrigger());
|
||||
|
||||
@@ -14,6 +14,7 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static MultipassBlockRenderer instance;
|
||||
private static int layer = 0;
|
||||
private static boolean rendering = false;
|
||||
|
||||
public MultipassBlockRenderer() {
|
||||
MultipassBlockRenderer.instance = this;
|
||||
@@ -23,31 +24,49 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
return MultipassBlockRenderer.layer;
|
||||
}
|
||||
|
||||
public static boolean isRendering() {
|
||||
return MultipassBlockRenderer.rendering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
||||
int passes = multipassBlock.getNumberOfPasses();
|
||||
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
renderItem(block, renderer, meta);
|
||||
MultipassBlockRenderer.layer++;
|
||||
MultipassBlockRenderer.rendering = true;
|
||||
try {
|
||||
for (int pass = 0; pass < passes; ++pass) {
|
||||
MultipassBlockRenderer.layer = pass;
|
||||
renderItem(block, multipassBlock, renderer, meta);
|
||||
}
|
||||
} finally {
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
MultipassBlockRenderer.rendering = false;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
boolean r = true;
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
r = renderer.renderStandardBlock(block, x, y, z);
|
||||
MultipassBlockRenderer.layer++;
|
||||
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
||||
int passes = multipassBlock.getNumberOfPasses();
|
||||
boolean rendered = true;
|
||||
|
||||
MultipassBlockRenderer.rendering = true;
|
||||
try {
|
||||
for (int pass = 0; pass < passes; ++pass) {
|
||||
MultipassBlockRenderer.layer = pass;
|
||||
rendered = renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
return rendered;
|
||||
} finally {
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
MultipassBlockRenderer.rendering = false;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,8 +79,8 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
|
||||
public void renderItem(Block block, RenderBlocks renderer, int meta) {
|
||||
setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
private void renderItem(Block block, IMultipassBlock multipassBlock, RenderBlocks renderer, int meta) {
|
||||
setColor(multipassBlock.colorMultiplier(meta));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.core.config;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
|
||||
@Config(modid = BinnieCore.CORE_MODID)
|
||||
public class BCConfig {
|
||||
|
||||
@Config.Comment("If true, disables all compartment storage machines (no blocks/recipes will be registered).")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean disableCompartments;
|
||||
}
|
||||
@@ -188,7 +188,9 @@ public class WindowFieldKit extends Window {
|
||||
glassOffsetX *= 1.0f - analyseProgress;
|
||||
glassOffsetY += glassVY;
|
||||
glassOffsetY *= 1.0f - analyseProgress;
|
||||
GlassControl.setOffset(new IPoint(glassOffsetX, glassOffsetY));
|
||||
if (GlassControl != null) {
|
||||
GlassControl.setOffset(new IPoint(glassOffsetX, glassOffsetY));
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshSpecies() {
|
||||
|
||||
@@ -240,12 +240,16 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char c, int key) {
|
||||
NEIHook.lastKeyTyped(key, c);
|
||||
boolean noFocusedWidget = window.getFocusedWidget() == null;
|
||||
|
||||
if (key == 1 || (key == mc.gameSettings.keyBindInventory.getKeyCode() && window.getFocusedWidget() == null)) {
|
||||
if (noFocusedWidget) {
|
||||
NEIHook.lastKeyTyped(key, c);
|
||||
}
|
||||
|
||||
if (key == 1 || (key == mc.gameSettings.keyBindInventory.getKeyCode() && noFocusedWidget)) {
|
||||
mc.thePlayer.closeScreen();
|
||||
}
|
||||
IWidget origin = (window.getFocusedWidget() == null) ? window : window.getFocusedWidget();
|
||||
IWidget origin = noFocusedWidget ? window : window.getFocusedWidget();
|
||||
window.callEvent(new EventKey.Down(origin, c, key));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
protected float titleButtonLeft;
|
||||
protected float titleButtonRight;
|
||||
private GuiCraftGUI gui;
|
||||
private Renderer renderer;
|
||||
private final ContainerCraftGUI container;
|
||||
private final WindowInventory windowInventory;
|
||||
private ControlText title;
|
||||
@@ -83,8 +84,8 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
ControlSlot.highlighting.put(h, new ArrayList<>());
|
||||
}
|
||||
|
||||
CraftGUI.render = new Renderer(gui);
|
||||
CraftGUI.render.stylesheet(StyleSheetManager.getDefault());
|
||||
renderer = new Renderer(gui);
|
||||
renderer.stylesheet(StyleSheetManager.getDefault());
|
||||
titleButtonLeft = -14.0f;
|
||||
|
||||
if (showHelpButton()) {
|
||||
@@ -195,6 +196,9 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
|
||||
CraftGUI.render = renderer;
|
||||
|
||||
if (hasBeenInitialised) {
|
||||
return;
|
||||
}
|
||||
@@ -267,7 +271,9 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG
|
||||
entityInventory = inventory;
|
||||
}
|
||||
|
||||
public void onClose() {}
|
||||
public void onClose() {
|
||||
CraftGUI.render = null;
|
||||
}
|
||||
|
||||
public boolean isServer() {
|
||||
return !isClient();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package binnie.core.liquid;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
@@ -9,32 +11,62 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.ManagerBase;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ManagerLiquid extends ManagerBase {
|
||||
|
||||
private static final Set<String> EXTERNAL_FLUIDS = new HashSet<>();
|
||||
|
||||
static {
|
||||
EXTERNAL_FLUIDS.add("liquidnitrogen");
|
||||
}
|
||||
|
||||
private static boolean isExternalFluid(String identifier) {
|
||||
return EXTERNAL_FLUIDS.contains(identifier) && Loader.isModLoaded("gregtech");
|
||||
}
|
||||
|
||||
public Map<String, IFluidType> fluids;
|
||||
private final Set<String> ownedFluids;
|
||||
|
||||
public ManagerLiquid() {
|
||||
fluids = new LinkedHashMap<>();
|
||||
ownedFluids = new HashSet<>();
|
||||
}
|
||||
|
||||
public void createLiquids(IFluidType[] liquids, int startID) {
|
||||
for (IFluidType liquid : liquids) {
|
||||
BinnieFluid fluid = createLiquid(liquid, startID++);
|
||||
if (fluid == null) {
|
||||
String identifier = liquid.getIdentifier().toLowerCase();
|
||||
Fluid fluid = createOrGetLiquid(liquid, startID++);
|
||||
if (fluid == null && !isExternalFluid(identifier)) {
|
||||
throw new RuntimeException("Liquid registered incorrectly - " + liquid.getIdentifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BinnieFluid createLiquid(IFluidType fluid, int id) {
|
||||
fluids.put(fluid.getIdentifier().toLowerCase(), fluid);
|
||||
BinnieFluid binnieFluid = new BinnieFluid(fluid);
|
||||
FluidRegistry.registerFluid(binnieFluid);
|
||||
Fluid registeredFluid = createOrGetLiquid(fluid, id);
|
||||
return (registeredFluid instanceof BinnieFluid) ? (BinnieFluid) registeredFluid : null;
|
||||
}
|
||||
|
||||
private Fluid createOrGetLiquid(IFluidType fluid, int id) {
|
||||
String identifier = fluid.getIdentifier().toLowerCase();
|
||||
fluids.put(identifier, fluid);
|
||||
Fluid registeredFluid = FluidRegistry.getFluid(identifier);
|
||||
if (registeredFluid == null && !isExternalFluid(identifier)) {
|
||||
BinnieFluid binnieFluid = new BinnieFluid(fluid);
|
||||
FluidRegistry.registerFluid(binnieFluid);
|
||||
registeredFluid = FluidRegistry.getFluid(identifier);
|
||||
ownedFluids.add(identifier);
|
||||
} else if (registeredFluid == null) {
|
||||
FMLLog.warning(
|
||||
"[Binnie] External liquid %s is not registered yet. Waiting for the owning mod to register it before postInit.",
|
||||
identifier);
|
||||
}
|
||||
ItemFluidContainer.registerFluid(fluid, id);
|
||||
return binnieFluid;
|
||||
return registeredFluid;
|
||||
}
|
||||
|
||||
public FluidStack getLiquidStack(String name, int amount) {
|
||||
@@ -44,18 +76,26 @@ public class ManagerLiquid extends ManagerBase {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void reloadIcons(IIconRegister register) {
|
||||
for (IFluidType type : fluids.values()) {
|
||||
Fluid fluid = getLiquidStack(type.getIdentifier(), 1).getFluid();
|
||||
String identifier = type.getIdentifier().toLowerCase();
|
||||
FluidStack stack = getLiquidStack(identifier, 1);
|
||||
Fluid fluid = stack == null ? null : stack.getFluid();
|
||||
type.registerIcon(register);
|
||||
if (fluid == null) {
|
||||
throw new RuntimeException("[Binnie] Liquid not registered properly - " + type.getIdentifier());
|
||||
}
|
||||
fluid.setIcons(type.getIcon());
|
||||
if (ownedFluids.contains(identifier)) {
|
||||
fluid.setIcons(type.getIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (IFluidType fluid : fluids.values()) {
|
||||
String identifier = fluid.getIdentifier().toLowerCase();
|
||||
if (isExternalFluid(identifier) && FluidRegistry.getFluid(identifier) == null) {
|
||||
throw new RuntimeException("[Binnie] External liquid not registered - " + identifier);
|
||||
}
|
||||
for (FluidContainer container : FluidContainer.values()) {
|
||||
if (container.isActive() && fluid.canPlaceIn(container)) {
|
||||
container.registerContainerData(fluid);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package binnie.core.machines;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
@@ -53,8 +52,7 @@ public abstract class MachinePackage {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public abstract void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer);
|
||||
public abstract void renderMachine(Machine machine, double x, double y, double z, float partialTick);
|
||||
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import binnie.Binnie;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
@@ -13,30 +12,27 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
// Hmm. It's used class
|
||||
public class RendererMachine extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
RenderBlocks blockRenderer;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float partialTick) {
|
||||
renderTileEntity((TileEntityMachine) entity, x, y, z, partialTick, blockRenderer);
|
||||
renderTileEntity((TileEntityMachine) entity, x, y, z, partialTick);
|
||||
}
|
||||
|
||||
public void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer) {
|
||||
private void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float partialTick) {
|
||||
if (entity != null && entity.getMachine() != null) {
|
||||
MachinePackage machinePackage = entity.getMachine().getPackage();
|
||||
machinePackage.renderMachine(entity.getMachine(), x, y, z, partialTick, renderer);
|
||||
machinePackage.renderMachine(entity.getMachine(), x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderInvBlock(RenderBlocks renderblocks, Block block, int i, int j) {
|
||||
private void renderInvBlock(Block block, int i, int j) {
|
||||
TileEntity entity = block.createTileEntity(null, i);
|
||||
renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f, renderblocks);
|
||||
renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == Binnie.Machine.getMachineRenderID()) {
|
||||
renderInvBlock(renderer, block, metadata, modelID);
|
||||
renderInvBlock(block, metadata, modelID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +44,7 @@ public class RendererMachine extends TileEntitySpecialRenderer implements ISimpl
|
||||
&& tile.getMachine().getPackage() != null
|
||||
&& tile.getMachine().getPackage().getGroup() != null
|
||||
&& !tile.getMachine().getPackage().getGroup().customRenderer) {
|
||||
renderTileEntity(tile, x, y, z, 1.0f, renderer);
|
||||
renderTileEntity(tile, x, y, z, 1.0f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -62,9 +58,4 @@ public class RendererMachine extends TileEntitySpecialRenderer implements ISimpl
|
||||
public int getRenderId() {
|
||||
return Binnie.Machine.getMachineRenderID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_147496_a(World par1World) {
|
||||
blockRenderer = new RenderBlocks(par1World);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class ComponentTankContainer extends MachineComponent implements ITankMac
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
int index = getTankIndexToDrain(from, null);
|
||||
int index = getTankIndexToDrain(from, resource);
|
||||
if (!tanks.containsKey(index)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -9,4 +9,11 @@ public interface IProcess extends IErrorStateSource {
|
||||
boolean isInProgress();
|
||||
|
||||
ProcessInfo getInfo();
|
||||
|
||||
/***
|
||||
* Returns true if the current target got worked on at least once.
|
||||
*/
|
||||
default boolean workedOnTarget() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package binnie.core.machines.storage;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -51,8 +50,7 @@ enum Compartment implements IMachineType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer) {
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
MachineRendererCompartment.instance.renderMachine(machine, renderTexture, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,8 +256,8 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.LEFT);
|
||||
slide.setLabel(I18N.localise("binniecore.machine.storage.tab.properties"));
|
||||
slide.setSlide(false);
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tooltip.properties"));
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tooltip.properties.desc"));
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tab.properties"));
|
||||
slide.addHelp(I18N.localise("binniecore.machine.storage.tab.properties.desc"));
|
||||
Panel tabPropertyPanel = new Panel(slide, 16.0f, 8.0f, 112.0f, 76.0f, MinecraftGUI.PanelType.Gray);
|
||||
int y2 = 4;
|
||||
new ControlText(tabPropertyPanel, new IPoint(4.0f, y2), I18N.localise("binniecore.machine.storage.tab.name"));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -66,8 +65,7 @@ public enum AlvearyMachine implements IMachineType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer) {
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
MachineRendererBlock.instance.renderMachine(machineTexture, x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package binnie.extratrees.machines;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -81,8 +80,7 @@ public enum ExtraTreeMachine implements IMachineType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
||||
RenderBlocks renderer) {
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
MachineRendererForestry.renderMachine(textureName.getShortPath(), x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ public class Lumbermill {
|
||||
|
||||
private static Collection<ItemStack> getRecipeResult(ItemStack output) {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
for (IRecipe iRecipe : CraftingManager.getInstance().getRecipeList()) {
|
||||
List<IRecipe> iRecipes = new ArrayList<>(CraftingManager.getInstance().getRecipeList());
|
||||
for (IRecipe iRecipe : iRecipes) {
|
||||
if (iRecipe instanceof ShapelessRecipes shapeless) {
|
||||
if (shapeless.recipeItems.size() != 1 || !(shapeless.recipeItems.get(0) instanceof ItemStack)) {
|
||||
continue;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.genetics;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.Tags;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
@@ -8,6 +11,7 @@ import binnie.core.machines.MachineGroup;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.genetics.config.GeneticsConfig;
|
||||
import binnie.genetics.core.GeneticsGUI;
|
||||
import binnie.genetics.core.GeneticsPacket;
|
||||
import binnie.genetics.item.ItemAnalyst;
|
||||
@@ -28,19 +32,29 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(
|
||||
modid = "Genetics",
|
||||
modid = Genetics.GENETICS_MODID,
|
||||
name = "Genetics",
|
||||
version = Tags.VERSION,
|
||||
useMetadata = true,
|
||||
dependencies = "after:BinnieCore")
|
||||
public class Genetics extends AbstractMod {
|
||||
|
||||
public static final String GENETICS_MODID = "Genetics";
|
||||
|
||||
@Mod.Instance("Genetics")
|
||||
public static Genetics instance;
|
||||
|
||||
@SidedProxy(clientSide = "binnie.genetics.proxy.ProxyClient", serverSide = "binnie.genetics.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
|
||||
static {
|
||||
try {
|
||||
ConfigurationManager.registerConfig(GeneticsConfig.class);
|
||||
} catch (ConfigException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static final String CHANNEL = "GEN";
|
||||
|
||||
public static ItemSerumArray itemSerumArray = null;
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
package binnie.extrabees.config;
|
||||
package binnie.genetics.config;
|
||||
|
||||
import static binnie.extrabees.ExtraBees.EB_MODID;
|
||||
import static binnie.genetics.Genetics.GENETICS_MODID;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||
|
||||
@Config(modid = EB_MODID)
|
||||
public class EBConfigMachines {
|
||||
@Config(modid = GENETICS_MODID)
|
||||
public class GeneticsConfig {
|
||||
|
||||
@Config.Comment("Percentage chance of Isolator consuming bee. 0 never consumes, 1 always does.")
|
||||
@Config.RangeFloat(min = 0f, max = 1f)
|
||||
@@ -1,6 +1,5 @@
|
||||
package binnie.genetics.machine;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
@@ -26,7 +25,7 @@ public abstract class PackageGeneticBase extends MachinePackage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
MachineRendererGenetics.instance.renderMachine(machine, renderTexture, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -43,14 +43,7 @@ public class AnalyserComponentFX extends MachineComponent
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1.3 + rand.nextDouble() * 0.2, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionZ = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionY = 0.0;
|
||||
|
||||
@@ -48,9 +48,6 @@ public class InoculatorComponentFX extends MachineComponent
|
||||
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.007 + rand.nextDouble() * 0.002;
|
||||
|
||||
@@ -65,10 +65,10 @@ public class IsolatorComponentFX extends MachineComponent implements IRender.Ran
|
||||
}
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.75, 0.0, 0.0, 0.0) {
|
||||
|
||||
final double axisX = 0.0;
|
||||
final double axisZ = 0.0;
|
||||
final double axisX = posX;
|
||||
final double axisZ = posZ - 0.25;
|
||||
double angle = 0.0;
|
||||
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ import binnie.core.machines.power.ComponentProcessSetCost;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extrabees.config.EBConfigMachines;
|
||||
import binnie.genetics.config.GeneticsConfig;
|
||||
import binnie.genetics.item.ItemSequence;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -100,7 +100,7 @@ public class IsolatorComponentLogic extends ComponentProcessSetCost implements I
|
||||
ItemStack serum = ItemSequence.create(gene);
|
||||
getUtil().setStack(Isolator.SLOT_RESULT, serum);
|
||||
getUtil().decreaseStack(Isolator.SLOT_SEQUENCER_VIAL, 1);
|
||||
if (rand.nextFloat() < EBConfigMachines.isolatorConsumptionChance) {
|
||||
if (rand.nextFloat() < GeneticsConfig.isolatorConsumptionChance) {
|
||||
getUtil().decreaseStack(Isolator.SLOT_TARGET, 1);
|
||||
}
|
||||
getUtil().drainTank(Isolator.TANK_ETHANOL, (int) ethanolPerProcess);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package binnie.genetics.machine.lab;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.machine.ComponentGUIHolder;
|
||||
@@ -20,7 +18,7 @@ public class LabMachinePackage extends PackageGeneticBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||
MachineRendererLab.instance.renderMachine(machine, renderTexture, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -37,9 +37,6 @@ public class PolymeriserComponentFX extends MachineComponent implements IRender.
|
||||
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = -0.006;
|
||||
|
||||
@@ -34,9 +34,6 @@ public class SequencerComponentFX extends MachineComponent implements IRender.Ra
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.0;
|
||||
|
||||
@@ -49,9 +49,6 @@ public class SplicerComponentFX extends MachineComponent
|
||||
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = (rand.nextDouble() - 0.5) * 0.02;
|
||||
|
||||
@@ -19,6 +19,10 @@ import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class SplicerComponentLogic extends ComponentProcessSetCost implements IProcess {
|
||||
|
||||
// Needed to keep stack. If user takes out target slot and it gets automatically refilled, this happens in the same
|
||||
// tick
|
||||
private ItemStack workedOnStack = null;
|
||||
|
||||
public int nOfGenes;
|
||||
|
||||
public SplicerComponentLogic(Machine machine) {
|
||||
@@ -50,6 +54,11 @@ public class SplicerComponentLogic extends ComponentProcessSetCost implements IP
|
||||
public void onInventoryUpdate() {
|
||||
super.onInventoryUpdate();
|
||||
nOfGenes = getGenesToUse();
|
||||
ItemStack newTarget = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
|
||||
if (newTarget == null || !ItemStack.areItemStacksEqual(workedOnStack, newTarget)) {
|
||||
workedOnStack = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getGenesToUse() {
|
||||
@@ -190,5 +199,31 @@ public class SplicerComponentLogic extends ComponentProcessSetCost implements IP
|
||||
Splicer.setGene(gene, target, 1);
|
||||
}
|
||||
getUtil().damageItem(Splicer.SLOT_SERUM_VIAL, 1);
|
||||
workedOnStack = getUtil().getStack(Splicer.SLOT_TARGET).copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean workedOnTarget() {
|
||||
return ItemStack.areItemStacksEqual(workedOnStack, getUtil().getStack(Splicer.SLOT_TARGET));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagCompound tagWorkedOnStack = (NBTTagCompound) nbt.getTag("workedOnStack");
|
||||
if (tagWorkedOnStack != null) {
|
||||
workedOnStack = ItemStack.loadItemStackFromNBT(tagWorkedOnStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
if (workedOnStack != null) {
|
||||
NBTTagCompound tagWorkedOnStack = new NBTTagCompound();
|
||||
workedOnStack.writeToNBT(tagWorkedOnStack);
|
||||
// Need to save, in case inventory is full it might need to get moved out way later.
|
||||
nbt.setTag("workedOnStack", tagWorkedOnStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package binnie.genetics.machine.splicer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.ComponentInventoryTransfer;
|
||||
@@ -79,8 +80,20 @@ public class SplicerPackage extends AdvGeneticMachine.PackageAdvGeneticBase impl
|
||||
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return stack != null && transfer.getMachine().getMachineUtil().getStack(Splicer.SLOT_SERUM_VIAL) != null
|
||||
&& transfer.getMachine().getInterface(SplicerComponentLogic.class).isValidSerum() != null;
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
IMachine machine = transfer.getMachine();
|
||||
boolean hasSerum = machine.getMachineUtil().getStack(Splicer.SLOT_SERUM_VIAL) != null;
|
||||
|
||||
if (hasSerum) {
|
||||
// Move item if it can't be processed anymore with current serum.
|
||||
boolean validSerum = machine.getInterface(SplicerComponentLogic.class).isValidSerum() == null;
|
||||
return !validSerum;
|
||||
} else {
|
||||
// Move item if there is no serum and item got processed already
|
||||
return machine.getMachineUtil().getProcess().workedOnTarget();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user