mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
New achievement
- Added two new events related to smeltery - Added a new secret achievement labelled "Doing it Wrong"
This commit is contained in:
1 parent
049f8f44a5
commit
5694517f3d
5 files changed
+71
-13
No files matched your search
@@ -1,25 +1,21 @@
|
||||
package tconstruct.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.logic.CastingBasinLogic;
|
||||
import tconstruct.blocks.logic.CastingTableLogic;
|
||||
import tconstruct.blocks.logic.FaucetLogic;
|
||||
import tconstruct.client.block.SearedRender;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import mantle.blocks.abstracts.InventoryBlock;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.logic.*;
|
||||
import tconstruct.client.block.SearedRender;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.event.SmelteryEvent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
|
||||
public class SearedBlock extends InventoryBlock
|
||||
{
|
||||
@@ -112,17 +108,20 @@ public class SearedBlock extends InventoryBlock
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
logic.setInventorySlotContents(0, stack);
|
||||
MinecraftForge.EVENT_BUS.post(new SmelteryEvent.ItemInsertedIntoCasting(logic, x, y, z, stack, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logic.isStackInSlot(1))
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new SmelteryEvent.ItemRemovedFromCasting(logic, x, y, z, logic.getStackInSlot(1), player));
|
||||
ItemStack stack = logic.decrStackSize(1, 1);
|
||||
if (stack != null)
|
||||
addItemToInventory(player, world, x, y, z, stack);
|
||||
}
|
||||
else if (logic.isStackInSlot(0))
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new SmelteryEvent.ItemRemovedFromCasting(logic, x, y, z, logic.getStackInSlot(0), player));
|
||||
ItemStack stack = logic.decrStackSize(0, 1);
|
||||
if (stack != null)
|
||||
addItemToInventory(player, world, x, y, z, stack);
|
||||
@@ -147,17 +146,20 @@ public class SearedBlock extends InventoryBlock
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
logic.setInventorySlotContents(0, stack);
|
||||
MinecraftForge.EVENT_BUS.post(new SmelteryEvent.ItemInsertedIntoCasting(logic, x, y, z, stack, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logic.isStackInSlot(1))
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new SmelteryEvent.ItemRemovedFromCasting(logic, x, y, z, logic.getStackInSlot(1), player));
|
||||
ItemStack stack = logic.decrStackSize(1, 1);
|
||||
if (stack != null)
|
||||
addItemToInventory(player, world, x, y, z, stack);
|
||||
}
|
||||
else if (logic.isStackInSlot(0))
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new SmelteryEvent.ItemRemovedFromCasting(logic, x, y, z, logic.getStackInSlot(0), player));
|
||||
ItemStack stack = logic.decrStackSize(0, 1);
|
||||
if (stack != null)
|
||||
addItemToInventory(player, world, x, y, z, stack);
|
||||
|
||||
@@ -841,5 +841,6 @@ public class TContent implements IFuelHandler
|
||||
new Achievement(2747, "tconstruct.enemySlayer", 0, 5, new ItemStack(TRepo.titleIcon, 1, 4099), achievements.get("tconstruct.preparedFight")).registerAchievement());
|
||||
achievements.put("tconstruct.dualConvenience", new Achievement(2748, "tconstruct.dualConvenience", 0, 7, new ItemStack(TRepo.titleIcon, 1, 4100), achievements.get("tconstruct.enemySlayer"))
|
||||
.setSpecial().registerAchievement());
|
||||
achievements.put("tconstruct.doingItWrong", new Achievement(2749, "tconstruct.doingItWrong", -2, -3, new ItemStack(TRepo.manualBook, 1, 2), achievements.get("tconstruct.smelteryMaker")).registerAchievement());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package tconstruct.library.event;
|
||||
|
||||
import mantle.blocks.abstracts.InventoryLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class SmelteryEvent extends Event {
|
||||
|
||||
public InventoryLogic component;
|
||||
public int x, y, z;
|
||||
|
||||
public SmelteryEvent(InventoryLogic component, int x, int y, int z){
|
||||
this.component = component;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static class ItemInsertedIntoCasting extends SmelteryEvent {
|
||||
public ItemStack item;
|
||||
public EntityPlayer player;
|
||||
|
||||
public ItemInsertedIntoCasting(InventoryLogic component, int x, int y, int z, ItemStack item, EntityPlayer player) {
|
||||
super(component, x, y, z);
|
||||
this.item = item;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemRemovedFromCasting extends SmelteryEvent {
|
||||
public ItemStack item;
|
||||
public EntityPlayer player;
|
||||
|
||||
public ItemRemovedFromCasting(InventoryLogic component, int x, int y, int z, ItemStack item, EntityPlayer player) {
|
||||
super(component, x, y, z);
|
||||
this.item = item;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import tconstruct.library.event.SmelteryEvent;
|
||||
|
||||
import net.minecraftforge.common.FakePlayer;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import tconstruct.achievements.TAchievements;
|
||||
@@ -24,4 +26,13 @@ public class TEventHandlerAchievement {
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onItemPlacedIntoCasting(SmelteryEvent.ItemInsertedIntoCasting event){
|
||||
if(event.player != null && event.item != null){
|
||||
if(event.item.getItem() instanceof ToolCore){
|
||||
event.player.addStat(TAchievements.achievements.get("tconstruct.doingItWrong"), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user