mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Fixed a ginormous bug that fucked up crafting.
I hope.
This commit is contained in:
parent
013518a57c
commit
5b166a784f
1 changed files with 3 additions and 8 deletions
|
@ -17,7 +17,6 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
|
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentServerData;
|
import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentServerData;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -25,8 +24,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class PlayerObtainEvents{
|
public class PlayerObtainEvents{
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@ -34,12 +31,10 @@ public class PlayerObtainEvents{
|
||||||
checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
|
checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
|
||||||
|
|
||||||
if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){
|
if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){
|
||||||
if(!event.player.worldObj.isRemote && event.crafting.getItem() != InitItems.itemBooklet){
|
if(!event.player.worldObj.isRemote && event.crafting != null && event.crafting.getItem() != null && event.crafting.getItem() != InitItems.itemBooklet){
|
||||||
|
|
||||||
String itemName = event.crafting.getItem().getRegistryName();
|
String name = event.crafting.getItem().getRegistryName();
|
||||||
String blockName = Block.getBlockFromItem(event.crafting.getItem()).getRegistryName();
|
if(name != null && name.toLowerCase().contains(ModUtil.MOD_ID_LOWER)){
|
||||||
|
|
||||||
if((itemName != null && itemName.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID_LOWER)) || (blockName != null && blockName.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID_LOWER))){
|
|
||||||
NBTTagCompound compound = PersistentServerData.getDataFromPlayer(event.player);
|
NBTTagCompound compound = PersistentServerData.getDataFromPlayer(event.player);
|
||||||
if(compound != null && !compound.getBoolean("BookGottenAlready")){
|
if(compound != null && !compound.getBoolean("BookGottenAlready")){
|
||||||
compound.setBoolean("BookGottenAlready", true);
|
compound.setBoolean("BookGottenAlready", true);
|
||||||
|
|
Loading…
Reference in a new issue