Readded the Alchemy Table
Finished adding the Alchemy Table with JEI compatability. Also added recipes for the ARC block and the Alchemy Table.
This commit is contained in:
parent
37c5e807b0
commit
bf6250272c
41 changed files with 1915 additions and 29 deletions
|
@ -1,6 +1,8 @@
|
|||
package wayoftime.bloodmagic.client;
|
||||
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
|
@ -10,18 +12,24 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DeferredWorkQueue;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAlchemyArray;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAltar;
|
||||
import wayoftime.bloodmagic.client.render.entity.BloodLightRenderer;
|
||||
import wayoftime.bloodmagic.client.render.entity.SoulSnareRenderer;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenAlchemyTable;
|
||||
import wayoftime.bloodmagic.client.screens.ScreenSoulForge;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilToggleable;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
|
||||
import wayoftime.bloodmagic.common.registries.BloodMagicEntityTypes;
|
||||
import wayoftime.bloodmagic.iface.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
|
@ -41,27 +49,44 @@ public class ClientEvents
|
|||
{
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.SOUL_FORGE_CONTAINER.get(), ScreenSoulForge::new);
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.ARC_CONTAINER.get(), ScreenAlchemicalReactionChamber::new);
|
||||
ScreenManager.registerFactory(BloodMagicBlocks.ALCHEMY_TABLE_CONTAINER.get(), ScreenAlchemyTable::new);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void initClientEvents(FMLClientSetupEvent event)
|
||||
{
|
||||
DeferredWorkQueue.runLater(() -> {
|
||||
RenderType rendertype = RenderType.getCutoutMipped();
|
||||
RenderTypeLookup.setRenderLayer(BloodMagicBlocks.ALCHEMY_TABLE.get(), rendertype);
|
||||
|
||||
ClientEvents.registerContainerScreens();
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(BloodMagicEntityTypes.SNARE.getEntityType(), SoulSnareRenderer::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(BloodMagicEntityTypes.BLOOD_LIGHT.getEntityType(), BloodLightRenderer::new);
|
||||
|
||||
registerToggleableProperties(BloodMagicItems.GREEN_GROVE_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.FAST_MINER_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.MAGNETISM_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.ICE_SIGIL.get());
|
||||
registerMultiWillTool(BloodMagicItems.SENTIENT_SWORD.get());
|
||||
registerMultiWillTool(BloodMagicItems.PETTY_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.LESSER_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.COMMON_GEM.get());
|
||||
|
||||
ItemModelsProperties.registerProperty(BloodMagicItems.SENTIENT_SWORD.get(), BloodMagic.rl("active"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
return ((ItemSentientSword) stack.getItem()).getActivated(stack) ? 1 : 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerItemModelProperties(FMLClientSetupEvent event)
|
||||
{
|
||||
registerToggleableProperties(BloodMagicItems.GREEN_GROVE_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.FAST_MINER_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.MAGNETISM_SIGIL.get());
|
||||
registerToggleableProperties(BloodMagicItems.ICE_SIGIL.get());
|
||||
registerMultiWillTool(BloodMagicItems.SENTIENT_SWORD.get());
|
||||
registerMultiWillTool(BloodMagicItems.PETTY_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.LESSER_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.COMMON_GEM.get());
|
||||
|
||||
ItemModelsProperties.registerProperty(BloodMagicItems.SENTIENT_SWORD.get(), BloodMagic.rl("active"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
return ((ItemSentientSword) stack.getItem()).getActivated(stack) ? 1 : 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerToggleableProperties(Item item)
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package wayoftime.bloodmagic.client.screens;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyTable;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemyTable;
|
||||
|
||||
public class ScreenAlchemyTable extends ScreenBase<ContainerAlchemyTable>
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation(BloodMagic.MODID, "textures/gui/alchemytable.png");
|
||||
public IInventory tileTable;
|
||||
|
||||
public ScreenAlchemyTable(ContainerAlchemyTable container, PlayerInventory playerInventory, ITextComponent title)
|
||||
{
|
||||
super(container, playerInventory, title);
|
||||
tileTable = container.tileTable;
|
||||
this.xSize = 176;
|
||||
this.ySize = 205;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
// public
|
||||
|
||||
// public ScreenSoulForge(InventoryPlayer playerInventory, IInventory tileSoulForge)
|
||||
// {
|
||||
// super(new ContainerAlchemyTable(playerInventory, tileSoulForge));
|
||||
// this.tileSoulForge = tileSoulForge;
|
||||
// this.xSize = 176;
|
||||
// this.ySize = 205;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks)
|
||||
// {
|
||||
// this.drawDefaultBackground();
|
||||
// super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
// this.renderHoveredToolTip(mouseX, mouseY);
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(MatrixStack stack, int mouseX, int mouseY)
|
||||
{
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("tile.bloodmagic.alchemytable.name"), 8, 5, 4210752);
|
||||
this.font.func_243248_b(stack, new TranslationTextComponent("container.inventory"), 8, 111, 4210752);
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(MatrixStack stack, float partialTicks, int mouseX, int mouseY)
|
||||
{
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
getMinecraft().getTextureManager().bindTexture(background);
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
this.blit(stack, i, j, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int l = this.getCookProgressScaled(90);
|
||||
this.blit(stack, i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l);
|
||||
|
||||
for (int slotId = 0; slotId < 6; slotId++)
|
||||
{
|
||||
if (!((TileAlchemyTable) tileTable).isInputSlotAccessible(slotId))
|
||||
{
|
||||
Slot slot = this.getContainer().getSlot(slotId);
|
||||
|
||||
this.blit(stack, i + slot.xPos, j + slot.yPos, 195, 1, 16, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
public int getCookProgressScaled(int scale)
|
||||
{
|
||||
double progress = ((TileAlchemyTable) tileTable).getProgressForGui();
|
||||
// if (tileSoulForge != null)
|
||||
// {
|
||||
// System.out.println("Tile is NOT null");
|
||||
// }
|
||||
// double progress = ((float) this.container.data.get(0)) / ((float) this.container.data.get(1));
|
||||
// System.out.println(this.container.data.get(0));
|
||||
return (int) (progress * scale);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue