Skip to content
Open
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
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ Here is a list of implemented feature and considered features to be implemented:
- [x] deposit upgrade (b/a)
- [x] restock upgrade (b/a)
- [x] filter upgrade (b/a)
- [ ] magnet upgrade (b/a)
- [ ] void upgrade (b/a)
- [x] magnet upgrade (b/a)
- [x] void upgrade (b/a)
- [x] refill_upgrade (b/a)
- [x] compacting_upgrade (b/a)
- [x] crafting upgrade
- [ ] everlasting upgrade
- [ ] jukebox upgrade (low priority)
- [x] everlasting upgrade
- [x] tool_swapper_upgrade (b/a)
- [x] jukebox upgrade (low priority)
- [x] tank_upgrade
- [x] pump_upgrade (b/a)
- [x] battery_upgrade
- [x] mob_catcher_upgrade (b/a)

## Disclaimer

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id("maven-publish")
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
id("eclipse")
id("com.gtnewhorizons.retrofuturagradle") version "1.3.27"
id("com.gtnewhorizons.retrofuturagradle") version "1.4.9"
id("com.matthewprenger.cursegradle") version "1.4.0"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.cleanroommc.retrosophisticatedbackpacks.capability;

import com.cleanroommc.retrosophisticatedbackpacks.capability.upgrade.*;
import com.cleanroommc.retrosophisticatedbackpacks.capability.upgrade.mobcatcher.MobCatcherUpgradeWrapper;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -44,6 +45,63 @@ public final class Capabilities {
@CapabilityInject(AdvancedFilterUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedFilterUpgradeWrapper> ADVANCED_FILTER_UPGRADE_WRAPPER_CAPABILITY = null;

@CapabilityInject(MagnetUpgradeWrapper.class)
public static final @NotNull Capability<MagnetUpgradeWrapper> MAGNET_UPGRADE_CAPABILITY = null;

@CapabilityInject(AdvancedMagnetUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedMagnetUpgradeWrapper> ADVANCED_MAGNET_UPGRADE_CAPABILITY = null;

@CapabilityInject(VoidUpgradeWrapper.class)
public static final @NotNull Capability<VoidUpgradeWrapper> VOID_UPGRADE_CAPABILITY = null;

@CapabilityInject(AdvancedVoidUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedVoidUpgradeWrapper> ADVANCED_VOID_UPGRADE_CAPABILITY = null;

@CapabilityInject(RefillUpgradeWrapper.class)
public static final @NotNull Capability<RefillUpgradeWrapper> REFILL_UPGRADE_CAPABILITY = null;

@CapabilityInject(AdvancedRefillUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedRefillUpgradeWrapper> ADVANCED_REFILL_UPGRADE_CAPABILITY = null;

@CapabilityInject(CompactingUpgradeWrapper.class)
public static final @NotNull Capability<CompactingUpgradeWrapper> COMPACTING_UPGRADE_CAPABILITY = null;

@CapabilityInject(AdvancedCompactingUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedCompactingUpgradeWrapper> ADVANCED_COMPACTING_UPGRADE_CAPABILITY = null;

@CapabilityInject(EverlastingUpgradeWrapper.class)
public static final @NotNull Capability<EverlastingUpgradeWrapper> EVERLASTING_UPGRADE_CAPABILITY = null;

@CapabilityInject(ToolSwapperUpgradeWrapper.class)
public static final @NotNull Capability<ToolSwapperUpgradeWrapper> TOOL_SWAPPER_UPGRADE_CAPABILITY = null;

@CapabilityInject(AdvancedToolSwapperUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedToolSwapperUpgradeWrapper> ADVANCED_TOOL_SWAPPER_UPGRADE_CAPABILITY = null;

@CapabilityInject(TankUpgradeWrapper.class)
public static final @NotNull Capability<TankUpgradeWrapper> TANK_UPGRADE_CAPABILITY = null;

@CapabilityInject(JukeboxUpgradeWrapper.class)
public static final @NotNull Capability<JukeboxUpgradeWrapper> JUKEBOX_UPGRADE_CAPABILITY = null;

@CapabilityInject(AdvancedJukeboxUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedJukeboxUpgradeWrapper> ADVANCED_JUKEBOX_UPGRADE_CAPABILITY = null;

@CapabilityInject(PumpUpgradeWrapper.class)
public static final @NotNull Capability<PumpUpgradeWrapper> PUMP_UPGRADE_CAPABILITY = null;

@CapabilityInject(AdvancedPumpUpgradeWrapper.class)
public static final @NotNull Capability<AdvancedPumpUpgradeWrapper> ADVANCED_PUMP_UPGRADE_CAPABILITY = null;

@CapabilityInject(BatteryUpgradeWrapper.class)
public static final @NotNull Capability<BatteryUpgradeWrapper> BATTERY_UPGRADE_CAPABILITY = null;

@CapabilityInject(AnvilUpgradeWrapper.class)
public static final @NotNull Capability<AnvilUpgradeWrapper> ANVIL_UPGRADE_CAPABILITY = null;

@CapabilityInject(MobCatcherUpgradeWrapper.class)
public static final @NotNull Capability<MobCatcherUpgradeWrapper> MOB_CATCHER_UPGRADE_CAPABILITY = null;

// Abstract capabilities
@CapabilityInject(UpgradeWrapper.class)
public static final @NotNull Capability<UpgradeWrapper<?>> UPGRADE_CAPABILITY = null;
Expand Down Expand Up @@ -71,4 +129,37 @@ public final class Capabilities {

@CapabilityInject(IFilterUpgrade.class)
public static final @NotNull Capability<IFilterUpgrade> IFILTER_UPGRADE_CAPABILITY = null;

@CapabilityInject(IMagnetUpgrade.class)
public static final @NotNull Capability<IMagnetUpgrade> IMAGNET_UPGRADE_CAPABILITY = null;

@CapabilityInject(IVoidUpgrade.class)
public static final @NotNull Capability<IVoidUpgrade> IVOID_UPGRADE_CAPABILITY = null;

@CapabilityInject(IRefillUpgrade.class)
public static final @NotNull Capability<IRefillUpgrade> IREFILL_UPGRADE_CAPABILITY = null;

@CapabilityInject(ICompactingUpgrade.class)
public static final @NotNull Capability<ICompactingUpgrade> ICOMPACTING_UPGRADE_CAPABILITY = null;

@CapabilityInject(IEverlastingUpgrade.class)
public static final @NotNull Capability<IEverlastingUpgrade> IEVERLASTING_UPGRADE_CAPABILITY = null;

@CapabilityInject(IToolSwapperUpgrade.class)
public static final @NotNull Capability<IToolSwapperUpgrade> ITOOL_SWAPPER_UPGRADE_CAPABILITY = null;

@CapabilityInject(ITankUpgrade.class)
public static final @NotNull Capability<ITankUpgrade> ITANK_UPGRADE_CAPABILITY = null;

@CapabilityInject(IJukeboxUpgrade.class)
public static final @NotNull Capability<IJukeboxUpgrade> IJUKEBOX_UPGRADE_CAPABILITY = null;

@CapabilityInject(IPumpUpgrade.class)
public static final @NotNull Capability<IPumpUpgrade> IPUMP_UPGRADE_CAPABILITY = null;

@CapabilityInject(IBatteryUpgrade.class)
public static final @NotNull Capability<IBatteryUpgrade> IBATTERY_UPGRADE_CAPABILITY = null;

@CapabilityInject(IAnvilUpgrade.class)
public static final @NotNull Capability<IAnvilUpgrade> IANVIL_UPGRADE_CAPABILITY = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.cleanroommc.retrosophisticatedbackpacks.client;

import net.minecraft.client.renderer.GlStateManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL14;

import java.nio.ByteBuffer;

@SideOnly(Side.CLIENT)
public final class RenderStateHelper {
private static final ByteBuffer COLOR_MASK = BufferUtils.createByteBuffer(16);

private RenderStateHelper() {
}

public static void syncGlStateManagerCache() {
forceSetToggle(GL11.glIsEnabled(GL11.GL_DEPTH_TEST), GlStateManager::enableDepth, GlStateManager::disableDepth);
forceSetToggle(GL11.glIsEnabled(GL11.GL_BLEND), GlStateManager::enableBlend, GlStateManager::disableBlend);
forceSetToggle(GL11.glIsEnabled(GL11.GL_CULL_FACE), GlStateManager::enableCull, GlStateManager::disableCull);
forceSetToggle(GL11.glIsEnabled(GL11.GL_LIGHTING), GlStateManager::enableLighting, GlStateManager::disableLighting);
forceSetToggle(GL11.glIsEnabled(GL11.GL_ALPHA_TEST), GlStateManager::enableAlpha, GlStateManager::disableAlpha);
forceSetToggle(GL11.glIsEnabled(GL11.GL_FOG), GlStateManager::enableFog, GlStateManager::disableFog);
GlStateManager.setActiveTexture(GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE));
forceSetToggle(GL11.glIsEnabled(GL11.GL_TEXTURE_2D), GlStateManager::enableTexture2D, GlStateManager::disableTexture2D);
forceSetToggle(GL11.glIsEnabled(GL12.GL_RESCALE_NORMAL), GlStateManager::enableRescaleNormal, GlStateManager::disableRescaleNormal);

boolean depthMask = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
GlStateManager.depthMask(!depthMask);
GlStateManager.depthMask(depthMask);
GlStateManager.depthFunc(GL11.glGetInteger(GL11.GL_DEPTH_FUNC));
GlStateManager.alphaFunc(GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC), GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF));
GlStateManager.tryBlendFuncSeparate(
GL11.glGetInteger(GL14.GL_BLEND_SRC_RGB),
GL11.glGetInteger(GL14.GL_BLEND_DST_RGB),
GL11.glGetInteger(GL14.GL_BLEND_SRC_ALPHA),
GL11.glGetInteger(GL14.GL_BLEND_DST_ALPHA)
);
syncColorMask();

GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.color(0.0F, 0.0F, 0.0F, 0.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.bindTexture(GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D));
}

private static void syncColorMask() {
COLOR_MASK.clear();
GL11.glGetBoolean(GL11.GL_COLOR_WRITEMASK, COLOR_MASK);
GlStateManager.colorMask(COLOR_MASK.get(0) != 0, COLOR_MASK.get(1) != 0, COLOR_MASK.get(2) != 0, COLOR_MASK.get(3) != 0);
}

private static void forceSetToggle(boolean desired, Runnable enable, Runnable disable) {
if (desired) {
disable.run();
enable.run();
} else {
enable.run();
disable.run();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.cleanroommc.retrosophisticatedbackpacks.mixin;

import net.minecraft.entity.item.EntityItem;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(EntityItem.class)
public interface EntityItemAccessor {
@Accessor("pickupDelay")
int rsb$getPickupDelay();

@Accessor("age")
void rsb$setAge(int age);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.cleanroommc.retrosophisticatedbackpacks.mixin;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(GuiContainer.class)
public interface GuiContainerAccessor {
@Accessor("guiLeft")
int getGuiLeft();

@Accessor("guiTop")
int getGuiTop();

@Invoker("getSlotAtPosition")
Slot rsb$getSlotAtPosition(int mouseX, int mouseY);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cleanroommc.retrosophisticatedbackpacks.mixin;

import com.cleanroommc.retrosophisticatedbackpacks.handler.ClientGuiStashHandler;
import com.cleanroommc.retrosophisticatedbackpacks.handler.KeyInputHandler;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
Expand All @@ -14,4 +15,11 @@ public class GuiContainerMixin extends GuiScreen {
private void keyTyped(char typedChar, int keyCode, CallbackInfo info) {
KeyInputHandler.onKeyInputInGuiScreen(keyCode);
}

@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
private void rsb$mouseClicked(int mouseX, int mouseY, int mouseButton, CallbackInfo info) {
if (ClientGuiStashHandler.handleMouseClicked((GuiContainer) (Object) this, mouseX, mouseY, mouseButton)) {
info.cancel();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object RetroSophisticatedBackpacks {
appleCoreLoaded = Loader.isModLoaded("applecore")

proxy.preInit(event)

FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", OneProbePlugin::class.java.name)
}

Expand Down
Loading