Compare commits

...
11 Commits
Author SHA1 Message Date
Martin Robertz 76f2ddf18e Merge pull request #13 from GTNewHorizons/overflow
fix int overflow in fluid storage cell
2022-09-01 11:32:26 +02:00
GlodBlock 6a69f807f1 update ec2 dep 2022-08-31 23:33:11 +08:00
GlodBlock b9d82c5da5 fix oversight in nbt load 2022-08-31 23:32:46 +08:00
GlodBlock 72270a3f64 use long for data storage 2022-08-31 23:06:09 +08:00
Yang Xizhi 89ca4b8313 fix oversight
fix https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11138
2022-08-27 17:42:26 +08:00
Martin Robertz 52031271b4 Merge pull request #12 from GTNewHorizons/oc
fix oc driver register crash
2022-08-23 08:20:11 +02:00
GlodBlock 88ccb54fe3 fix oc driver register crash 2022-08-23 10:07:01 +08:00
Martin Robertz bba4eb14cc Merge pull request #11 from GTNewHorizons/render-fix
fix render npe from certain liquids
2022-08-22 10:53:54 +02:00
GlodBlock de3715cbf3 subnet fluid check 2022-08-22 15:11:50 +08:00
GlodBlock acf8ab44d7 remove unnecessary update event 2022-08-22 14:44:46 +08:00
GlodBlock c7925b2b6c fix npe from drops render 2022-08-22 14:38:43 +08:00
6 changed files with 26 additions and 16 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ dependencies {
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-92-GTNH:dev')
compile('curse.maven:cofh-core-69162:2388751')
compile('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive = false}
compile('com.github.GTNewHorizons:ExtraCells2:2.5.20:dev') {transitive = false}
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.5:dev")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.7:dev")
@@ -4,6 +4,7 @@ import appeng.api.AEApi;
import appeng.api.config.Upgrades;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.FluidCellHandler;
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.loader.ChannelLoader;
import com.glodblock.github.loader.ItemAndBlockHolder;
@@ -43,6 +44,9 @@ public class FluidCraft {
@Mod.EventHandler
public static void init(FMLInitializationEvent event) {
ModAndClassUtil.init();
if (ModAndClassUtil.OC) {
OCDriverInit.run();
}
proxy.init(event);
}
@@ -82,8 +82,15 @@ public class ItemDropRender implements IItemRenderer {
}
int colour = fluid.getColor();
if (colour == 0xFFFFFF) {
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks()
.getTextureExtry(fluid.getStillIcon().getIconName());
TextureAtlasSprite sprite;
try {
sprite = Minecraft.getMinecraft().getTextureMapBlocks()
.getTextureExtry(fluid.getStillIcon().getIconName());
} catch (NullPointerException e) {
colourCache.put(fluid.getName(), colour);
return colour;
}
if (sprite != null && sprite.getFrameCount() > 0) {
int[][] image = sprite.getFrameTextureData(0);
int r = 0, g = 0, b = 0, count = 0;
@@ -3,7 +3,6 @@ package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileOCPatternEditor;
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
@@ -44,7 +43,6 @@ public class BlockOCPatternEditor extends FCBaseBlock {
if (ModAndClassUtil.OC) {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_OC_PATTERN_EDITOR);
GameRegistry.registerTileEntity(TileOCPatternEditor.class, NameConst.BLOCK_OC_PATTERN_EDITOR);
OCDriverInit.run();
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -31,7 +31,7 @@ public class FluidCellInventory implements IFluidCellInventory {
private final ItemStack cellItem;
private final ISaveProvider container;
private final static int MAX_TYPE = 1;
private int storedFluidCount;
private long storedFluidCount;
private short storedFluids;
private IItemList<IAEFluidStack> cellItems;
private final NBTTagCompound tagCompound;
@@ -78,7 +78,7 @@ public class FluidCellInventory implements IFluidCellInventory {
this.container = container;
this.tagCompound = Platform.openNbtData( o );
this.storedFluids = this.tagCompound.getShort( FLUID_TYPE_TAG );
this.storedFluidCount = this.tagCompound.getInteger( FLUID_COUNT_TAG );
this.storedFluidCount = this.tagCompound.getLong( FLUID_COUNT_TAG );
this.cellItems = null;
}
@@ -221,14 +221,15 @@ public class FluidCellInventory implements IFluidCellInventory {
for( int x = 0; x < types; x++ )
{
final FluidStack t = FluidStack.loadFluidStackFromNBT( this.tagCompound.getCompoundTag( fluidSlots[x] ) );
final AEFluidStack aet = AEFluidStack.create( t );
if( t != null )
if( aet != null )
{
t.amount = this.tagCompound.getInteger( fluidSlotCount[x] );
aet.setStackSize( this.tagCompound.getLong( fluidSlotCount[x] ) );
if( t.amount > 0 )
if( aet.getStackSize() > 0 )
{
this.cellItems.add( AEFluidStack.create( t ) );
this.cellItems.add( aet );
}
}
}
@@ -247,12 +248,12 @@ public class FluidCellInventory implements IFluidCellInventory {
private void updateFluidCount( final long delta )
{
this.storedFluidCount += delta;
this.tagCompound.setInteger( FLUID_COUNT_TAG, this.storedFluidCount );
this.tagCompound.setLong( FLUID_COUNT_TAG, this.storedFluidCount );
}
private void saveChanges()
{
int itemCount = 0;
long itemCount = 0;
int x = 0;
@@ -277,7 +278,7 @@ public class FluidCellInventory implements IFluidCellInventory {
* NBTBase tagSlotCount = tagCompound.getTag( itemSlotCount[x] ); if ( tagSlotCount instanceof
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
*/
this.tagCompound.setInteger( fluidSlotCount[x], (int) v.getStackSize() );
this.tagCompound.setLong( fluidSlotCount[x], v.getStackSize() );
x++;
}
@@ -312,7 +313,7 @@ public class FluidCellInventory implements IFluidCellInventory {
}
else
{
this.tagCompound.setInteger( FLUID_COUNT_TAG, itemCount );
this.tagCompound.setLong( FLUID_COUNT_TAG, itemCount );
}
// clean any old crusty stuff...
@@ -24,7 +24,7 @@ public class NEIUtils {
if (currentStack.stackSize == 0) continue;
boolean find = false;
for (OrderStack<?> storedStack : comp) {
if (storedStack == null || !(orderStack.getStack() instanceof ItemStack)) continue;
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack)) continue;
ItemStack firstStack = (ItemStack) storedStack.getStack();
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {