Compare commits

..

5 commits

Author SHA1 Message Date
Flanks255
8104cc4be2 Marking stuff off. 2024-03-16 13:23:04 -05:00
Flanks255
d9cae5b5f3 ACTUALLY added copper... 2024-03-16 13:08:38 -05:00
Flanks255
6005bee8d2 Added Copper ores to mining lens.
Added Xycraft ores to mining lens.
2024-03-16 12:37:17 -05:00
Flanks255
db3a550070 Bump for FC release. 2024-03-16 12:26:01 -05:00
Flanks255
87601c1e6e Fixed removing filters from filterable inventories.
Added the void sack recipe.
Fixed the void sack.
2024-03-16 12:25:35 -05:00
30 changed files with 490 additions and 208 deletions

View file

@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false org.gradle.daemon=false
# Actually Additions # Actually Additions
mod_version=1.2.8 mod_version=1.2.10
# Forge # Forge
game_version=1.20.4 game_version=1.20.4

46
port.MD
View file

@ -1,19 +1,19 @@
# Remove # Remove
- [ ] Lush caves - [x] Lush caves
- [x] 11 lens (lens of disruption) - [x] 11 lens (lens of disruption)
- [ ] Smiley cloud - [x] Smiley cloud
- [x] Occasional solidified XP drop from mobs - [x] Occasional solidified XP drop from mobs
- [x] Treasure chests - [x] Treasure chests
- [x] Composter and bio-mash, biomass, bio coal and fertilizer - [x] Composter and bio-mash, biomass, bio coal and fertilizer
- [x] Charcoal blocks - [x] Charcoal blocks
- [x] Ender pearl blocks - [x] Ender pearl blocks
- [x] ESDs - [x] ESDs
- [ ] Fishing nets - [x] Fishing nets
- [ ] Solar panels - [x] Solar panels
- [X] Item repairers - [X] Item repairers
- [x] Knife (food can just be crafted normally) - [x] Knife (food can just be crafted normally)
- [X] Black lotuses and black dye - [X] Black lotuses and black dye
- [ ] Chest to storage crate upgrade (makes little sense with the way they are being changed), keep the other ones though - [x] Chest to storage crate upgrade (makes little sense with the way they are being changed), keep the other ones though
- [x] Ring of liquid banning - [x] Ring of liquid banning
- [x] Emerald and obsidian armor and tools - [x] Emerald and obsidian armor and tools
- [x] Black quartz armor and tools - [x] Black quartz armor and tools
@ -22,8 +22,8 @@
- [x] Jam villager and jams - [x] Jam villager and jams
- [x] Potion rings - [x] Potion rings
- [x] Fur balls - [x] Fur balls
- [ ] The food (except for stuff used elsewhere like the coffee) - [x] The food (except for stuff used elsewhere like the coffee)
- [ ] The weird rainbow colored item names, except for the crystals which should keep their color-matching names - [x] The weird rainbow colored item names, except for the crystals which should keep their color-matching names
# Change # Change
- [ ] Make crystal clusters spawn in amethyst nodes in 1.18, leave unused in 1.16 (same with crystal shards) - [ ] Make crystal clusters spawn in amethyst nodes in 1.18, leave unused in 1.16 (same with crystal shards)
@ -52,44 +52,44 @@
# Keep As Is # Keep As Is
- [X] Battery box - [X] Battery box
- [ ] Item interfaces and item laser system - [ ] Item interfaces and item laser system
- [ ] Farmer - [x] Farmer
- [x] Empowerer and display stands - [x] Empowerer and display stands
- [x] Tiny torch - [x] Tiny torch
- [ ] Shock absorber - [ ] Shock absorber
- [ ] Player interface - [x] Player interface
- [ ] Vertical digger - [ ] Vertical digger
- [ ] Atomic reconstructor - [x] Atomic reconstructor
- [ ] Ranged collector - [x] Ranged collector
- [ ] Breakers, placers and long-range breakers, as well as fluid variants - [ ] Breakers, placers and long-range breakers, as well as fluid variants
- [ ] Leaf-eating generator - [ ] Leaf-eating generator
- [ ] Lamps and lamp controller - [ ] Lamps and lamp controller
- [ ] Lava factory controller - [ ] Lava factory controller
- [ ] The entire canola system - [x] The entire canola system
- [ ] Phantomfaces and their variants - [x] Phantomfaces and their variants
- [ ] Feeder - [ ] Feeder
- [ ] Crusher and double crusher - [ ] Crusher and double crusher
- [ ] Heat collectors - [ ] Heat collectors
- [x] Precision dropper - [x] Precision dropper
- [x] Engineer's goggles - [x] Engineer's goggles
- [ ] Laser relay modifiers and wrench - [ ] Laser relay modifiers and wrench
- [ ] Handheld filler - [x] Handheld filler
- [ ] Sacks - [x] Sacks
- [ ] Player probe - [x] Player probe
- [ ] Item filter - [x] Item filter
- [ ] Water bowl - [ ] Water bowl
- [x] Tiny coal and charcoal - [x] Tiny coal and charcoal
- [ ] Rice slimeballs - [x] Rice slimeballs
- [ ] Storage crate keeper - [ ] Storage crate keeper
- [ ] Color, detonation, certain death, killer and disenchanting lenses - [x] Color, detonation, certain death, killer and disenchanting lenses
- [ ] Storage crate upgrades, except for the "chest to storage crate" one - [ ] Storage crate upgrades, except for the "chest to storage crate" one
- [ ] Ring of growth - [ ] Ring of growth
- [ ] Ring of magnetization - [x] Ring of magnetization
- [x] Teleport staff - [x] Teleport staff
- [ ] Wings of the Bats and wing items dropped from bats - [ ] Wings of the Bats and wing items dropped from bats
- [ ] Drills and drill upgrades - [x] Drills and drill upgrades
- [ ] Batteries - [x] Batteries
- [x] Crafting table on a stick - [x] Crafting table on a stick
- [x] Leaf blowers - [x] Leaf blowers
- [ ] The book - [ ] The book
- [x] The Crystal Flux name and rainbow effect - [x] The Crystal Flux name and rainbow effect
- [ ] Engineer's village house and engineer villager - [x] Engineer's village house and engineer villager

