Compare commits

..
74 changed files with 128 additions and 54 deletions

No files matched your search

+2 -2
View File
@@ -3,9 +3,9 @@ name: Build and test
on:
pull_request:
branches: [ master, main ]
branches: [ master, main, release/** ]
push:
branches: [ master, main ]
branches: [ master, main, release/** ]
jobs:
build-and-test:
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

@@ -10,7 +10,6 @@ import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.inventory.IAEFluidTank;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.gui.MouseRegionManager;
@@ -19,6 +18,7 @@ import com.glodblock.github.util.FCGuiColors;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import appeng.api.parts.IPart;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.GuiSub;
import appeng.core.localization.GuiText;
@@ -103,6 +103,6 @@ public class GuiFluidInterface extends GuiSub {
}
private boolean isPart() {
return this.cont.getTile() instanceof PartFluidInterface;
return this.cont.getTile() instanceof IPart;
}
}
@@ -1,7 +1,10 @@
package com.glodblock.github.common.block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -12,11 +15,17 @@ import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.NameConst;
import appeng.api.util.AEColor;
import appeng.block.AEBaseItemBlock;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSuperStockReplenisher extends FCBaseBlock {
@SideOnly(Side.CLIENT)
private IIcon[] coloredTextures;
public BlockSuperStockReplenisher() {
super(Material.web, NameConst.BLOCK_SUPER_STOCK_REPLENISHER);
setTileEntity(TileSuperStockReplenisher.class);
@@ -25,6 +34,28 @@ public class BlockSuperStockReplenisher extends FCBaseBlock {
this.lightOpacity = 4;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister iconRegistry) {
super.registerBlockIcons(iconRegistry);
this.coloredTextures = new IIcon[AEColor.VALUES.length];
for (final AEColor color : AEColor.VALID_COLORS) {
this.coloredTextures[color.ordinal()] = iconRegistry
.registerIcon(this.getTextureName().replace(":", ":replenisher/") + "_" + color.name());
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
final TileSuperStockReplenisher tile = this.getTileEntity(world, x, y, z);
if (tile != null && tile.getColor() != AEColor.Transparent) {
return this.coloredTextures[tile.getColor().ordinal()];
}
return super.getIcon(world, x, y, z, side);
}
@Override
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX,
float hitY, float hitZ) {
@@ -14,6 +14,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.BaseItemBlockContainer;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileWalrus;
@@ -30,6 +31,8 @@ public class BlockWalrus extends BaseBlockContainer {
setHardness(2.0F);
setResistance(10.0F);
setBlockName(NameConst.BLOCK_WALRUS);
// only used for hit/break particles, the block itself is rendered by RenderBlockWalrus
setBlockTextureName(FluidCraft.MODID + ":" + NameConst.BLOCK_WALRUS + "_particle");
}
@Override
@@ -91,16 +91,11 @@ public class ItemCertusQuartzTank extends BaseItemBlockContainer implements IFlu
if (!container.stackTagCompound.hasKey("tileEntity")
|| container.stackTagCompound.getCompoundTag("tileEntity").hasKey("Empty")) {
NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound());
if (this.capacity < resource.amount) {
fluidTag.setInteger("Amount", this.capacity);
container.stackTagCompound.setTag("tileEntity", fluidTag);
return this.capacity;
}
int finalAmount = Math.min(resource.amount, this.capacity);
NBTTagCompound fluidTag = new FluidStack(resource.getFluid(), finalAmount, resource.tag)
.writeToNBT(new NBTTagCompound());
container.stackTagCompound.setTag("tileEntity", fluidTag);
return resource.amount;
return finalAmount;
}
NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("tileEntity");
@@ -5,10 +5,12 @@ import java.util.stream.IntStream;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -28,6 +30,7 @@ import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.implementations.IPowerChannelState;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkBootingStatusChange;
@@ -45,6 +48,7 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.core.AELog;
@@ -63,7 +67,7 @@ import appeng.util.item.AEItemStack;
import io.netty.buffer.ByteBuf;
public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFluidInventory, IFluidHandler,
IPowerChannelState, IGridTickable, ITerminalHost, IIAEStackInventory {
IPowerChannelState, IGridTickable, ITerminalHost, IIAEStackInventory, IColorableTile {
private final AppEngInternalInventory cell = new AppEngInternalInventory(this, 1);
private final BiggerAppEngInventory invItems = new BiggerAppEngInventory(this, 63);
@@ -87,6 +91,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFl
};
private final BaseActionSource source;
private boolean isPowered;
private AEColor paintedColor = AEColor.Transparent;
private long totalBytes;
private long storedFluidCount;
private long storedItemCount;
@@ -601,17 +606,26 @@ public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFl
@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileSuperStockReplenisher(final ByteBuf data) {
final boolean oldPower = isPowered;
final AEColor oldPaintedColor = this.paintedColor;
isPowered = data.readBoolean();
return isPowered != oldPower;
this.paintedColor = AEColor.fromOrdinal(data.readByte());
this.getProxy().setColor(this.paintedColor);
return isPowered != oldPower || this.paintedColor != oldPaintedColor;
}
@TileEvent(TileEventType.NETWORK_WRITE)
public void writeToStream_TileSuperStockReplenisher(final ByteBuf data) {
data.writeBoolean(isActive());
data.writeByte(this.paintedColor.ordinal());
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBTEvent(NBTTagCompound data) {
final int color = data.hasKey("paintedColor", Constants.NBT.TAG_BYTE) ? data.getByte("paintedColor")
: AEColor.Transparent.ordinal();
this.paintedColor = color >= 0 && color < AEColor.VALUES.length ? AEColor.fromOrdinal(color)
: AEColor.Transparent;
this.getProxy().setColor(this.paintedColor);
invItems.readFromNBT(data, "ItemInv");
invFluids.readFromNBT(data, "FluidInv");
configItems.readFromNBT(data, "configItems");
@@ -626,6 +640,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFl
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
data.setByte("paintedColor", (byte) this.paintedColor.ordinal());
invItems.writeToNBT(data, "ItemInv");
invFluids.writeToNBT(data, "FluidInv");
configItems.writeToNBT(data, "configItems");
@@ -638,6 +653,27 @@ public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFl
return data;
}
@Override
public AEColor getColor() {
return this.paintedColor;
}
@Override
public boolean recolourBlock(final ForgeDirection side, final AEColor newPaintedColor, final EntityPlayer who) {
if (this.paintedColor == newPaintedColor) {
return false;
}
this.paintedColor = newPaintedColor;
this.getProxy().setColor(this.paintedColor);
final IGridNode node = this.getGridNode(side);
if (node != null) {
node.updateState();
}
this.markDirty();
this.markForUpdate();
return true;
}
@MENetworkEventSubscribe
public void stateChange(final MENetworkPowerStatusChange p) {
this.updatePowerState();
@@ -5,8 +5,11 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.tiles.ITileStorageMonitorable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.StorageChannel;
import appeng.util.Platform;
@@ -16,8 +19,8 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) {
if (channel == StorageChannel.FLUIDS) {
if (te instanceof ITileStorageMonitorable) {
return true;
} else return Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable;
return !(te instanceof IPartHost);
} else return getMonitorablePart(te, d, mySrc) != null;
}
return false;
}
@@ -26,14 +29,19 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
@SuppressWarnings("rawtypes")
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) {
if (channel == StorageChannel.FLUIDS) {
if (te instanceof ITileStorageMonitorable
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
} else if (Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable part
&& part.getMonitorable(d, src) != null) {
return part.getMonitorable(d, src).getFluidInventory();
}
if (te instanceof ITileStorageMonitorable tsm) {
final IStorageMonitorable monitorable = tsm.getMonitorable(d, src);
return monitorable != null ? monitorable.getFluidInventory() : null;
} else {
final IStorageMonitorable monitorable = getMonitorablePart(te, d, src);
return monitorable != null ? monitorable.getFluidInventory() : null;
}
}
return null;
}
private static IStorageMonitorable getMonitorablePart(TileEntity te, ForgeDirection d, BaseActionSource src) {
final IPart part = Platform.getPartFromTE(te, d);
return part instanceof ITileStorageMonitorable monitorablePart ? monitorablePart.getMonitorable(d, src) : null;
}
}
@@ -59,8 +59,9 @@ public class WirelessMagnet {
// This method uses the same algorithm as the magnet from draconic evolution
// if changes are ever made, they should be made on both
public static void doMagnet(ItemStack wirelessTerm, EntityPlayer player) {
if (player.ticksExisted % 5 != 0 || player.isSneaking() || !isConfigured(wirelessTerm)) return;
World world = player.worldObj;
final World world = player.worldObj;
if (world.isRemote || player.ticksExisted % 5 != 0 || player.isSneaking() || !isConfigured(wirelessTerm))
return;
final List<EntityItem> items = getEntitiesInRange(
EntityItem.class,
world,
@@ -70,9 +71,7 @@ public class WirelessMagnet {
magnetRange);
final boolean skipPlayerCheck = world.playerEntities.size() < 2;
boolean playSound = false;
// account for the server/client desync
double playerEyesPos = player.posY
+ (world.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight());
double playerEyesPos = player.posY + player.getEyeHeight();
for (EntityItem itemToGet : items) {
if (itemToGet.getEntityItem() == null || itemToGet instanceof EntityFloatingItem) {
@@ -95,6 +94,10 @@ public class WirelessMagnet {
player.posX - 0.2 + (world.rand.nextDouble() * 0.4),
playerEyesPos - 0.62,
player.posZ - 0.2 + (world.rand.nextDouble() * 0.4));
// EntityTracker only syncs item positions every 20 ticks and skips small velocity changes,
// so force both; otherwise the client keeps simulating the item with its old motion.
itemToGet.isAirBorne = true; // force position update
itemToGet.velocityChanged = true; // force velocity update
}
if (playSound) {
@@ -105,33 +108,31 @@ public class WirelessMagnet {
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F));
}
if (!world.isRemote) {
// xp
final List<EntityXPOrb> xpOrbs = getEntitiesInRange(
EntityXPOrb.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
magnetRange);
// xp
final List<EntityXPOrb> xpOrbs = getEntitiesInRange(
EntityXPOrb.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
magnetRange);
for (EntityXPOrb xpToGet : xpOrbs) {
if (xpToGet.field_70532_c == 0 && xpToGet.isEntityAlive()) {
if (!skipPlayerCheck) {
EntityPlayer closestPlayer = world.getClosestPlayerToEntity(xpToGet, magnetRange);
if (closestPlayer == null || closestPlayer != player) continue;
}
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, xpToGet))) continue;
world.playSoundAtEntity(
player,
"random.orb",
0.1F,
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F));
player.onItemPickup(xpToGet, 1);
player.addExperience(xpToGet.xpValue);
xpToGet.setDead();
for (EntityXPOrb xpToGet : xpOrbs) {
if (xpToGet.field_70532_c == 0 && xpToGet.isEntityAlive()) {
if (!skipPlayerCheck) {
EntityPlayer closestPlayer = world.getClosestPlayerToEntity(xpToGet, magnetRange);
if (closestPlayer == null || closestPlayer != player) continue;
}
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, xpToGet))) continue;
world.playSoundAtEntity(
player,
"random.orb",
0.1F,
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F));
player.onItemPickup(xpToGet, 1);
player.addExperience(xpToGet.xpValue);
xpToGet.setDead();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB