Cleanup, update datagen, attempt to implement uncrafter screen/menu
This commit is contained in:
parent
47cb43305b
commit
66bc7d6304
9 changed files with 22 additions and 38 deletions
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "otemod:item/partial_item"
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import dev.zontreck.otemod.enchantments.NightVisionEnchantment;
|
||||||
import dev.zontreck.otemod.events.EventHandler;
|
import dev.zontreck.otemod.events.EventHandler;
|
||||||
import dev.zontreck.otemod.implementation.*;
|
import dev.zontreck.otemod.implementation.*;
|
||||||
import dev.zontreck.otemod.implementation.compressor.CompressionChamberScreen;
|
import dev.zontreck.otemod.implementation.compressor.CompressionChamberScreen;
|
||||||
|
import dev.zontreck.otemod.implementation.uncrafting.UncrafterScreen;
|
||||||
import dev.zontreck.otemod.implementation.vault.*;
|
import dev.zontreck.otemod.implementation.vault.*;
|
||||||
import dev.zontreck.otemod.integrations.KeyBindings;
|
import dev.zontreck.otemod.integrations.KeyBindings;
|
||||||
import dev.zontreck.otemod.items.DeprecatedModItems;
|
import dev.zontreck.otemod.items.DeprecatedModItems;
|
||||||
|
@ -290,6 +291,7 @@ public class OTEMod
|
||||||
MenuScreens.register(ModMenuTypes.SCRUBBER.get(), ItemScrubberScreen::new);
|
MenuScreens.register(ModMenuTypes.SCRUBBER.get(), ItemScrubberScreen::new);
|
||||||
MenuScreens.register(ModMenuTypes.MAGIC_SCRUBBER.get(), MagicalScrubberScreen::new);
|
MenuScreens.register(ModMenuTypes.MAGIC_SCRUBBER.get(), MagicalScrubberScreen::new);
|
||||||
MenuScreens.register(ModMenuTypes.COMPRESSION_CHAMBER.get(), CompressionChamberScreen::new);
|
MenuScreens.register(ModMenuTypes.COMPRESSION_CHAMBER.get(), CompressionChamberScreen::new);
|
||||||
|
MenuScreens.register(ModMenuTypes.UNCRAFTER.get(), UncrafterScreen::new);
|
||||||
|
|
||||||
//ItemBlockRenderTypes.setRenderLayer(ModBlocks.AURORA_DOOR.get(), RenderType.translucent());
|
//ItemBlockRenderTypes.setRenderLayer(ModBlocks.AURORA_DOOR.get(), RenderType.translucent());
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package dev.zontreck.otemod.blocks;
|
package dev.zontreck.otemod.blocks;
|
||||||
|
|
||||||
import dev.zontreck.otemod.blocks.entity.CompressionChamberBlockEntity;
|
|
||||||
import dev.zontreck.otemod.blocks.entity.ModEntities;
|
import dev.zontreck.otemod.blocks.entity.ModEntities;
|
||||||
import dev.zontreck.otemod.blocks.entity.UncrafterBlockEntity;
|
import dev.zontreck.otemod.blocks.entity.UncrafterBlockEntity;
|
||||||
import dev.zontreck.otemod.networking.ModMessages;
|
import dev.zontreck.otemod.networking.ModMessages;
|
||||||
|
|
|
@ -16,12 +16,10 @@ import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.ContainerData;
|
import net.minecraft.world.inventory.ContainerData;
|
||||||
import net.minecraft.world.inventory.SimpleContainerData;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class ModItemModelsProvider extends ItemModelProvider
|
||||||
item(ModItems.DARK_RED_BRICK);
|
item(ModItems.DARK_RED_BRICK);
|
||||||
item(ModItems.LIME_BRICK);
|
item(ModItems.LIME_BRICK);
|
||||||
item(ModItems.GREEN_BRICK);
|
item(ModItems.GREEN_BRICK);
|
||||||
|
item(ModItems.PARTIAL_ITEM);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Engineer's Decor Items
|
Engineer's Decor Items
|
||||||
|
|
|
@ -42,18 +42,11 @@ public class UncrafterMenu extends AbstractContainerMenu
|
||||||
addPlayerHotbar(inv);
|
addPlayerHotbar(inv);
|
||||||
|
|
||||||
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
|
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
|
||||||
addSlot(new SlotItemHandler(handler, 0, 87,39));
|
addSlot(new SlotItemHandler(handler, 0, 39,39));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
|
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
|
||||||
for(int Y = 0; Y < 2; Y ++)
|
addSlot(new SlotItemHandler(handler, 0, 151, 39));
|
||||||
{
|
|
||||||
for(int X = 0; X < 9; X++)
|
|
||||||
{
|
|
||||||
addSlot(new SlotItemHandler(handler, X + Y * 9 + 9, UNCRAFTER_STORAGE_LEFT * X * 18, UNCRAFTER_STORAGE_HEIGHT*Y*18));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,9 +76,6 @@ public class UncrafterMenu extends AbstractContainerMenu
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int UNCRAFTER_STORAGE_LEFT = 15;
|
|
||||||
private static final int UNCRAFTER_STORAGE_HEIGHT = 63;
|
|
||||||
|
|
||||||
|
|
||||||
// CREDIT GOES TO: diesieben07 | https://github.com/diesieben07/SevenCommons
|
// CREDIT GOES TO: diesieben07 | https://github.com/diesieben07/SevenCommons
|
||||||
// must assign a slot number to each of the slots used by the GUI.
|
// must assign a slot number to each of the slots used by the GUI.
|
||||||
|
@ -143,9 +133,9 @@ public class UncrafterMenu extends AbstractContainerMenu
|
||||||
return stillValid(ContainerLevelAccess.create(level, entity.getBlockPos()), player, ModBlocks.COMPRESSION_CHAMBER.get());
|
return stillValid(ContainerLevelAccess.create(level, entity.getBlockPos()), player, ModBlocks.COMPRESSION_CHAMBER.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int PLAYER_INVENTORY_FIRST_SLOT_HEIGHT = 107;
|
private static final int PLAYER_INVENTORY_FIRST_SLOT_HEIGHT = 71;
|
||||||
private static final int PLAYER_INVENTORY_FIRST_SLOT_LEFT = 15;
|
private static final int PLAYER_INVENTORY_FIRST_SLOT_LEFT = 29;
|
||||||
private static final int PLAYER_HOTBAR_FIRST_SLOT = 164;
|
private static final int PLAYER_HOTBAR_FIRST_SLOT = 138;
|
||||||
|
|
||||||
private void addPlayerInventory(Inventory inv)
|
private void addPlayerInventory(Inventory inv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class UncrafterScreen extends AbstractContainerScreen<UncrafterMenu>
|
||||||
this.leftPos=0;
|
this.leftPos=0;
|
||||||
|
|
||||||
this.imageWidth=198;
|
this.imageWidth=198;
|
||||||
this.imageHeight=204;
|
this.imageHeight=167;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,7 @@ public class UncrafterScreen extends AbstractContainerScreen<UncrafterMenu>
|
||||||
int x = (width - imageWidth )/2;
|
int x = (width - imageWidth )/2;
|
||||||
int y = (height - imageHeight)/2;
|
int y = (height - imageHeight)/2;
|
||||||
|
|
||||||
EIA = new EnergyInfoArea(x+182, y+126, menu.entity.getEnergyStorage(), 5, 63);
|
EIA = new EnergyInfoArea(x+186, y+143, menu.entity.getEnergyStorage(), 5, 63);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,7 +69,7 @@ public class UncrafterScreen extends AbstractContainerScreen<UncrafterMenu>
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderEnergy(GuiGraphics stack, int mouseX, int mouseY, int x, int y) {
|
private void renderEnergy(GuiGraphics stack, int mouseX, int mouseY, int x, int y) {
|
||||||
if(isMouseAbove(mouseX, mouseY, x, y, 182, 126, 5, 63)){
|
if(isMouseAbove(mouseX, mouseY, x, y, leftPos + 182, topPos + 126, 5, 63)){
|
||||||
stack.renderTooltip(font, EIA.getTooltips(), Optional.empty(), mouseX-x, mouseY-y);
|
stack.renderTooltip(font, EIA.getTooltips(), Optional.empty(), mouseX-x, mouseY-y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class UncrafterScreen extends AbstractContainerScreen<UncrafterMenu>
|
||||||
{
|
{
|
||||||
if(menu.isCrafting())
|
if(menu.isCrafting())
|
||||||
{
|
{
|
||||||
stack.blit(TEXTURE, leftPos+116, topPos+44, 179, 11, menu.getScaledProgress(),7);
|
stack.blit(TEXTURE, leftPos+68, topPos+52, 2, 210, menu.getScaledProgress(),9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.function.Supplier;
|
||||||
import dev.zontreck.otemod.blocks.entity.CompressionChamberBlockEntity;
|
import dev.zontreck.otemod.blocks.entity.CompressionChamberBlockEntity;
|
||||||
import dev.zontreck.otemod.blocks.entity.ItemScrubberBlockEntity;
|
import dev.zontreck.otemod.blocks.entity.ItemScrubberBlockEntity;
|
||||||
import dev.zontreck.otemod.blocks.entity.MagicalScrubberBlockEntity;
|
import dev.zontreck.otemod.blocks.entity.MagicalScrubberBlockEntity;
|
||||||
|
import dev.zontreck.otemod.blocks.entity.UncrafterBlockEntity;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
@ -46,6 +47,9 @@ public class EnergySyncS2CPacket {
|
||||||
{
|
{
|
||||||
entity.setEnergy(energy);
|
entity.setEnergy(energy);
|
||||||
} else if(Minecraft.getInstance().level.getBlockEntity(pos) instanceof CompressionChamberBlockEntity entity)
|
} else if(Minecraft.getInstance().level.getBlockEntity(pos) instanceof CompressionChamberBlockEntity entity)
|
||||||
|
{
|
||||||
|
entity.setEnergy(energy);
|
||||||
|
} else if(Minecraft.getInstance().level.getBlockEntity(pos) instanceof UncrafterBlockEntity entity)
|
||||||
{
|
{
|
||||||
entity.setEnergy(energy);
|
entity.setEnergy(energy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"type": "minecraft:crafting_shaped",
|
|
||||||
"pattern": [
|
|
||||||
"WWW",
|
|
||||||
"W W"
|
|
||||||
],
|
|
||||||
"key": {
|
|
||||||
"W": {
|
|
||||||
"item": "otemod:metal_bar"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"result": {
|
|
||||||
"item": "otemod:steel_railing",
|
|
||||||
"count": 1
|
|
||||||
}
|
|
||||||
}
|
|
Reference in a new issue