View file

@ -1,4 +1,4 @@
// 1.20.4 2024-03-14T17:01:13.6665594 Item Recipes // 1.20.4 2024-03-16T12:15:55.7079887 Item Recipes
d374edde9294d1a224b4b5610b50117a11328c00 data/actuallyadditions/recipes/advanced_coil.json d374edde9294d1a224b4b5610b50117a11328c00 data/actuallyadditions/recipes/advanced_coil.json
f67629e45d152c96f3467a90a67520f78ecf9f07 data/actuallyadditions/recipes/advanced_leaf_blower.json f67629e45d152c96f3467a90a67520f78ecf9f07 data/actuallyadditions/recipes/advanced_leaf_blower.json
d65e5a70232fa2f0e74d2a67c1cd4b0e87124242 data/actuallyadditions/recipes/basic_coil.json d65e5a70232fa2f0e74d2a67c1cd4b0e87124242 data/actuallyadditions/recipes/basic_coil.json
@ -118,5 +118,6 @@ b4aa29ef0d47b557f354a23cb6ee8ef60d273de3 data/actuallyadditions/recipes/teleport
5745a05f877fce254a1990f1e89f80e91846e270 data/actuallyadditions/recipes/tiny_to_coal.json 5745a05f877fce254a1990f1e89f80e91846e270 data/actuallyadditions/recipes/tiny_to_coal.json
91bebb02fc416a650eea26c2d87049de91866cf0 data/actuallyadditions/recipes/travelers_sack.json 91bebb02fc416a650eea26c2d87049de91866cf0 data/actuallyadditions/recipes/travelers_sack.json
89c9512eeb746befb1bdc31037baa9bd86220f74 data/actuallyadditions/recipes/triple_battery.json 89c9512eeb746befb1bdc31037baa9bd86220f74 data/actuallyadditions/recipes/triple_battery.json
babb9a9e8a18d124c235df9214265c84738b0c1d data/actuallyadditions/recipes/void_sack.json
0737014abee48f688982412297e04e994aa6f9a6 data/actuallyadditions/recipes/wings_of_the_bats.json 0737014abee48f688982412297e04e994aa6f9a6 data/actuallyadditions/recipes/wings_of_the_bats.json
c80073fcade3cdcb15f28c4a1cb12df4ae6cf4ec data/actuallyadditions/recipes/wooden_aiot.json c80073fcade3cdcb15f28c4a1cb12df4ae6cf4ec data/actuallyadditions/recipes/wooden_aiot.json

View file

@ -1,5 +1,6 @@
// 1.20.4 2024-03-14T16:41:17.9423551 Mining Lens Recipes // 1.20.4 2024-03-16T13:05:21.230216 Mining Lens Recipes
2e77c114530406cd2b3c59a921817803bb718b68 data/actuallyadditions/recipes/mininglens/deepslate_deepslate_coal_ore.json 2e77c114530406cd2b3c59a921817803bb718b68 data/actuallyadditions/recipes/mininglens/deepslate_deepslate_coal_ore.json
21c9c0a0457e212098f377bd95950f98dffd4f20 data/actuallyadditions/recipes/mininglens/deepslate_deepslate_copper_ore.json
e791752df12b4dd6c337e160857117f298bbe52b data/actuallyadditions/recipes/mininglens/deepslate_deepslate_diamond_ore.json e791752df12b4dd6c337e160857117f298bbe52b data/actuallyadditions/recipes/mininglens/deepslate_deepslate_diamond_ore.json
00cb1642560fbd392263735bc697e5a24417b612 data/actuallyadditions/recipes/mininglens/deepslate_deepslate_emerald_ore.json 00cb1642560fbd392263735bc697e5a24417b612 data/actuallyadditions/recipes/mininglens/deepslate_deepslate_emerald_ore.json
b9e872f89dc2c45d54ee0215a4a335949baee42a data/actuallyadditions/recipes/mininglens/deepslate_deepslate_gold_ore.json b9e872f89dc2c45d54ee0215a4a335949baee42a data/actuallyadditions/recipes/mininglens/deepslate_deepslate_gold_ore.json
@ -11,6 +12,7 @@ f1c2091a2c4bbb81e1908bb9c4ebbcc0bae492b2 data/actuallyadditions/recipes/miningle
7227ee2a53f520facb7fe8f7b34a1a74c9a49e85 data/actuallyadditions/recipes/mininglens/nether_nether_quartz_ore.json 7227ee2a53f520facb7fe8f7b34a1a74c9a49e85 data/actuallyadditions/recipes/mininglens/nether_nether_quartz_ore.json
de47fcc5b2acc4f0511e95de63b9b084a2dfbaad data/actuallyadditions/recipes/mininglens/stone_black_quartz_ore.json de47fcc5b2acc4f0511e95de63b9b084a2dfbaad data/actuallyadditions/recipes/mininglens/stone_black_quartz_ore.json
550a0fe3577fcdaf0e1af1b2e3a518256992e00b data/actuallyadditions/recipes/mininglens/stone_coal_ore.json 550a0fe3577fcdaf0e1af1b2e3a518256992e00b data/actuallyadditions/recipes/mininglens/stone_coal_ore.json
a572a63ce7259b176bf45409cfde9744edba0730 data/actuallyadditions/recipes/mininglens/stone_copper_ore.json
869a51e0fc919b7a4577bb7c466ca07a6ae0370b data/actuallyadditions/recipes/mininglens/stone_diamond_ore.json 869a51e0fc919b7a4577bb7c466ca07a6ae0370b data/actuallyadditions/recipes/mininglens/stone_diamond_ore.json
f74f71eb82bc63538662217d9b0eb136bd262618 data/actuallyadditions/recipes/mininglens/stone_emerald_ore.json f74f71eb82bc63538662217d9b0eb136bd262618 data/actuallyadditions/recipes/mininglens/stone_emerald_ore.json
231db303e6f5b38fee1beec4dfb7e37932b50b8a data/actuallyadditions/recipes/mininglens/stone_gold_ore.json 231db303e6f5b38fee1beec4dfb7e37932b50b8a data/actuallyadditions/recipes/mininglens/stone_gold_ore.json

