Begin stove creation
This commit is contained in:
parent
4d2350ed24
commit
9bbf4a1900
6 changed files with 132 additions and 8 deletions
|
@ -128,7 +128,7 @@ public class StoveBlock extends BlockWithEntity {
|
|||
} else {
|
||||
StoveBlockEntity var10 = (StoveBlockEntity)world.getBlockEntity(x, y, z);
|
||||
if (var10 != null) {
|
||||
player.stove_entity(var10);
|
||||
player.stove_entity(var10);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package xyz.limepot.emb.entity.player;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.util.Session;
|
||||
import net.minecraft.world.World;
|
||||
import xyz.limepot.emb.block.entity.StoveBlockEntity;
|
||||
import xyz.limepot.emb.gui.screen.StoveScreen;
|
||||
|
||||
public class ClientPlayerEntity extends net.minecraft.entity.player.ClientPlayerEntity {
|
||||
protected static MinecraftClient client;
|
||||
public ClientPlayerEntity(MinecraftClient minecraftClient, World world, Session session, int i) {
|
||||
super(minecraftClient, world, session, i);
|
||||
}
|
||||
|
||||
public void stove_entity(StoveBlockEntity stoveBlockEntity) {
|
||||
ClientPlayerEntity.client.setScreen(new StoveScreen(this.inventory, stoveBlockEntity));
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.World;
|
|||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import xyz.limepot.emb.block.entity.StoveBlockEntity;
|
||||
import xyz.limepot.emb.gui.screen.StoveScreen;
|
||||
|
||||
public class PlayerEntity extends net.minecraft.entity.player.PlayerEntity {
|
||||
public PlayerEntity(World world, GameProfile gameProfile) {
|
||||
|
@ -16,7 +17,6 @@ public class PlayerEntity extends net.minecraft.entity.player.PlayerEntity {
|
|||
|
||||
@Override
|
||||
public void sendMessage(Text text) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,9 +28,4 @@ public class PlayerEntity extends net.minecraft.entity.player.PlayerEntity {
|
|||
public BlockPos method_4086() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Unique
|
||||
public void stove_entity(StoveBlockEntity stoveBlockEntity) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
40
src/main/java/xyz/limepot/emb/gui/screen/StoveScreen.java
Normal file
40
src/main/java/xyz/limepot/emb/gui/screen/StoveScreen.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package xyz.limepot.emb.gui.screen;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import xyz.limepot.emb.block.entity.StoveBlockEntity;
|
||||
|
||||
public class StoveScreen extends HandledScreen {
|
||||
private static final Identifier TEXTURE = new Identifier("textures/gui/container/furnace.png");
|
||||
private StoveBlockEntity field_1402;
|
||||
|
||||
public StoveScreen(PlayerInventory playerInventory, StoveBlockEntity stoveBlockEntity) {
|
||||
super(new StoveScreenHandler(playerInventory, stoveBlockEntity));
|
||||
this.field_1402 = stoveBlockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawForeground(int mouseX, int mouseY) {
|
||||
String var3 = this.field_1402.method_5339() ? this.field_1402.method_2385() : I18n.translate(this.field_1402.method_2385());
|
||||
this.textRenderer.draw(var3, this.backgroundWidth / 2 - this.textRenderer.getStringWidth(var3) / 2, 6, 4210752);
|
||||
this.textRenderer.draw(I18n.translate("container.inventory"), 8, this.backgroundHeight - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(float delta, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.client.getTextureManager().bindTexture(TEXTURE);
|
||||
int var4 = (this.width - this.backgroundWidth) / 2;
|
||||
int var5 = (this.height - this.backgroundHeight) / 2;
|
||||
this.drawTexture(var4, var5, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
if (this.field_1402.isFueled()) {
|
||||
int var6 = this.field_1402.method_522(13);
|
||||
this.drawTexture(var4 + 56, var5 + 36 + 12 - var6, 176, 12 - var6, 14, var6 + 1);
|
||||
var6 = this.field_1402.method_521(24);
|
||||
this.drawTexture(var4 + 79, var5 + 34, 176, 14, var6 + 1, 16);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ public class ModSemltingRecipes {
|
|||
|
||||
public static void registerModSmeltingRecipes() {
|
||||
//Register Recipes
|
||||
REGISTRY.addItem(Items.EGG, new ItemStack(ModItems.COOKED_EGG), 0.35F);
|
||||
//REGISTRY.addItem(Items.EGG, new ItemStack(ModItems.COOKED_EGG), 0.35F);
|
||||
REGISTRY.addItem(ModItems.IRON_NUGGET, new ItemStack(ModItems.IRON_COIN), 1F);
|
||||
REGISTRY.addItem(Items.GOLD_NUGGET, new ItemStack(ModItems.GOLD_COIN), 1F);
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package xyz.limepot.emb.recipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import xyz.limepot.emb.item.ModItems;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class StoveRecipeRegistry {
|
||||
private static final StoveRecipeRegistry INSTANCE = new StoveRecipeRegistry();
|
||||
private Map ORIGINAL_PRODUCT_MAP = new HashMap();
|
||||
private Map PRODUCT_XP_MAP = new HashMap();
|
||||
|
||||
public static StoveRecipeRegistry getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private StoveRecipeRegistry() {
|
||||
this.addItem(Items.EGG, new ItemStack(ModItems.COOKED_EGG), 0.35F);
|
||||
|
||||
/*for(FishType var4 : FishType.values()) {
|
||||
if (var4.method_6359()) {
|
||||
this.addItemStack(new ItemStack(Items.RAW_FISH, 1, var4.getMeta()), new ItemStack(Items.field_7018, 1, var4.getMeta()), 0.35F);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void addBlock(Block block, ItemStack stack, float xp) {
|
||||
this.addItem(Item.fromBlock(block), stack, xp);
|
||||
}
|
||||
|
||||
public void addItem(Item item, ItemStack stack, float xp) {
|
||||
this.addItemStack(new ItemStack(item, 1, 32767), stack, xp);
|
||||
}
|
||||
|
||||
public void addItemStack(ItemStack original, ItemStack product, float xp) {
|
||||
this.ORIGINAL_PRODUCT_MAP.put(original, product);
|
||||
this.PRODUCT_XP_MAP.put(product, xp);
|
||||
}
|
||||
|
||||
/*public ItemStack getResult(ItemStack stack) {
|
||||
for(Object var3 : this.ORIGINAL_PRODUCT_MAP.entrySet()) {
|
||||
if (this.stackEquals(stack, (ItemStack)var3.notify())) {
|
||||
return (ItemStack)var3.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}*/
|
||||
|
||||
private boolean stackEquals(ItemStack stack1, ItemStack stack2) {
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getData() == 32767 || stack2.getData() == stack1.getData());
|
||||
}
|
||||
|
||||
public Map getRecipeMap() {
|
||||
return this.ORIGINAL_PRODUCT_MAP;
|
||||
}
|
||||
|
||||
/*public float getXp(ItemStack stack) {
|
||||
for(Map.Entry var3 : this.PRODUCT_XP_MAP.entrySet()) {
|
||||
if (this.stackEquals(stack, (ItemStack)var3.getKey())) {
|
||||
return var3.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0F;
|
||||
}*/
|
||||
}
|
Loading…
Reference in a new issue