Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Stocking Bus #2324

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
.gradle
.settings
/.idea/
.shelf
/.vscode/
/run/
/build/
/eclipse/
.vscode
.classpath
.project
/bin/
Expand All @@ -27,11 +26,13 @@ whitelist.json
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
src/main/resources/mixins.*([!.]).json
*.bat
/src/main/generated/
/src/test/generated/
.DS_Store
classes
*.DS_Store
!gradlew.bat
.factorypath
/.vs
addon.local.gradle
addon.local.gradle.kts
addon.late.local.gradle
addon.late.local.gradle.kts
layout.json
4 changes: 2 additions & 2 deletions src/main/java/gregtech/GT_Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@
guiFactory = "gregtech.client.GT_GuiFactory",
dependencies = " required-after:IC2;" + " required-after:structurelib;"
+ " required-after:gtnhlib@[0.0.8,);"
+ " required-after:modularui@[1.1.12,);"
+ " required-after:modularui@[1.1.18,);"
+ " required-after:appliedenergistics2@[rv3-beta-258,);"
+ " after:dreamcraft;"
+ " after:Forestry;"
+ " after:PFAAGeologica;"
+ " after:Thaumcraft;"
+ " after:Railcraft;"
+ " required-after:appliedenergistics2;"
+ " after:ThermalExpansion;"
+ " after:TwilightForest;"
+ " after:harvestcraft;"
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/gregtech/api/gui/modularui/GT_UITextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public class GT_UITextures {
public static final UITexture OVERLAY_SLOT_ARROW_ME = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/arrow_me");
public static final UITexture OVERLAY_SLOT_PATTERN_ME = UITexture
.fullImage(GregTech.ID, "gui/overlay_slot/pattern_me");

public static final UITexture OVERLAY_SLOT_BEAKER_1 = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/beaker_1");
public static final UITexture OVERLAY_SLOT_BEAKER_2 = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/beaker_2");
public static final UITexture OVERLAY_SLOT_BEE_DRONE = UITexture
.fullImage(GregTech.ID, "gui/overlay_slot/bee_drone");
public static final UITexture OVERLAY_SLOT_BEE_QUEEN = UITexture
.fullImage(GregTech.ID, "gui/overlay_slot/bee_queen");
public static final UITexture OVERLAY_SLOT_BENDER = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/bender");
public static final UITexture OVERLAY_SLOT_BORDER = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/border");
public static final UITexture OVERLAY_SLOT_BOX = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/box");
public static final UITexture OVERLAY_SLOT_BOXED = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/boxed");
public static final UITexture OVERLAY_SLOT_CANISTER = UITexture.fullImage(GregTech.ID, "gui/overlay_slot/canister");
Expand Down Expand Up @@ -368,17 +368,20 @@ public class GT_UITextures {
.fullImage(GregTech.ID, "gui/overlay_button/use_processing_state.png");
public static final UITexture OVERLAY_BUTTON_USE_INVERTED_PROCESSING_STATE = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/use_inverted_processing_state.png");
public static final UITexture OVERLAY_CHUNK_LOADING = UITexture
public static final UITexture OVERLAY_BUTTON_CHUNK_LOADING = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/chunkloading");
public static final UITexture OVERLAY_CHUNK_LOADING_OFF = UITexture
public static final UITexture OVERLAY_BUTTON_CHUNK_LOADING_OFF = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/chunkloading_off");
public static final UITexture OVERLAY_WORK_AREA = UITexture.fullImage(GregTech.ID, "gui/overlay_button/work_area");
public static final UITexture OVERLAY_REPLACE_COBBLE_ON = UITexture
public static final UITexture OVERLAY_BUTTON_WORK_AREA = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/work_area");
public static final UITexture OVERLAY_BUTTON_REPLACE_COBBLE_ON = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/replace_cobble_on");
public static final UITexture OVERLAY_REPLACE_COBBLE_OFF = UITexture
public static final UITexture OVERLAY_BUTTON_REPLACE_COBBLE_OFF = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/replace_cobble_off");
public static final UITexture OVERLAY_RETRACT_PIPE = UITexture
public static final UITexture OVERLAY_BUTTON_RETRACT_PIPE = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/retract_pipes");
public static final UITexture OVERLAY_BUTTON_APPLY_TO_ALL = UITexture
.fullImage(GregTech.ID, "gui/overlay_button/apply_to_all");

/**
* Can adjust size as needed.
Expand Down
29 changes: 17 additions & 12 deletions src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,22 @@ public void doExplosion(long aExplosionPower) {
tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true);
}

/**
* Dismantles this machine, as if it were broken by player with wrench.
*/
public void dismantle() {
int x = getBaseMetaTileEntity().getXCoord();
int y = getBaseMetaTileEntity().getYCoord();
int z = getBaseMetaTileEntity().getZCoord();
World world = getBaseMetaTileEntity().getWorld();
Block block = world.getBlock(x, y, z);
int blockMeta = world.getBlockMetadata(x, y, z);

block.dropBlockAsItem(world, x, y, z, blockMeta, 0);
world.setBlock(x, y, z, Blocks.air);
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (blockMeta << 12));
}

@Override
public int getLightOpacity() {
return ((BaseMetaTileEntity) getBaseMetaTileEntity()).getLightValue() > 0 ? 0 : 255;
Expand Down Expand Up @@ -1203,29 +1219,18 @@ public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDat
.name()));

if (this instanceof IPowerChannelState state) {
// adapted from PowerStateWailaDataProvider
final NBTTagCompound tag = accessor.getNBTData();
final boolean isActive = tag.getBoolean("isActive");
final boolean isPowered = tag.getBoolean("isPowered");
final boolean isBooting = tag.getBoolean("isBooting");

if (isBooting) {
currenttip.add(WailaText.Booting.getLocal());
} else if (isActive && isPowered) {
currenttip.add(WailaText.DeviceOnline.getLocal());
} else if (isPowered) {
currenttip.add(WailaText.DeviceMissingChannel.getLocal());
} else {
currenttip.add(WailaText.DeviceOffline.getLocal());
}
currenttip.add(WailaText.getPowerState(isActive, isPowered, isBooting));
}
}

@Override
public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y,
int z) {
if (this instanceof IPowerChannelState state) {
// adapted from PowerStateWailaDataProvider
final boolean isActive = state.isActive();
final boolean isPowered = state.isPowered();
final boolean isBooting = state.isBooting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
Expand Down Expand Up @@ -89,7 +88,6 @@
import gregtech.common.GT_Pollution;
import gregtech.common.gui.modularui.widget.CheckRecipeResultSyncer;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_InputBus_ME;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME;
import gregtech.common.tileentities.machines.IDualInputHatch;
Expand Down Expand Up @@ -179,7 +177,7 @@ public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) {
}

/**
* @deprecated Use {@link GT_Utility#filterValidMTEs)}
* @deprecated Use {@link GT_Utility#filterValidMTEs}
*/
@Deprecated
public static <T extends MetaTileEntity> List<T> filterValidMetaTileEntities(Collection<T> metaTileEntities) {
Expand Down Expand Up @@ -1369,26 +1367,19 @@ public ArrayList<ItemStack> getStoredInputs() {
}

ArrayList<ItemStack> rList = new ArrayList<>();
HashMap<String, ItemStack> rInputBusMeList = new HashMap<>();
for (GT_MetaTileEntity_Hatch_InputBus tHatch : filterValidMTEs(mInputBusses)) {
tHatch.mRecipeMap = getRecipeMap();
IGregTechTileEntity tileEntity = tHatch.getBaseMetaTileEntity();
if (tHatch instanceof GT_MetaTileEntity_Hatch_InputBus_ME) {
for (int i = tileEntity.getSizeInventory() - 1; i >= 0; i--) {
ItemStack itemStack = tileEntity.getStackInSlot(i);
if (itemStack != null) rInputBusMeList.put(itemStack.toString(), itemStack);
}
} else {
for (int i = tileEntity.getSizeInventory() - 1; i >= 0; i--) {
ItemStack itemStack = tileEntity.getStackInSlot(i);
if (itemStack != null) rList.add(itemStack);
for (int i = tileEntity.getSizeInventory() - 1; i >= 0; i--) {
ItemStack itemStack = tileEntity.getStackInSlot(i);
if (itemStack != null) {
rList.add(itemStack);
}
}
}

if (getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName()
.startsWith("gt.integrated_circuit")) rList.add(getStackInSlot(1));
if (!rInputBusMeList.isEmpty()) rList.addAll(rInputBusMeList.values());
return rList;
}

Expand Down
Loading
Loading