View file

@ -0,0 +1,10 @@
{
"type": "actuallyadditions:mining_lens",
"ingredient": {
"item": "minecraft:deepslate"
},
"result": {
"item": "minecraft:deepslate_copper_ore"
},
"weight": 3000
}

View file

@ -0,0 +1,10 @@
{
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "minecraft:copper_ore"
},
"weight": 5000
}

View file

@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "actuallyadditions:travelers_sack"
},
{
"tag": "forge:ender_pearls"
},
{
"tag": "forge:obsidian"
},
{
"item": "actuallyadditions:void_crystal_block"
}
],
"result": {
"item": "actuallyadditions:void_sack"
}
}

View file

@ -109,12 +109,12 @@ public class ItemRecipeGenerator extends RecipeProvider {
.define('V', ActuallyBlocks.VOID_CRYSTAL.getItem()).save(recipeOutput); .define('V', ActuallyBlocks.VOID_CRYSTAL.getItem()).save(recipeOutput);
//Void Bag //Void Bag
/* Recipe.shapeless(ActuallyItems.VOID_SACK.get()) Recipe.shapeless(ActuallyItems.VOID_SACK.get())
.requires(ActuallyItems.TRAVELERS_SACK.get()) .requires(ActuallyItems.TRAVELERS_SACK.get())
.requires(Tags.Items.ENDER_PEARLS) .requires(Tags.Items.ENDER_PEARLS)
.requires(Tags.Items.OBSIDIAN) .requires(Tags.Items.OBSIDIAN)
.requires(ActuallyBlocks.VOID_CRYSTAL.getItem()) .requires(ActuallyBlocks.VOID_CRYSTAL.getItem())
.save(recipeOutput);*/ //TODO not done yet .save(recipeOutput);
//Lens //Lens
Recipe.shaped(ActuallyItems.LENS.get()) Recipe.shaped(ActuallyItems.LENS.get())

View file

@ -65,6 +65,7 @@ public class MiningLensGenerator extends RecipeProvider {
private void buildMiningLens(RecipeOutput consumer) { private void buildMiningLens(RecipeOutput consumer) {
buildStoneOre(consumer, 5000, Items.COAL_ORE); buildStoneOre(consumer, 5000, Items.COAL_ORE);
buildStoneOre(consumer, 5000, Items.COPPER_ORE);
buildStoneOre(consumer, 3000, Items.IRON_ORE); buildStoneOre(consumer, 3000, Items.IRON_ORE);
buildStoneOre(consumer, 500, Items.GOLD_ORE); buildStoneOre(consumer, 500, Items.GOLD_ORE);
buildNetherOre(consumer, 500, Items.NETHER_GOLD_ORE); buildNetherOre(consumer, 500, Items.NETHER_GOLD_ORE);
@ -78,6 +79,7 @@ public class MiningLensGenerator extends RecipeProvider {
buildDeepSlateOre(consumer, 2000, Items.DEEPSLATE_COAL_ORE); buildDeepSlateOre(consumer, 2000, Items.DEEPSLATE_COAL_ORE);
buildDeepSlateOre(consumer, 3000, Items.DEEPSLATE_IRON_ORE); buildDeepSlateOre(consumer, 3000, Items.DEEPSLATE_IRON_ORE);
buildDeepSlateOre(consumer, 3000, Items.DEEPSLATE_COPPER_ORE);
buildDeepSlateOre(consumer, 500, Items.DEEPSLATE_GOLD_ORE); buildDeepSlateOre(consumer, 500, Items.DEEPSLATE_GOLD_ORE);
buildDeepSlateOre(consumer, 50, Items.DEEPSLATE_DIAMOND_ORE); buildDeepSlateOre(consumer, 50, Items.DEEPSLATE_DIAMOND_ORE);
buildDeepSlateOre(consumer, 250, Items.DEEPSLATE_LAPIS_ORE); buildDeepSlateOre(consumer, 250, Items.DEEPSLATE_LAPIS_ORE);

View file

@ -33,7 +33,6 @@ import de.ellpeck.actuallyadditions.mod.gen.village.ActuallyVillagers;
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager; import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers; import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.Worm; import de.ellpeck.actuallyadditions.mod.items.Worm;
import de.ellpeck.actuallyadditions.mod.lootmodifier.ActuallyLootModifiers; import de.ellpeck.actuallyadditions.mod.lootmodifier.ActuallyLootModifiers;
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper; import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
@ -142,6 +141,7 @@ public class ActuallyAdditions {
if (FMLEnvironment.dist.isClient()) { if (FMLEnvironment.dist.isClient()) {
eventBus.addListener(ActuallyAdditionsClient::setup); eventBus.addListener(ActuallyAdditionsClient::setup);
eventBus.addListener(ActuallyAdditionsClient::setupMenus);
eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders); eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders);
eventBus.addListener(ActuallyAdditionsClient::registerParticleFactories); eventBus.addListener(ActuallyAdditionsClient::registerParticleFactories);
eventBus.register(new ClientRegistryHandler()); eventBus.register(new ClientRegistryHandler());

View file

@ -11,40 +11,12 @@
package de.ellpeck.actuallyadditions.mod; package de.ellpeck.actuallyadditions.mod;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.render.ReconstructorRenderer; import de.ellpeck.actuallyadditions.mod.blocks.render.*;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderDisplayStand;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderEmpowerer;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderLaserRelay;
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm; import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
import de.ellpeck.actuallyadditions.mod.event.ClientEvents; import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers; import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.inventory.gui.CrusherScreen; import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiBioReactor;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiBreaker;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCanolaPress;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoalGenerator;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDrill;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDropper;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiEnergizer;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiEnervator;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFarmer;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFeeder;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFilter;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFireworkBox;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFluidCollector;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiMiner;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiOilGenerator;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiRangedCollector;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiXPSolidifier;
import de.ellpeck.actuallyadditions.mod.inventory.gui.SackGui;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit; import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles; import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
@ -52,7 +24,6 @@ import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam;
import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem; import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem;
import de.ellpeck.actuallyadditions.mod.patchouli.PatchouliPages; import de.ellpeck.actuallyadditions.mod.patchouli.PatchouliPages;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
@ -63,37 +34,41 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.event.EntityRenderersEvent; import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent; import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.NeoForge;
public class ActuallyAdditionsClient { public class ActuallyAdditionsClient {
public static void setupMenus(RegisterMenuScreensEvent evt) {
evt.register(ActuallyContainers.SACK_CONTAINER.get(), SackGui::new);
evt.register(ActuallyContainers.VOID_SACK_CONTAINER.get(), VoidSackGui::new);
evt.register(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new);
evt.register(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new);
evt.register(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new);
evt.register(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new);
evt.register(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new);
evt.register(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new);
evt.register(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new);
evt.register(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new);
evt.register(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new);
evt.register(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new);
evt.register(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new);
evt.register(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new);
evt.register(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new);
evt.register(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new);
evt.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
evt.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
evt.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new);
evt.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new);
evt.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
evt.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
evt.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new);
evt.register(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new);
evt.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
evt.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
}
public static void setup(FMLClientSetupEvent event) { public static void setup(FMLClientSetupEvent event) {
MenuScreens.register(ActuallyContainers.BAG_CONTAINER.get(), SackGui::new);
MenuScreens.register(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new);
MenuScreens.register(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new);
MenuScreens.register(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new);
MenuScreens.register(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new);
MenuScreens.register(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new);
MenuScreens.register(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new);
MenuScreens.register(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new);
MenuScreens.register(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new);
MenuScreens.register(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new);
MenuScreens.register(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new);
MenuScreens.register(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new);
MenuScreens.register(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new);
MenuScreens.register(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new);
MenuScreens.register(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new);
MenuScreens.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
MenuScreens.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
MenuScreens.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new);
MenuScreens.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new);
MenuScreens.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
MenuScreens.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
MenuScreens.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new);
MenuScreens.register(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new);
MenuScreens.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
MenuScreens.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
// From old proxy // From old proxy
NeoForge.EVENT_BUS.register(new ClientEvents()); NeoForge.EVENT_BUS.register(new ClientEvents());
NeoForge.EVENT_BUS.register(new SpecialRenderInit()); NeoForge.EVENT_BUS.register(new SpecialRenderInit());

View file

@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.DrillItem;
import de.ellpeck.actuallyadditions.mod.items.Sack; import de.ellpeck.actuallyadditions.mod.items.Sack;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.sack.SackManager; import de.ellpeck.actuallyadditions.mod.sack.SackManager;
@ -68,11 +67,21 @@ public class CommonEvents {
if (i != player.getInventory().selected) { if (i != player.getInventory().selected) {
ItemStack invStack = player.getInventory().getItem(i); ItemStack invStack = player.getInventory().getItem(i);
if (StackUtil.isValid(invStack) && invStack.getItem() instanceof Sack && invStack.hasTag()) { if (StackUtil.isValid(invStack) && (invStack.getItem() instanceof Sack) && invStack.hasTag()) {
if (invStack.getOrCreateTag().getBoolean("AutoInsert")) { if (invStack.getOrCreateTag().getBoolean("AutoInsert")) {
boolean changed = false; boolean changed = false;
boolean isVoid = ((Sack) invStack.getItem()).isVoid; boolean isVoid = ((Sack) invStack.getItem()).isVoid;
FilterSettings filter = new FilterSettings(4, false, false);
filter.readFromNBT(invStack.getOrCreateTag(), "Filter");
if (isVoid) {
if (filter.check(stack)) {
stack.setCount(0);
changed = true;
}
}
else {
var optHandler = SackManager.get().getHandler(invStack); var optHandler = SackManager.get().getHandler(invStack);
if (optHandler.isEmpty()) if (optHandler.isEmpty())
@ -80,13 +89,7 @@ public class CommonEvents {
ItemStackHandlerAA inv = optHandler.get(); ItemStackHandlerAA inv = optHandler.get();
FilterSettings filter = new FilterSettings(4, false, false);
filter.readFromNBT(invStack.getOrCreateTag(), "Filter");
if (filter.check(stack)) { if (filter.check(stack)) {
if (isVoid) {
stack.setCount(0);
changed = true;
} else {
for (int j = 0; j < inv.getSlots(); j++) { for (int j = 0; j < inv.getSlots(); j++) {
ItemStack bagStack = inv.getStackInSlot(j); ItemStack bagStack = inv.getStackInSlot(j);
if (StackUtil.isValid(bagStack)) { if (StackUtil.isValid(bagStack)) {
@ -104,7 +107,7 @@ public class CommonEvents {
changed = true; changed = true;
} }
if (!StackUtil.isValid(stack)) { if (stack.isEmpty()) {
break; break;
} }
} }
@ -112,9 +115,9 @@ public class CommonEvents {
} }
if (changed) { if (changed) {
if (!isVoid) { /* if (!isVoid) {
DrillItem.writeSlotsToNBT(inv, invStack); DrillItem.writeSlotsToNBT(inv, invStack);
} }*/
event.setResult(Event.Result.ALLOW); event.setResult(Event.Result.ALLOW);
} }
} }

View file

@ -11,7 +11,8 @@ import java.util.function.Supplier;
public class ActuallyContainers { public class ActuallyContainers {
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(BuiltInRegistries.MENU, ActuallyAdditions.MODID); public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(BuiltInRegistries.MENU, ActuallyAdditions.MODID);
public static final Supplier<MenuType<SackContainer>> BAG_CONTAINER = CONTAINERS.register("bag_container", () -> IMenuTypeExtension.create(SackContainer::fromNetwork)); public static final Supplier<MenuType<SackContainer>> SACK_CONTAINER = CONTAINERS.register("sack_container", () -> IMenuTypeExtension.create(SackContainer::fromNetwork));
public static final Supplier<MenuType<VoidSackContainer>> VOID_SACK_CONTAINER = CONTAINERS.register("void_sack_container", () -> IMenuTypeExtension.create(VoidSackContainer::new));
public static final Supplier<MenuType<ContainerBioReactor>> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IMenuTypeExtension.create(ContainerBioReactor::fromNetwork)); public static final Supplier<MenuType<ContainerBioReactor>> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IMenuTypeExtension.create(ContainerBioReactor::fromNetwork));
public static final Supplier<MenuType<ContainerBreaker>> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IMenuTypeExtension.create(ContainerBreaker::fromNetwork)); public static final Supplier<MenuType<ContainerBreaker>> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IMenuTypeExtension.create(ContainerBreaker::fromNetwork));
public static final Supplier<MenuType<ContainerCanolaPress>> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IMenuTypeExtension.create(ContainerCanolaPress::fromNetwork)); public static final Supplier<MenuType<ContainerCanolaPress>> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IMenuTypeExtension.create(ContainerCanolaPress::fromNetwork));

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotDeletion;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
@ -46,7 +45,7 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact
} }
public SackContainer(int windowId, Inventory playerInventory, UUID uuid, ItemStackHandlerAA handler) { public SackContainer(int windowId, Inventory playerInventory, UUID uuid, ItemStackHandlerAA handler) {
super(ActuallyContainers.BAG_CONTAINER.get(), windowId); super(ActuallyContainers.SACK_CONTAINER.get(), windowId);
this.inventory = playerInventory; this.inventory = playerInventory;
this.bagInventory = handler; this.bagInventory = handler;
@ -55,15 +54,6 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact
this.addSlot(new SlotFilter(this.filter, row, 155, 10 + row * 18)); this.addSlot(new SlotFilter(this.filter, row, 155, 10 + row * 18));
} }
if (false) { // TODO isvoid, move to its own container
this.addSlot(new SlotDeletion(this.bagInventory, 0, 64, 65) {
@Override
public boolean mayPlace(ItemStack stack) {
return SackContainer.this.filter.check(stack);
}
});
}
// Sack inventory // Sack inventory
for (int row = 0; row < 4; row++) { for (int row = 0; row < 4; row++) {
for (int col = 0; col < 7; col++) { for (int col = 0; col < 7; col++) {
@ -94,7 +84,6 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact
ItemStack stack = playerInventory.getSelected(); ItemStack stack = playerInventory.getSelected();
if (!stack.isEmpty() && stack.getItem() instanceof Sack) { if (!stack.isEmpty() && stack.getItem() instanceof Sack) {
//DrillItem.loadSlotsFromNBT(this.bagInventory, playerInventory.getSelected());
if (stack.hasTag()) { if (stack.hasTag()) {
CompoundTag compound = stack.getOrCreateTag(); CompoundTag compound = stack.getOrCreateTag();
this.filter.readFromNBT(compound, "Filter"); this.filter.readFromNBT(compound, "Filter");
@ -103,46 +92,6 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact
} }
} }
/* @Override
public void broadcastChanges() { // TODO is this needed anymore?
super.broadcastChanges();
if (this.filter.needsUpdateSend() || this.autoInsert != this.oldAutoInsert) {
for (ContainerListener listener : this..containerListeners) {
listener.setContainerData(this, 0, this.filter.isWhitelist
? 1
: 0);
listener.setContainerData(this, 1, this.filter.respectMeta
? 1
: 0);
listener.setContainerData(this, 2, this.filter.respectNBT
? 1
: 0);
listener.setContainerData(this, 3, this.filter.respectOredict);
listener.setContainerData(this, 4, this.autoInsert
? 1
: 0);
listener.setContainerData(this, 5, this.filter.respectMod
? 1
: 0);
}
this.filter.updateLasts();
this.oldAutoInsert = this.autoInsert;
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void setData(int id, int data) {
if (id == 0) {
this.filter.isWhitelist = data == 1;
} else if (id == 1) {
this.autoInsert = data == 1;
} else if (id == 2) {
this.filter.respectMod = data == 1;
}
}*/
@Override @Override
public ItemStack quickMoveStack(@Nonnull Player player, int slot) { public ItemStack quickMoveStack(@Nonnull Player player, int slot) {
int inventoryStart = this.bagInventory.getSlots() + 4; int inventoryStart = this.bagInventory.getSlots() + 4;

View file

@ -0,0 +1,117 @@
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotDeletion;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable;
import de.ellpeck.actuallyadditions.mod.items.Sack;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ClickType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull;
public class VoidSackContainer extends AbstractContainerMenu implements IButtonReactor {
public final FilterSettings filter = new FilterSettings(4, false,false);
private final ItemStackHandlerAA bagInventory;
private final Inventory inventory;
public boolean autoInsert;
private boolean oldAutoInsert;
protected VoidSackContainer(int windowId, Inventory inv, FriendlyByteBuf data) {
this(windowId, inv);
}
public VoidSackContainer(int pContainerId, Inventory pPlayerInventory) {
super(ActuallyContainers.VOID_SACK_CONTAINER.get(), pContainerId);
this.inventory = pPlayerInventory;
this.bagInventory = new ItemStackHandlerAA(1);
for (int c = 0; c < 4; c++) {
this.addSlot(new SlotFilter(this.filter, c, 98 + c * 17, 17));
}
this.addSlot(new SlotDeletion(this.bagInventory, 0, 13, 18) {
@Override
public boolean mayPlace(ItemStack stack) {
return VoidSackContainer.this.filter.check(stack);
}
});
// Player Inventory
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 9; col++) {
this.addSlot(new Slot(inventory, col + row * 9 + 9, 8 + col * 18, 47 + row * 18));
}
}
// Player Hotbar
for (int i = 0; i < 9; i++) {
if (i == inventory.selected) {
this.addSlot(new SlotImmovable(inventory, i, 8 + i * 18, 105));
} else {
this.addSlot(new Slot(inventory, i, 8 + i * 18, 105));
}
}
ItemStack stack = inventory.getSelected();
if (!stack.isEmpty() && stack.getItem() instanceof Sack) {
if (stack.hasTag()) {
CompoundTag compound = stack.getOrCreateTag();
this.filter.readFromNBT(compound, "Filter");
this.autoInsert = compound.getBoolean("AutoInsert");
}
}
}
@Override
public void clicked(int slotId, int dragType, @Nonnull ClickType clickTypeIn, @Nonnull Player player) {
if (SlotFilter.checkFilter(this, slotId, player)) {
return;
} else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) {
return;
} else {
super.clicked(slotId, dragType, clickTypeIn, player);
}
}
@Override
public void removed(@Nonnull Player player) {
ItemStack stack = this.inventory.getSelected();
if (!stack.isEmpty() && stack.getItem() instanceof Sack) {
CompoundTag compound = stack.getOrCreateTag();
this.filter.writeToNBT(compound, "Filter");
compound.putBoolean("AutoInsert", this.autoInsert);
}
super.removed(player);
}
@Override
public void onButtonPressed(int buttonID, Player player) {
if (buttonID == 0) {
this.autoInsert = !this.autoInsert;
} else {
this.filter.onButtonPressed(buttonID - 1);
}
}
@Nonnull
@Override
public ItemStack quickMoveStack(@Nonnull Player pPlayer, int pIndex) {
return ItemStack.EMPTY; //TODO old behavior was shift clicking moved stacks around the normal inventory
}
@Override
public boolean stillValid(@Nonnull Player pPlayer) {
return true;
}
}

View file

@ -33,7 +33,7 @@ public class FilterSettingsGui {
public Button whitelistButton; public Button whitelistButton;
public Button modButton; public Button modButton;
public FilterSettingsGui(FilterSettings settings, int x, int y, Consumer<AbstractButton> buttonConsumer, Consumer<Integer> clickConsumer, int idOffset) { public FilterSettingsGui(FilterSettings settings, int x, int y, boolean vertical, Consumer<AbstractButton> buttonConsumer, Consumer<Integer> clickConsumer, int idOffset) {
this.theSettings = settings; this.theSettings = settings;
this.whitelistButton = Button.builder(Component.literal("WH"), $ -> { this.whitelistButton = Button.builder(Component.literal("WH"), $ -> {
@ -42,7 +42,10 @@ public class FilterSettingsGui {
}) })
.bounds(x, y, 16, 12).build(); .bounds(x, y, 16, 12).build();
buttonConsumer.accept(this.whitelistButton); buttonConsumer.accept(this.whitelistButton);
if (vertical)
y += 14; y += 14;
else
x += 18;
this.modButton = Button.builder(Component.literal("MO"), $ -> { this.modButton = Button.builder(Component.literal("MO"), $ -> {
theSettings.respectMod = !theSettings.respectMod; theSettings.respectMod = !theSettings.respectMod;
clickConsumer.accept(idOffset + 1); clickConsumer.accept(idOffset + 1);

View file

@ -68,8 +68,8 @@ public class GuiLaserRelayItemWhitelist extends AAScreen<ContainerLaserRelayItem
public void init() { public void init() {
super.init(); super.init();
this.leftFilter = new FilterSettingsGui(this.tile.leftFilter, this.leftPos + 3, this.topPos + 6, this::addRenderableWidget, this::buttonClicked, 0); this.leftFilter = new FilterSettingsGui(this.tile.leftFilter, this.leftPos + 3, this.topPos + 6, true, this::addRenderableWidget, this::buttonClicked, 0);
this.rightFilter = new FilterSettingsGui(this.tile.rightFilter, this.leftPos + 157, this.topPos + 6, this::addRenderableWidget, this::buttonClicked, 4); this.rightFilter = new FilterSettingsGui(this.tile.rightFilter, this.leftPos + 157, this.topPos + 6, true, this::addRenderableWidget, this::buttonClicked, 4);
this.buttonSmartWhitelistLeft = this.addRenderableWidget(Button.builder( this.buttonSmartWhitelistLeft = this.addRenderableWidget(Button.builder(
Component.literal("S"), Component.literal("S"),

View file

@ -48,7 +48,7 @@ public class GuiRangedCollector extends AAScreen<ContainerRangedCollector> {
public void init() { public void init() {
super.init(); super.init();
this.filter = new FilterSettingsGui(this.collector.filter, this.leftPos + 3, this.topPos + 6, this::addRenderableWidget, this::buttonClicked, 0); this.filter = new FilterSettingsGui(this.collector.filter, this.leftPos + 3, this.topPos + 6, true, this::addRenderableWidget, this::buttonClicked, 0);
} }
@Override @Override

View file

@ -32,10 +32,8 @@ import java.util.Optional;
public class SackGui extends AAScreen<SackContainer> { public class SackGui extends AAScreen<SackContainer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bag"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bag");
private static final ResourceLocation RES_LOC_VOID = AssetUtil.getGuiLocation("gui_void_bag");
private final SackContainer container; private final SackContainer container;
private final boolean isVoid;
private FilterSettingsGui filter; private FilterSettingsGui filter;
private Button buttonAutoInsert; private Button buttonAutoInsert;
@ -43,7 +41,6 @@ public class SackGui extends AAScreen<SackContainer> {
super(container, inventory, title); super(container, inventory, title);
this.imageWidth = 176; this.imageWidth = 176;
this.imageHeight = 90 + 86; this.imageHeight = 90 + 86;
this.isVoid = false; //TODO fix later
this.container = container; this.container = container;
} }
@ -51,7 +48,7 @@ public class SackGui extends AAScreen<SackContainer> {
public void init() { public void init() {
super.init(); super.init();
this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 137, this.topPos + 10, this::addRenderableWidget, this::buttonClicked, 1); this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 137, this.topPos + 10, true, this::addRenderableWidget, this::buttonClicked, 1);
this.buttonAutoInsert = Button.builder( this.buttonAutoInsert = Button.builder(
Component.literal("I") Component.literal("I")
@ -81,13 +78,6 @@ public class SackGui extends AAScreen<SackContainer> {
this.filter.tick(); this.filter.tick();
} }
/* @Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid
? "voidBag"
: "bag") + ".name"));
}*/
@Override @Override
public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
super.render(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks);
@ -110,6 +100,6 @@ public class SackGui extends AAScreen<SackContainer> {
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 90, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 90, 0, 0, 176, 86);
guiGraphics.blit(this.isVoid ? RES_LOC_VOID : RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 90); guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 90);
} }
} }

View file

@ -0,0 +1,105 @@
/*
* This file ("GuiBag.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.VoidSackContainer;
import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.neoforged.neoforge.network.PacketDistributor;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class VoidSackGui extends AAScreen<VoidSackContainer> {
private static final ResourceLocation RES_LOC_VOID = AssetUtil.getGuiLocation("gui_void_bag");
private final VoidSackContainer container;
private FilterSettingsGui filter;
private Button buttonAutoInsert;
public VoidSackGui(VoidSackContainer container, Inventory inventory, Component title) {
super(container, inventory, title);
this.imageWidth = 176;
this.imageHeight = 90 + 43;
this.container = container;
}
@Override
public void init() {
super.init();
this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 97, this.topPos + 3, false, this::addRenderableWidget, this::buttonClicked, 1);
this.buttonAutoInsert = Button.builder(
Component.literal("I")
.withStyle(this.container.autoInsert? ChatFormatting.DARK_GREEN : ChatFormatting.RED),
(button) -> {
this.container.autoInsert = !this.container.autoInsert;
this.buttonAutoInsert.setMessage(Component.literal(this.container.autoInsert? "I" : "O")
.withStyle(this.container.autoInsert? ChatFormatting.DARK_GREEN : ChatFormatting.RED));
this.buttonClicked(0);
}).pos(leftPos - 17, topPos + 16).size(20, 20)
.build();
this.addRenderableWidget(this.buttonAutoInsert);
}
public void buttonClicked(int id) {
CompoundTag data = new CompoundTag();
data.putInt("ButtonID", id);
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
data.putString("WorldID", Minecraft.getInstance().level.dimension().location().toString());
PacketDistributor.SERVER.noArg().send(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
}
@Override
public void containerTick() {
super.containerTick();
this.filter.tick();
}
@Override
public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
super.render(guiGraphics, mouseX, mouseY, partialTicks);
this.filter.drawHover(guiGraphics, mouseX, mouseY);
if (this.buttonAutoInsert.isMouseOver(mouseX, mouseY)) {
List<Component> text = new ArrayList<>();
text.add(Component.literal("Auto-Insert " + (this.container.autoInsert
? "On"
: "Off")).withStyle(ChatFormatting.BOLD));
text.add(Component.literal("Turn this on to make items that get picked up automatically go into the bag.")); //TODO how to word wrap these to 200?
text.add(Component.literal("Note that this WON'T work when you are holding the bag in your hand.").withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.ITALIC)); //TODO this too
guiGraphics.renderTooltip(font, text, Optional.empty(), mouseX, mouseY); //TODO i have no idea what im doing here...
}
}
@Override
protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int x, int y) {
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 43, 0, 0, 176, 86);
guiGraphics.blit( RES_LOC_VOID, this.leftPos, this.topPos, 0, 0, 176, 43);
}
}

View file

@ -45,23 +45,21 @@ public class SlotFilter extends SlotItemHandlerUnconditioned {
} }
private void slotClick(Player player, ItemStack cursorItem) { private void slotClick(Player player, ItemStack cursorItem) {
ItemStack heldStack = cursorItem;
ItemStack stackInSlot = this.getItem(); ItemStack stackInSlot = this.getItem();
if (!stackInSlot.isEmpty() && cursorItem.isEmpty()) {
if (StackUtil.isValid(stackInSlot) && !StackUtil.isValid(heldStack)) {
if (isFilter(stackInSlot)) { if (isFilter(stackInSlot)) {
player.getInventory().setPickedItem(stackInSlot); player.containerMenu.setCarried(stackInSlot);
} }
this.set(ItemStack.EMPTY); this.set(ItemStack.EMPTY);
} else if (StackUtil.isValid(heldStack)) { } else if (StackUtil.isValid(cursorItem)) {
if (!isFilter(stackInSlot)) { if (!isFilter(stackInSlot)) {
ItemStack s = heldStack.copy(); ItemStack s = cursorItem.copy();
s.setCount(1); s.setCount(1);
this.set(s); this.set(s);
if (isFilter(heldStack)) { if (isFilter(cursorItem)) {
heldStack.shrink(1); cursorItem.shrink(1);
} }
} }
} }

View file

@ -11,11 +11,11 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.inventory.SackContainer; import de.ellpeck.actuallyadditions.mod.inventory.SackContainer;
import de.ellpeck.actuallyadditions.mod.inventory.VoidSackContainer;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.sack.SackData; import de.ellpeck.actuallyadditions.mod.sack.SackData;
import de.ellpeck.actuallyadditions.mod.sack.SackManager; import de.ellpeck.actuallyadditions.mod.sack.SackManager;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
@ -30,6 +30,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.capabilities.Capabilities;
import javax.annotation.Nonnull;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
@ -41,6 +42,7 @@ public class Sack extends ItemBase {
this.isVoid = isVoid; this.isVoid = isVoid;
} }
@Nonnull
@Override @Override
public InteractionResult useOn(UseOnContext context) { public InteractionResult useOn(UseOnContext context) {
ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); ItemStack stack = context.getPlayer().getItemInHand(context.getHand());
@ -59,13 +61,13 @@ public class Sack extends ItemBase {
for (int j = 0; j < inv.getSlots(); j++) { for (int j = 0; j < inv.getSlots(); j++) {
ItemStack invStack = inv.getStackInSlot(j); ItemStack invStack = inv.getStackInSlot(j);
if (StackUtil.isValid(invStack)) { if (!invStack.isEmpty()) {
for (int i = 0; i < cap.getSlots(); i++) { for (int i = 0; i < cap.getSlots(); i++) {
ItemStack remain = cap.insertItem(i, invStack, false); ItemStack remain = cap.insertItem(i, invStack, false);
if (!ItemStack.matches(remain, invStack)) { if (!ItemStack.matches(remain, invStack)) {
inv.setStackInSlot(j, remain.copy()); inv.setStackInSlot(j, remain.copy());
localChanged = true; localChanged = true;
if (!StackUtil.isValid(remain)) { if (remain.isEmpty()) {
break; break;
} }
invStack = remain; invStack = remain;
@ -87,8 +89,9 @@ public class Sack extends ItemBase {
return InteractionResult.PASS; return InteractionResult.PASS;
} }
@Nonnull
@Override @Override
public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) { public InteractionResultHolder<ItemStack> use(Level world, Player player, @Nonnull InteractionHand hand) {
ItemStack sackStack = player.getItemInHand(hand); ItemStack sackStack = player.getItemInHand(hand);
if (!world.isClientSide && hand == InteractionHand.MAIN_HAND && sackStack.getItem() instanceof Sack && player instanceof ServerPlayer) { if (!world.isClientSide && hand == InteractionHand.MAIN_HAND && sackStack.getItem() instanceof Sack && player instanceof ServerPlayer) {
@ -104,12 +107,8 @@ public class Sack extends ItemBase {
player.openMenu(new SimpleMenuProvider((id, inv, entity) -> player.openMenu(new SimpleMenuProvider((id, inv, entity) ->
new SackContainer(id, inv, uuid, data.getSpecialHandler()), sackStack.getHoverName()), (buffer -> buffer.writeUUID(uuid))); new SackContainer(id, inv, uuid, data.getSpecialHandler()), sackStack.getHoverName()), (buffer -> buffer.writeUUID(uuid)));
} } else
player.openMenu(new SimpleMenuProvider((id, inv, entity) -> new VoidSackContainer(id, inv), sackStack.getHoverName()));
/* NetworkHooks.openGui((ServerPlayerEntity) player,
new SimpleNamedContainerProvider((windowId, playerInventory, playerEntity) ->
new ContainerBag(windowId, playerInventory, playerEntity.getItemInHand(hand), this.isVoid), StringComponent.empty()));*/
} }
return InteractionResultHolder.pass(player.getItemInHand(hand)); return InteractionResultHolder.pass(player.getItemInHand(hand));
} }

View file

@ -213,7 +213,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay {
} }
//TODO dont send the entire tank at once, gg //TODO dont send the entire tank at once, gg
if (totalReceiverAmount > 0 && !relaysThatWork.isEmpty()) { if (totalReceiverAmount > 0 && !relaysThatWork.isEmpty()) {
int amountPer = stack.getAmount() / totalReceiverAmount <= 0 int amountPer = stack.getAmount() / totalReceiverAmount > 0
? stack.getAmount() / totalReceiverAmount ? stack.getAmount() / totalReceiverAmount
: stack.getAmount(); : stack.getAmount();

View file

@ -373,7 +373,7 @@
"item.actuallyadditions.player_probe": "Player Probe", "item.actuallyadditions.player_probe": "Player Probe",
"item.actuallyadditions.worm": "Worm", "item.actuallyadditions.worm": "Worm",
"item.actuallyadditions.travelers_sack": "Traveler's Sack", "item.actuallyadditions.travelers_sack": "Traveler's Sack",
"item.actuallyadditions.void_sack": "Void Sack (wip)", "item.actuallyadditions.void_sack": "Void Sack",
"item.actuallyadditions.crystallized_canola_seed": "Crystallized Canola Seed", "item.actuallyadditions.crystallized_canola_seed": "Crystallized Canola Seed",
"item.actuallyadditions.empowered_canola_seed": "Empowered Canola Seed", "item.actuallyadditions.empowered_canola_seed": "Empowered Canola Seed",
"item.actuallyadditions.lens_of_the_miner": "Lens of the Miner", "item.actuallyadditions.lens_of_the_miner": "Lens of the Miner",

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "xycraft_world"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "xycraft_world:aluminum_ore_stone"
},
"weight": 250
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "xycraft_world"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "xycraft_world:xychorium_ore_stone_blue"
},
"weight": 300
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "xycraft_world"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "xycraft_world:xychorium_ore_stone_dark"
},
"weight": 300
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "xycraft_world"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "xycraft_world:xychorium_ore_stone_green"
},
"weight": 300
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "xycraft_world"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "xycraft_world:xychorium_ore_stone_light"
},
"weight": 300
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "xycraft_world"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "xycraft_world:xychorium_ore_stone_red"
},
"weight": 300
}