mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 12:19:48 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.entity.boss.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
@@ -14,47 +14,47 @@ import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.util.network.ArmourGuiSyncPacket;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class TinkerArmorEvents
|
||||
{
|
||||
public class TinkerArmorEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingDrop (LivingDropsEvent event)
|
||||
{
|
||||
if (event.entityLiving == null)
|
||||
return;
|
||||
public void onLivingDrop(LivingDropsEvent event) {
|
||||
if (event.entityLiving == null) return;
|
||||
|
||||
if(!event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
|
||||
return;
|
||||
if (!event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) return;
|
||||
|
||||
if (TConstruct.random.nextInt(200) == 0 && event.entityLiving instanceof IMob && event.source.damageType.equals("player"))
|
||||
{
|
||||
if (TConstruct.random.nextInt(200) == 0
|
||||
&& event.entityLiving instanceof IMob
|
||||
&& event.source.damageType.equals("player")) {
|
||||
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 1);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
if (event.entityLiving instanceof IBossDisplayData)
|
||||
{
|
||||
if (event.entityLiving instanceof IBossDisplayData) {
|
||||
String entityName = event.entityLiving.getClass().getSimpleName().toLowerCase();
|
||||
for(String name : PHConstruct.heartDropBlacklist)
|
||||
if (name.toLowerCase(Locale.US).equals(entityName))
|
||||
return;
|
||||
for (String name : PHConstruct.heartDropBlacklist)
|
||||
if (name.toLowerCase(Locale.US).equals(entityName)) return;
|
||||
|
||||
int count = event.entityLiving instanceof EntityDragon ? 5 : 1;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
for (int i = 0; i < count; i++) {
|
||||
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 3);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
@@ -63,20 +63,18 @@ public class TinkerArmorEvents
|
||||
|
||||
/* Abilities */
|
||||
@SubscribeEvent
|
||||
public void armorMineSpeed (net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event)
|
||||
{
|
||||
if(event.entityPlayer == null)
|
||||
return;
|
||||
public void armorMineSpeed(net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event) {
|
||||
if (event.entityPlayer == null) return;
|
||||
|
||||
ItemStack glove = TPlayerStats.get(event.entityPlayer).armor.getStackInSlot(1);
|
||||
if(event.entityPlayer.worldObj.isRemote) { // todo: sync extended inventory with clients so this stuff and rendering is done properly...
|
||||
if(ArmorProxyClient.armorExtended != null)
|
||||
glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
|
||||
else
|
||||
glove = null;
|
||||
if (event.entityPlayer
|
||||
.worldObj
|
||||
.isRemote) { // todo: sync extended inventory with clients so this stuff and rendering is done
|
||||
// properly...
|
||||
if (ArmorProxyClient.armorExtended != null) glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
|
||||
else glove = null;
|
||||
}
|
||||
if(glove == null || !glove.hasTagCompound())
|
||||
return;
|
||||
if (glove == null || !glove.hasTagCompound()) return;
|
||||
|
||||
// ok, we got a glove. bonus mining speeeeed
|
||||
NBTTagCompound tags = glove.getTagCompound().getCompoundTag(TinkerArmor.travelGlove.getBaseTagName());
|
||||
@@ -88,25 +86,21 @@ public class TinkerArmorEvents
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void jumpHeight (LivingJumpEvent event)
|
||||
{
|
||||
public void jumpHeight(LivingJumpEvent event) {
|
||||
ItemStack stack = event.entityLiving.getEquipmentInSlot(2);
|
||||
if (stack != null && stack.getItem() instanceof TravelWings)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof TravelWings) {
|
||||
event.entityLiving.motionY += 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void slimefall (LivingFallEvent event)
|
||||
{
|
||||
public void slimefall(LivingFallEvent event) {
|
||||
ItemStack boots = event.entityLiving.getEquipmentInSlot(1);
|
||||
if (boots != null && boots.getItem() instanceof IModifyable)
|
||||
{
|
||||
NBTTagCompound tag = boots.getTagCompound().getCompoundTag(((IModifyable) boots.getItem()).getBaseTagName());
|
||||
if (boots != null && boots.getItem() instanceof IModifyable) {
|
||||
NBTTagCompound tag =
|
||||
boots.getTagCompound().getCompoundTag(((IModifyable) boots.getItem()).getBaseTagName());
|
||||
int sole = tag.getInteger("Slimy Soles");
|
||||
if (sole > 0)
|
||||
{
|
||||
if (sole > 0) {
|
||||
event.distance /= (1 + sole);
|
||||
event.entityLiving.fallDistance /= (1 + sole);
|
||||
}
|
||||
@@ -114,38 +108,30 @@ public class TinkerArmorEvents
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void perfectDodge(LivingAttackEvent event)
|
||||
{
|
||||
if(!event.source.isProjectile())
|
||||
return;
|
||||
public void perfectDodge(LivingAttackEvent event) {
|
||||
if (!event.source.isProjectile()) return;
|
||||
|
||||
// perfect dodge?
|
||||
if(!(event.entityLiving instanceof EntityPlayer))
|
||||
return;
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack chest = player.getCurrentArmor(2);
|
||||
if(chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound())
|
||||
return;
|
||||
if (chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = chest.getTagCompound().getCompoundTag(((IModifyable) chest.getItem()).getBaseTagName());
|
||||
int dodge = tags.getInteger("Perfect Dodge");
|
||||
if(dodge > TConstruct.random.nextInt(10))
|
||||
event.setCanceled(true);
|
||||
if (dodge > TConstruct.random.nextInt(10)) event.setCanceled(true);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void joinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayerMP)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP)event.entity;
|
||||
public void joinWorld(EntityJoinWorldEvent event) {
|
||||
if (event.entity instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) event.entity;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
stats.saveNBTData(tag);
|
||||
ArmourGuiSyncPacket syncPacket = new ArmourGuiSyncPacket(tag);
|
||||
TConstruct.packetPipeline.sendTo(syncPacket, player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user