feat: implement soul brazier

This commit is contained in:
LordMZTE 2023-05-21 17:39:11 +02:00
parent 40284fb2ec
commit ac7608ea9b
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
12 changed files with 152 additions and 13 deletions

View file

@ -8,6 +8,7 @@ import net.anvilcraft.thaummach.entities.EntitySingularity;
import net.anvilcraft.thaummach.gui.GuiArcaneFurnace;
import net.anvilcraft.thaummach.gui.GuiBore;
import net.anvilcraft.thaummach.gui.GuiCrystallizer;
import net.anvilcraft.thaummach.gui.GuiSoulBrazier;
import net.anvilcraft.thaummach.gui.GuiVoidChest;
import net.anvilcraft.thaummach.gui.GuiVoidInterface;
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
@ -99,6 +100,9 @@ public class ClientProxy extends CommonProxy {
case CRYSTALLIZER:
return new GuiCrystallizer(player.inventory, (TileCrystallizer) te);
case SOUL_BRAZIER:
return new GuiSoulBrazier(player.inventory, (TileSoulBrazier) te);
case VOID_CHEST:
return new GuiVoidChest(player.inventory, (TileVoidChest) te);

View file

@ -5,6 +5,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import net.anvilcraft.thaummach.container.ContainerArcaneFurnace;
import net.anvilcraft.thaummach.container.ContainerBore;
import net.anvilcraft.thaummach.container.ContainerCrystallizer;
import net.anvilcraft.thaummach.container.ContainerSoulBrazier;
import net.anvilcraft.thaummach.container.ContainerVoidChest;
import net.anvilcraft.thaummach.container.ContainerVoidInterface;
import net.anvilcraft.thaummach.tiles.TileArcaneFurnace;
@ -67,6 +68,9 @@ public class CommonProxy implements IGuiHandler {
case CRYSTALLIZER:
return new ContainerCrystallizer(player.inventory, (TileCrystallizer) te);
case SOUL_BRAZIER:
return new ContainerSoulBrazier(player.inventory, (TileSoulBrazier) te);
case VOID_CHEST:
return new ContainerVoidChest(player.inventory, (TileVoidChest) te);

View file

@ -4,6 +4,7 @@ public enum GuiID {
ARCANE_FURNACE,
BORE,
CRYSTALLIZER,
SOUL_BRAZIER,
VOID_CHEST,
VOID_INTERFACE;

View file

@ -5,6 +5,7 @@ import net.anvilcraft.thaummach.items.ItemCrystallineBell;
import net.anvilcraft.thaummach.items.ItemFocus;
import net.anvilcraft.thaummach.items.ItemRunicEssence;
import net.anvilcraft.thaummach.items.ItemSingularity;
import net.anvilcraft.thaummach.items.ItemSoulFragment;
import net.anvilcraft.thaummach.items.ItemUpgrade;
import net.minecraft.item.Item;
@ -17,6 +18,7 @@ public class TMItems {
public static Item focus4;
public static Item runicEssence;
public static Item singularity;
public static Item soul_fragment;
public static Item upgrade;
public static void init() {
@ -32,6 +34,8 @@ public class TMItems {
singularity = new ItemSingularity();
soul_fragment = new ItemSoulFragment();
upgrade = new ItemUpgrade();
GameRegistry.registerItem(crystallineBell, "crystalline_bell");
@ -46,6 +50,8 @@ public class TMItems {
GameRegistry.registerItem(singularity, "singularity");
GameRegistry.registerItem(soul_fragment, "soul_fragment");
GameRegistry.registerItem(upgrade, "upgrade");
}
}

View file

@ -0,0 +1,67 @@
package net.anvilcraft.thaummach.container;
import net.anvilcraft.thaummach.InventorySlot;
import net.anvilcraft.thaummach.tiles.TileSoulBrazier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerSoulBrazier extends Container {
private TileSoulBrazier brazier;
public ContainerSoulBrazier(
InventoryPlayer inventoryplayer, TileSoulBrazier soulbrazier
) {
this.brazier = soulbrazier;
this.addSlotToContainer(new InventorySlot(soulbrazier, 0, 80, 41));
int j;
for (j = 0; j < 3; ++j) {
for (int k = 0; k < 9; ++k) {
this.addSlotToContainer(
new Slot(inventoryplayer, k + j * 9 + 9, 8 + k * 18, 84 + j * 18)
);
}
}
for (j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(inventoryplayer, j, 8 + j * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return this.brazier.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int i) {
ItemStack itemstack = null;
Slot slot = (Slot) super.inventorySlots.get(i);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (i == 0) {
if (!this.mergeItemStack(itemstack1, 1, 37, true)) {
return null;
}
} else if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
return null;
}
if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
}
return itemstack;
}
}

View file

@ -19,8 +19,8 @@ public class GuiArcaneFurnace extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int alec1, int alec2) {
super.fontRendererObj.drawString("Thaumic Furnace", 48, 5, 4210752);
super.fontRendererObj.drawString("Inventory", 8, super.ySize - 96 + 2, 4210752);
super.fontRendererObj.drawString("Thaumic Furnace", 48, 5, 0x404040);
super.fontRendererObj.drawString("Inventory", 8, super.ySize - 96 + 2, 0x404040);
}
@Override

View file

@ -0,0 +1,37 @@
package net.anvilcraft.thaummach.gui;
import net.anvilcraft.thaummach.container.ContainerSoulBrazier;
import net.anvilcraft.thaummach.tiles.TileSoulBrazier;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiSoulBrazier extends GuiContainer {
private TileSoulBrazier brazier;
public GuiSoulBrazier(InventoryPlayer inventoryplayer, TileSoulBrazier soulbrazier) {
super(new ContainerSoulBrazier(inventoryplayer, soulbrazier));
this.brazier = soulbrazier;
}
@Override
protected void drawGuiContainerForegroundLayer(int alec1, int alec2) {
super.fontRendererObj.drawString("Soul Brazier", 57, 5, 0xf0f0f0);
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int qq, int ww) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
super.mc.renderEngine.bindTexture(
new ResourceLocation("thaummach", "textures/guis/soul_brazier.png")
);
int l = (super.width - super.xSize) / 2;
int i1 = (super.height - super.ySize) / 2;
this.drawTexturedModalRect(l, i1, 0, 0, super.xSize, super.ySize);
int k1 = (int) ((float) (16 * this.brazier.burnTime) / 6000.0F);
this.drawTexturedModalRect(l + 80, i1 + 35 - k1, 176, 16 - k1, 16, k1);
int moon = super.mc.theWorld.getMoonPhase();
this.drawTexturedModalRect(l + 84, i1 + 66, 200, moon * 8, 8, 8);
}
}

View file

@ -0,0 +1,19 @@
package net.anvilcraft.thaummach.items;
import net.anvilcraft.thaummach.TMTab;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
public class ItemSoulFragment extends Item {
public ItemSoulFragment() {
super();
this.setUnlocalizedName("thaummach:soul_fragment");
this.setCreativeTab(TMTab.INSTANCE);
}
@Override
public void registerIcons(IIconRegister reg) {
this.itemIcon = reg.registerIcon("thaummach:soul_fragment");
}
}

View file

@ -2,11 +2,13 @@ package net.anvilcraft.thaummach.tiles;
import dev.tilera.auracore.api.AuraNode;
import dev.tilera.auracore.aura.AuraManager;
import net.anvilcraft.thaummach.GuiID;
import net.anvilcraft.thaummach.ITileGui;
import net.anvilcraft.thaummach.TMItems;
import net.anvilcraft.thaummach.ThaumicMachinery;
import net.anvilcraft.thaummach.packets.PacketFXSparkle;
import net.anvilcraft.thaummach.packets.PacketFXWisp;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -16,20 +18,19 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.EnumSkyBlock;
public class TileSoulBrazier extends TileEntity implements ISidedInventory {
public class TileSoulBrazier extends TileEntity implements ISidedInventory, ITileGui {
private ItemStack stack = null;
private int delay;
public int burnTime;
private boolean previousLight;
private int lightingDelay;
// TODO: implement soul fragment
public static ItemStack VALID_ITEM = new ItemStack(Blocks.soul_sand);
public static ItemStack VALID_ITEM = new ItemStack(TMItems.soul_fragment);
// TODO: GUIs
//public GuiScreen getGui(EntityPlayer player) {
// return new GuiSoulBrazier(player.inventory, this);
//}
@Override
public GuiID getGuiID() {
return GuiID.SOUL_BRAZIER;
}
public boolean isWorking() {
return this.burnTime > 0
@ -56,13 +57,11 @@ public class TileSoulBrazier extends TileEntity implements ISidedInventory {
if (!super.worldObj.isBlockIndirectlyGettingPowered(
super.xCoord, super.yCoord, super.zCoord
)) {
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
if (this.burnTime <= 0 && this.stack != null
&& this.stack.isItemEqual(VALID_ITEM)) {
this.burnTime = 6000;
this.lightingDelay = 0;
super.worldObj.markBlockForUpdate(
super.xCoord, super.yCoord, super.zCoord
);
super.worldObj.updateLightByType(
EnumSkyBlock.Block, super.xCoord, super.yCoord, super.zCoord
);

View file

@ -47,6 +47,8 @@ item.thaummach:upgrade_4.name=Infinite Sadness
item.thaummach:upgrade_5.name=Contained Emptiness
item.thaummach:upgrade_6.name=Collected Wisdom
item.thaummach:soul_fragment.name=Soul Fragment
item.thaummach:singularity.name=Arcane Singularity
item.thaummach:crystalline_bell.name=Crystalline Bell

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B