mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
chore: minor porting and removing files
This commit is contained in:
parent
32f7a3915f
commit
7cd34c5360
6 changed files with 561 additions and 588 deletions
|
@ -1,40 +1,41 @@
|
|||
/*
|
||||
* This file ("GuiFactory.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.config;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory;
|
||||
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConfigGui() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiScreen createConfigGui(GuiScreen parentScreen) {
|
||||
return new GuiConfiguration(parentScreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// TODO: [port][note] forge does not support this atm
|
||||
///*
|
||||
// * This file ("GuiFactory.java") is part of the Actually Additions mod for Minecraft.
|
||||
// * It is created and owned by Ellpeck and distributed
|
||||
// * under the Actually Additions License to be found at
|
||||
// * http://ellpeck.de/actaddlicense
|
||||
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
// *
|
||||
// * © 2015-2017 Ellpeck
|
||||
// */
|
||||
//
|
||||
//package de.ellpeck.actuallyadditions.mod.config;
|
||||
//
|
||||
//import java.util.Set;
|
||||
//
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.GuiScreen;
|
||||
//import net.minecraftforge.fml.client.IModGuiFactory;
|
||||
//
|
||||
//public class GuiFactory implements IModGuiFactory {
|
||||
//
|
||||
// @Override
|
||||
// public void initialize(Minecraft minecraftInstance) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean hasConfigGui() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public GuiScreen createConfigGui(GuiScreen parentScreen) {
|
||||
// return new GuiConfiguration(parentScreen);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,363 +1,364 @@
|
|||
/*
|
||||
* This file ("CreativeTab.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.creative;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
|
||||
public class CreativeTab extends CreativeTabs {
|
||||
|
||||
public static final CreativeTab INSTANCE = new CreativeTab();
|
||||
private NonNullList<ItemStack> list;
|
||||
|
||||
public CreativeTab() {
|
||||
super(ActuallyAdditions.MODID);
|
||||
this.setBackgroundImageName(ActuallyAdditions.MODID + ".png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSearchBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSearchbarWidth() {
|
||||
return 70;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
return new ItemStack(InitItems.itemBooklet);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void displayAllRelevantItems(NonNullList<ItemStack> list) {
|
||||
this.list = list;
|
||||
|
||||
this.add(InitItems.itemBooklet);
|
||||
this.add(InitBlocks.blockSmileyCloud);
|
||||
this.add(InitBlocks.blockTinyTorch);
|
||||
|
||||
this.add(InitBlocks.blockFireworkBox);
|
||||
this.add(InitBlocks.blockLaserRelay);
|
||||
this.add(InitBlocks.blockLaserRelayAdvanced);
|
||||
this.add(InitBlocks.blockLaserRelayExtreme);
|
||||
this.add(InitBlocks.blockLaserRelayFluids);
|
||||
this.add(InitBlocks.blockLaserRelayItem);
|
||||
this.add(InitBlocks.blockLaserRelayItemWhitelist);
|
||||
this.add(InitBlocks.blockItemViewer);
|
||||
this.add(InitBlocks.blockItemViewerHopping);
|
||||
this.add(InitBlocks.blockAtomicReconstructor);
|
||||
this.add(InitBlocks.blockEmpowerer);
|
||||
this.add(InitBlocks.blockPhantomface);
|
||||
this.add(InitBlocks.blockPhantomEnergyface);
|
||||
this.add(InitBlocks.blockPhantomLiquiface);
|
||||
this.add(InitBlocks.blockPhantomRedstoneface);
|
||||
this.add(InitBlocks.blockPhantomPlacer);
|
||||
this.add(InitBlocks.blockPhantomBreaker);
|
||||
this.add(InitBlocks.blockPlayerInterface);
|
||||
this.add(InitBlocks.blockInputter);
|
||||
this.add(InitBlocks.blockInputterAdvanced);
|
||||
this.add(InitBlocks.blockPhantomBooster);
|
||||
this.add(InitBlocks.blockCoffeeMachine);
|
||||
this.add(InitBlocks.blockXPSolidifier);
|
||||
this.add(InitBlocks.blockDisplayStand);
|
||||
|
||||
this.add(InitBlocks.blockFarmer);
|
||||
this.add(InitBlocks.blockShockSuppressor);
|
||||
this.add(InitBlocks.blockMiner);
|
||||
this.add(InitBlocks.blockGreenhouseGlass);
|
||||
this.add(InitBlocks.blockGrinder);
|
||||
this.add(InitBlocks.blockGrinderDouble);
|
||||
this.add(InitBlocks.blockFurnaceDouble);
|
||||
this.add(InitBlocks.blockLavaFactoryController);
|
||||
|
||||
this.add(InitBlocks.blockEnergizer);
|
||||
this.add(InitBlocks.blockEnervator);
|
||||
|
||||
this.add(InitBlocks.blockFurnaceSolar);
|
||||
this.add(InitBlocks.blockHeatCollector);
|
||||
this.add(InitBlocks.blockCoalGenerator);
|
||||
this.add(InitBlocks.blockOilGenerator);
|
||||
this.add(InitBlocks.blockLeafGenerator);
|
||||
this.add(InitBlocks.blockBioReactor);
|
||||
|
||||
this.add(InitBlocks.blockItemRepairer);
|
||||
this.add(InitBlocks.blockFishingNet);
|
||||
this.add(InitBlocks.blockBreaker);
|
||||
this.add(InitBlocks.blockDirectionalBreaker);
|
||||
this.add(InitBlocks.blockRangedCollector);
|
||||
this.add(InitBlocks.blockPlacer);
|
||||
this.add(InitBlocks.blockDropper);
|
||||
this.add(InitBlocks.blockFluidPlacer);
|
||||
this.add(InitBlocks.blockFluidCollector);
|
||||
this.add(InitBlocks.blockBatteryBox);
|
||||
|
||||
this.add(InitBlocks.blockMisc);
|
||||
this.add(InitBlocks.blockFeeder);
|
||||
this.add(InitBlocks.blockCompost);
|
||||
this.add(InitBlocks.blockGiantChest);
|
||||
this.add(InitBlocks.blockGiantChestMedium);
|
||||
this.add(InitBlocks.blockGiantChestLarge);
|
||||
this.add(InitBlocks.blockCanolaPress);
|
||||
this.add(InitBlocks.blockFermentingBarrel);
|
||||
|
||||
this.add(InitBlocks.blockTestifiBucksGreenWall);
|
||||
this.add(InitBlocks.blockTestifiBucksWhiteWall);
|
||||
this.add(InitBlocks.blockTestifiBucksGreenStairs);
|
||||
this.add(InitBlocks.blockTestifiBucksWhiteStairs);
|
||||
this.add(InitBlocks.blockTestifiBucksGreenSlab);
|
||||
this.add(InitBlocks.blockTestifiBucksWhiteSlab);
|
||||
this.add(InitBlocks.blockTestifiBucksGreenFence);
|
||||
this.add(InitBlocks.blockTestifiBucksWhiteFence);
|
||||
|
||||
this.add(InitBlocks.blockQuartzWall);
|
||||
this.add(InitBlocks.blockQuartzStair);
|
||||
this.add(InitBlocks.blockQuartzSlab);
|
||||
this.add(InitBlocks.blockChiseledQuartzWall);
|
||||
this.add(InitBlocks.blockChiseledQuartzStair);
|
||||
this.add(InitBlocks.blockChiseledQuartzSlab);
|
||||
this.add(InitBlocks.blockPillarQuartzWall);
|
||||
this.add(InitBlocks.blockPillarQuartzStair);
|
||||
this.add(InitBlocks.blockPillarQuartzSlab);
|
||||
|
||||
this.add(InitBlocks.blockColoredLamp);
|
||||
this.add(InitBlocks.blockColoredLampOn);
|
||||
this.add(InitBlocks.blockLampPowerer);
|
||||
this.add(InitBlocks.blockTreasureChest);
|
||||
|
||||
this.add(InitBlocks.blockBlackLotus);
|
||||
|
||||
this.add(InitItems.itemBag);
|
||||
this.add(InitItems.itemVoidBag);
|
||||
|
||||
this.add(InitItems.itemWorm);
|
||||
this.add(InitItems.itemPlayerProbe);
|
||||
this.add(InitItems.itemColorLens);
|
||||
this.add(InitItems.itemExplosionLens);
|
||||
this.add(InitItems.itemDamageLens);
|
||||
this.add(InitItems.itemMoreDamageLens);
|
||||
this.add(InitItems.itemDisenchantingLens);
|
||||
this.add(InitItems.itemMiningLens);
|
||||
this.add(InitItems.itemLaserWrench);
|
||||
this.add(InitItems.itemLaserUpgradeInvisibility);
|
||||
this.add(InitItems.itemLaserUpgradeRange);
|
||||
this.add(InitItems.itemEngineerGoggles);
|
||||
this.add(InitItems.itemEngineerGogglesAdvanced);
|
||||
this.add(InitItems.itemCrateKeeper);
|
||||
this.add(InitItems.itemChestToCrateUpgrade);
|
||||
this.add(InitItems.itemSmallToMediumCrateUpgrade);
|
||||
this.add(InitItems.itemMediumToLargeCrateUpgrade);
|
||||
this.add(InitItems.itemSpawnerChanger);
|
||||
this.add(InitItems.itemWaterBowl);
|
||||
|
||||
this.add(InitItems.itemDrill);
|
||||
this.add(InitItems.itemDrillUpgradeSpeed);
|
||||
this.add(InitItems.itemDrillUpgradeSpeedII);
|
||||
this.add(InitItems.itemDrillUpgradeSpeedIII);
|
||||
this.add(InitItems.itemDrillUpgradeSilkTouch);
|
||||
this.add(InitItems.itemDrillUpgradeFortune);
|
||||
this.add(InitItems.itemDrillUpgradeFortuneII);
|
||||
this.add(InitItems.itemDrillUpgradeThreeByThree);
|
||||
this.add(InitItems.itemDrillUpgradeFiveByFive);
|
||||
this.add(InitItems.itemDrillUpgradeBlockPlacing);
|
||||
this.add(InitItems.itemBattery);
|
||||
this.add(InitItems.itemBatteryDouble);
|
||||
this.add(InitItems.itemBatteryTriple);
|
||||
this.add(InitItems.itemBatteryQuadruple);
|
||||
this.add(InitItems.itemBatteryQuintuple);
|
||||
this.add(InitItems.itemTeleStaff);
|
||||
this.add(InitItems.itemFillingWand);
|
||||
|
||||
this.add(InitItems.itemGrowthRing);
|
||||
this.add(InitItems.itemMagnetRing);
|
||||
this.add(InitItems.itemWaterRemovalRing);
|
||||
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCanolaOil, Fluid.BUCKET_VOLUME)));
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidRefinedCanolaOil, Fluid.BUCKET_VOLUME)));
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, Fluid.BUCKET_VOLUME)));
|
||||
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, Fluid.BUCKET_VOLUME)));
|
||||
|
||||
this.add(InitItems.itemPhantomConnector);
|
||||
this.add(InitItems.itemFilter);
|
||||
this.add(InitItems.itemWingsOfTheBats);
|
||||
|
||||
this.add(InitItems.itemCoffeeSeed);
|
||||
this.add(InitItems.itemCoffeeBean);
|
||||
this.add(InitItems.itemRiceSeed);
|
||||
this.add(InitItems.itemCanolaSeed);
|
||||
this.add(InitItems.itemFlaxSeed);
|
||||
this.add(InitItems.itemHairyBall);
|
||||
this.add(InitItems.itemMisc);
|
||||
this.add(InitItems.itemResonantRice);
|
||||
this.add(InitItems.itemFertilizer);
|
||||
|
||||
this.add(InitItems.itemCoffee);
|
||||
this.add(InitItems.itemFoods);
|
||||
this.add(InitItems.itemKnife);
|
||||
this.add(InitItems.itemCrafterOnAStick);
|
||||
this.add(InitItems.itemDust);
|
||||
this.add(InitItems.itemSolidifiedExperience);
|
||||
this.add(InitItems.itemLeafBlower);
|
||||
this.add(InitItems.itemLeafBlowerAdvanced);
|
||||
|
||||
this.add(InitItems.woodenPaxel);
|
||||
this.add(InitItems.stonePaxel);
|
||||
this.add(InitItems.ironPaxel);
|
||||
this.add(InitItems.goldPaxel);
|
||||
this.add(InitItems.diamondPaxel);
|
||||
this.add(InitItems.emeraldPaxel);
|
||||
this.add(InitItems.obsidianPaxel);
|
||||
this.add(InitItems.quartzPaxel);
|
||||
this.add(InitItems.itemPaxelCrystalRed);
|
||||
this.add(InitItems.itemPaxelCrystalBlue);
|
||||
this.add(InitItems.itemPaxelCrystalLightBlue);
|
||||
this.add(InitItems.itemPaxelCrystalBlack);
|
||||
this.add(InitItems.itemPaxelCrystalGreen);
|
||||
this.add(InitItems.itemPaxelCrystalWhite);
|
||||
|
||||
this.add(InitBlocks.blockCrystalClusterRedstone);
|
||||
this.add(InitBlocks.blockCrystalClusterLapis);
|
||||
this.add(InitBlocks.blockCrystalClusterDiamond);
|
||||
this.add(InitBlocks.blockCrystalClusterCoal);
|
||||
this.add(InitBlocks.blockCrystalClusterEmerald);
|
||||
this.add(InitBlocks.blockCrystalClusterIron);
|
||||
this.add(InitBlocks.blockCrystal);
|
||||
this.add(InitBlocks.blockCrystalEmpowered);
|
||||
this.add(InitItems.itemCrystal);
|
||||
this.add(InitItems.itemCrystalEmpowered);
|
||||
this.add(InitItems.itemCrystalShard);
|
||||
|
||||
this.add(InitItems.itemJams);
|
||||
|
||||
this.add(InitItems.itemPotionRing);
|
||||
this.add(InitItems.itemPotionRingAdvanced);
|
||||
|
||||
this.add(InitItems.itemPickaxeQuartz);
|
||||
this.add(InitItems.itemSwordQuartz);
|
||||
this.add(InitItems.itemAxeQuartz);
|
||||
this.add(InitItems.itemShovelQuartz);
|
||||
this.add(InitItems.itemHoeQuartz);
|
||||
|
||||
this.add(InitItems.itemHelmQuartz);
|
||||
this.add(InitItems.itemChestQuartz);
|
||||
this.add(InitItems.itemPantsQuartz);
|
||||
this.add(InitItems.itemBootsQuartz);
|
||||
|
||||
this.add(InitItems.itemPickaxeEmerald);
|
||||
this.add(InitItems.itemSwordEmerald);
|
||||
this.add(InitItems.itemAxeEmerald);
|
||||
this.add(InitItems.itemShovelEmerald);
|
||||
this.add(InitItems.itemHoeEmerald);
|
||||
|
||||
this.add(InitItems.itemHelmEmerald);
|
||||
this.add(InitItems.itemChestEmerald);
|
||||
this.add(InitItems.itemPantsEmerald);
|
||||
this.add(InitItems.itemBootsEmerald);
|
||||
|
||||
this.add(InitItems.itemPickaxeObsidian);
|
||||
this.add(InitItems.itemSwordObsidian);
|
||||
this.add(InitItems.itemAxeObsidian);
|
||||
this.add(InitItems.itemShovelObsidian);
|
||||
this.add(InitItems.itemHoeObsidian);
|
||||
|
||||
this.add(InitItems.itemHelmObsidian);
|
||||
this.add(InitItems.itemChestObsidian);
|
||||
this.add(InitItems.itemPantsObsidian);
|
||||
this.add(InitItems.itemBootsObsidian);
|
||||
|
||||
this.add(InitItems.itemPickaxeCrystalRed);
|
||||
this.add(InitItems.itemAxeCrystalRed);
|
||||
this.add(InitItems.itemShovelCrystalRed);
|
||||
this.add(InitItems.itemSwordCrystalRed);
|
||||
this.add(InitItems.itemHoeCrystalRed);
|
||||
this.add(InitItems.itemHelmCrystalRed);
|
||||
this.add(InitItems.itemChestCrystalRed);
|
||||
this.add(InitItems.itemPantsCrystalRed);
|
||||
this.add(InitItems.itemBootsCrystalRed);
|
||||
|
||||
this.add(InitItems.itemPickaxeCrystalBlue);
|
||||
this.add(InitItems.itemAxeCrystalBlue);
|
||||
this.add(InitItems.itemShovelCrystalBlue);
|
||||
this.add(InitItems.itemSwordCrystalBlue);
|
||||
this.add(InitItems.itemHoeCrystalBlue);
|
||||
this.add(InitItems.itemHelmCrystalBlue);
|
||||
this.add(InitItems.itemChestCrystalBlue);
|
||||
this.add(InitItems.itemPantsCrystalBlue);
|
||||
this.add(InitItems.itemBootsCrystalBlue);
|
||||
|
||||
this.add(InitItems.itemPickaxeCrystalLightBlue);
|
||||
this.add(InitItems.itemAxeCrystalLightBlue);
|
||||
this.add(InitItems.itemShovelCrystalLightBlue);
|
||||
this.add(InitItems.itemSwordCrystalLightBlue);
|
||||
this.add(InitItems.itemHoeCrystalLightBlue);
|
||||
this.add(InitItems.itemHelmCrystalLightBlue);
|
||||
this.add(InitItems.itemChestCrystalLightBlue);
|
||||
this.add(InitItems.itemPantsCrystalLightBlue);
|
||||
this.add(InitItems.itemBootsCrystalLightBlue);
|
||||
|
||||
this.add(InitItems.itemPickaxeCrystalBlack);
|
||||
this.add(InitItems.itemAxeCrystalBlack);
|
||||
this.add(InitItems.itemShovelCrystalBlack);
|
||||
this.add(InitItems.itemSwordCrystalBlack);
|
||||
this.add(InitItems.itemHoeCrystalBlack);
|
||||
this.add(InitItems.itemHelmCrystalBlack);
|
||||
this.add(InitItems.itemChestCrystalBlack);
|
||||
this.add(InitItems.itemPantsCrystalBlack);
|
||||
this.add(InitItems.itemBootsCrystalBlack);
|
||||
|
||||
this.add(InitItems.itemPickaxeCrystalGreen);
|
||||
this.add(InitItems.itemAxeCrystalGreen);
|
||||
this.add(InitItems.itemShovelCrystalGreen);
|
||||
this.add(InitItems.itemSwordCrystalGreen);
|
||||
this.add(InitItems.itemHoeCrystalGreen);
|
||||
this.add(InitItems.itemHelmCrystalGreen);
|
||||
this.add(InitItems.itemChestCrystalGreen);
|
||||
this.add(InitItems.itemPantsCrystalGreen);
|
||||
this.add(InitItems.itemBootsCrystalGreen);
|
||||
|
||||
this.add(InitItems.itemPickaxeCrystalWhite);
|
||||
this.add(InitItems.itemAxeCrystalWhite);
|
||||
this.add(InitItems.itemShovelCrystalWhite);
|
||||
this.add(InitItems.itemSwordCrystalWhite);
|
||||
this.add(InitItems.itemHoeCrystalWhite);
|
||||
this.add(InitItems.itemHelmCrystalWhite);
|
||||
this.add(InitItems.itemChestCrystalWhite);
|
||||
this.add(InitItems.itemPantsCrystalWhite);
|
||||
this.add(InitItems.itemBootsCrystalWhite);
|
||||
}
|
||||
|
||||
public void add(Item item) {
|
||||
if (item != null && (!(item instanceof IDisableableItem) || item instanceof IDisableableItem && !((IDisableableItem) item).isDisabled())) {
|
||||
item.getSubItems(INSTANCE, this.list);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(Block block) {
|
||||
if (block != null) {
|
||||
block.getSubBlocks(INSTANCE, this.list);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: [port][note] not used, this isn't how we do this any more
|
||||
///*
|
||||
// * This file ("CreativeTab.java") is part of the Actually Additions mod for Minecraft.
|
||||
// * It is created and owned by Ellpeck and distributed
|
||||
// * under the Actually Additions License to be found at
|
||||
// * http://ellpeck.de/actaddlicense
|
||||
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
// *
|
||||
// * © 2015-2017 Ellpeck
|
||||
// */
|
||||
//
|
||||
//package de.ellpeck.actuallyadditions.mod.creative;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
//import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
//import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
//import net.minecraft.block.Block;
|
||||
//import net.minecraft.creativetab.CreativeTabs;
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.util.NonNullList;
|
||||
//import net.minecraftforge.fluids.Fluid;
|
||||
//import net.minecraftforge.fluids.FluidStack;
|
||||
//import net.minecraftforge.fluids.FluidUtil;
|
||||
//import net.minecraftforge.fml.relauncher.Side;
|
||||
//import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
//
|
||||
//public class CreativeTab extends CreativeTabs {
|
||||
//
|
||||
// public static final CreativeTab INSTANCE = new CreativeTab();
|
||||
// private NonNullList<ItemStack> list;
|
||||
//
|
||||
// public CreativeTab() {
|
||||
// super(ActuallyAdditions.MODID);
|
||||
// this.setBackgroundImageName(ActuallyAdditions.MODID + ".png");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean hasSearchBar() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getSearchbarWidth() {
|
||||
// return 70;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack createIcon() {
|
||||
// return new ItemStack(InitItems.itemBooklet);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @OnlyIn(Dist.CLIENT)
|
||||
// public void displayAllRelevantItems(NonNullList<ItemStack> list) {
|
||||
// this.list = list;
|
||||
//
|
||||
// this.add(InitItems.itemBooklet);
|
||||
// this.add(InitBlocks.blockSmileyCloud);
|
||||
// this.add(InitBlocks.blockTinyTorch);
|
||||
//
|
||||
// this.add(InitBlocks.blockFireworkBox);
|
||||
// this.add(InitBlocks.blockLaserRelay);
|
||||
// this.add(InitBlocks.blockLaserRelayAdvanced);
|
||||
// this.add(InitBlocks.blockLaserRelayExtreme);
|
||||
// this.add(InitBlocks.blockLaserRelayFluids);
|
||||
// this.add(InitBlocks.blockLaserRelayItem);
|
||||
// this.add(InitBlocks.blockLaserRelayItemWhitelist);
|
||||
// this.add(InitBlocks.blockItemViewer);
|
||||
// this.add(InitBlocks.blockItemViewerHopping);
|
||||
// this.add(InitBlocks.blockAtomicReconstructor);
|
||||
// this.add(InitBlocks.blockEmpowerer);
|
||||
// this.add(InitBlocks.blockPhantomface);
|
||||
// this.add(InitBlocks.blockPhantomEnergyface);
|
||||
// this.add(InitBlocks.blockPhantomLiquiface);
|
||||
// this.add(InitBlocks.blockPhantomRedstoneface);
|
||||
// this.add(InitBlocks.blockPhantomPlacer);
|
||||
// this.add(InitBlocks.blockPhantomBreaker);
|
||||
// this.add(InitBlocks.blockPlayerInterface);
|
||||
// this.add(InitBlocks.blockInputter);
|
||||
// this.add(InitBlocks.blockInputterAdvanced);
|
||||
// this.add(InitBlocks.blockPhantomBooster);
|
||||
// this.add(InitBlocks.blockCoffeeMachine);
|
||||
// this.add(InitBlocks.blockXPSolidifier);
|
||||
// this.add(InitBlocks.blockDisplayStand);
|
||||
//
|
||||
// this.add(InitBlocks.blockFarmer);
|
||||
// this.add(InitBlocks.blockShockSuppressor);
|
||||
// this.add(InitBlocks.blockMiner);
|
||||
// this.add(InitBlocks.blockGreenhouseGlass);
|
||||
// this.add(InitBlocks.blockGrinder);
|
||||
// this.add(InitBlocks.blockGrinderDouble);
|
||||
// this.add(InitBlocks.blockFurnaceDouble);
|
||||
// this.add(InitBlocks.blockLavaFactoryController);
|
||||
//
|
||||
// this.add(InitBlocks.blockEnergizer);
|
||||
// this.add(InitBlocks.blockEnervator);
|
||||
//
|
||||
// this.add(InitBlocks.blockFurnaceSolar);
|
||||
// this.add(InitBlocks.blockHeatCollector);
|
||||
// this.add(InitBlocks.blockCoalGenerator);
|
||||
// this.add(InitBlocks.blockOilGenerator);
|
||||
// this.add(InitBlocks.blockLeafGenerator);
|
||||
// this.add(InitBlocks.blockBioReactor);
|
||||
//
|
||||
// this.add(InitBlocks.blockItemRepairer);
|
||||
// this.add(InitBlocks.blockFishingNet);
|
||||
// this.add(InitBlocks.blockBreaker);
|
||||
// this.add(InitBlocks.blockDirectionalBreaker);
|
||||
// this.add(InitBlocks.blockRangedCollector);
|
||||
// this.add(InitBlocks.blockPlacer);
|
||||
// this.add(InitBlocks.blockDropper);
|
||||
// this.add(InitBlocks.blockFluidPlacer);
|
||||
// this.add(InitBlocks.blockFluidCollector);
|
||||
// this.add(InitBlocks.blockBatteryBox);
|
||||
//
|
||||
// this.add(InitBlocks.blockMisc);
|
||||
// this.add(InitBlocks.blockFeeder);
|
||||
// this.add(InitBlocks.blockCompost);
|
||||
// this.add(InitBlocks.blockGiantChest);
|
||||
// this.add(InitBlocks.blockGiantChestMedium);
|
||||
// this.add(InitBlocks.blockGiantChestLarge);
|
||||
// this.add(InitBlocks.blockCanolaPress);
|
||||
// this.add(InitBlocks.blockFermentingBarrel);
|
||||
//
|
||||
// this.add(InitBlocks.blockTestifiBucksGreenWall);
|
||||
// this.add(InitBlocks.blockTestifiBucksWhiteWall);
|
||||
// this.add(InitBlocks.blockTestifiBucksGreenStairs);
|
||||
// this.add(InitBlocks.blockTestifiBucksWhiteStairs);
|
||||
// this.add(InitBlocks.blockTestifiBucksGreenSlab);
|
||||
// this.add(InitBlocks.blockTestifiBucksWhiteSlab);
|
||||
// this.add(InitBlocks.blockTestifiBucksGreenFence);
|
||||
// this.add(InitBlocks.blockTestifiBucksWhiteFence);
|
||||
//
|
||||
// this.add(InitBlocks.blockQuartzWall);
|
||||
// this.add(InitBlocks.blockQuartzStair);
|
||||
// this.add(InitBlocks.blockQuartzSlab);
|
||||
// this.add(InitBlocks.blockChiseledQuartzWall);
|
||||
// this.add(InitBlocks.blockChiseledQuartzStair);
|
||||
// this.add(InitBlocks.blockChiseledQuartzSlab);
|
||||
// this.add(InitBlocks.blockPillarQuartzWall);
|
||||
// this.add(InitBlocks.blockPillarQuartzStair);
|
||||
// this.add(InitBlocks.blockPillarQuartzSlab);
|
||||
//
|
||||
// this.add(InitBlocks.blockColoredLamp);
|
||||
// this.add(InitBlocks.blockColoredLampOn);
|
||||
// this.add(InitBlocks.blockLampPowerer);
|
||||
// this.add(InitBlocks.blockTreasureChest);
|
||||
//
|
||||
// this.add(InitBlocks.blockBlackLotus);
|
||||
//
|
||||
// this.add(InitItems.itemBag);
|
||||
// this.add(InitItems.itemVoidBag);
|
||||
//
|
||||
// this.add(InitItems.itemWorm);
|
||||
// this.add(InitItems.itemPlayerProbe);
|
||||
// this.add(InitItems.itemColorLens);
|
||||
// this.add(InitItems.itemExplosionLens);
|
||||
// this.add(InitItems.itemDamageLens);
|
||||
// this.add(InitItems.itemMoreDamageLens);
|
||||
// this.add(InitItems.itemDisenchantingLens);
|
||||
// this.add(InitItems.itemMiningLens);
|
||||
// this.add(InitItems.itemLaserWrench);
|
||||
// this.add(InitItems.itemLaserUpgradeInvisibility);
|
||||
// this.add(InitItems.itemLaserUpgradeRange);
|
||||
// this.add(InitItems.itemEngineerGoggles);
|
||||
// this.add(InitItems.itemEngineerGogglesAdvanced);
|
||||
// this.add(InitItems.itemCrateKeeper);
|
||||
// this.add(InitItems.itemChestToCrateUpgrade);
|
||||
// this.add(InitItems.itemSmallToMediumCrateUpgrade);
|
||||
// this.add(InitItems.itemMediumToLargeCrateUpgrade);
|
||||
// this.add(InitItems.itemSpawnerChanger);
|
||||
// this.add(InitItems.itemWaterBowl);
|
||||
//
|
||||
// this.add(InitItems.itemDrill);
|
||||
// this.add(InitItems.itemDrillUpgradeSpeed);
|
||||
// this.add(InitItems.itemDrillUpgradeSpeedII);
|
||||
// this.add(InitItems.itemDrillUpgradeSpeedIII);
|
||||
// this.add(InitItems.itemDrillUpgradeSilkTouch);
|
||||
// this.add(InitItems.itemDrillUpgradeFortune);
|
||||
// this.add(InitItems.itemDrillUpgradeFortuneII);
|
||||
// this.add(InitItems.itemDrillUpgradeThreeByThree);
|
||||
// this.add(InitItems.itemDrillUpgradeFiveByFive);
|
||||
// this.add(InitItems.itemDrillUpgradeBlockPlacing);
|
||||
// this.add(InitItems.itemBattery);
|
||||
// this.add(InitItems.itemBatteryDouble);
|
||||
// this.add(InitItems.itemBatteryTriple);
|
||||
// this.add(InitItems.itemBatteryQuadruple);
|
||||
// this.add(InitItems.itemBatteryQuintuple);
|
||||
// this.add(InitItems.itemTeleStaff);
|
||||
// this.add(InitItems.itemFillingWand);
|
||||
//
|
||||
// this.add(InitItems.itemGrowthRing);
|
||||
// this.add(InitItems.itemMagnetRing);
|
||||
// this.add(InitItems.itemWaterRemovalRing);
|
||||
//
|
||||
// this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCanolaOil, Fluid.BUCKET_VOLUME)));
|
||||
// this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidRefinedCanolaOil, Fluid.BUCKET_VOLUME)));
|
||||
// this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, Fluid.BUCKET_VOLUME)));
|
||||
// this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, Fluid.BUCKET_VOLUME)));
|
||||
//
|
||||
// this.add(InitItems.itemPhantomConnector);
|
||||
// this.add(InitItems.itemFilter);
|
||||
// this.add(InitItems.itemWingsOfTheBats);
|
||||
//
|
||||
// this.add(InitItems.itemCoffeeSeed);
|
||||
// this.add(InitItems.itemCoffeeBean);
|
||||
// this.add(InitItems.itemRiceSeed);
|
||||
// this.add(InitItems.itemCanolaSeed);
|
||||
// this.add(InitItems.itemFlaxSeed);
|
||||
// this.add(InitItems.itemHairyBall);
|
||||
// this.add(InitItems.itemMisc);
|
||||
// this.add(InitItems.itemResonantRice);
|
||||
// this.add(InitItems.itemFertilizer);
|
||||
//
|
||||
// this.add(InitItems.itemCoffee);
|
||||
// this.add(InitItems.itemFoods);
|
||||
// this.add(InitItems.itemKnife);
|
||||
// this.add(InitItems.itemCrafterOnAStick);
|
||||
// this.add(InitItems.itemDust);
|
||||
// this.add(InitItems.itemSolidifiedExperience);
|
||||
// this.add(InitItems.itemLeafBlower);
|
||||
// this.add(InitItems.itemLeafBlowerAdvanced);
|
||||
//
|
||||
// this.add(InitItems.woodenPaxel);
|
||||
// this.add(InitItems.stonePaxel);
|
||||
// this.add(InitItems.ironPaxel);
|
||||
// this.add(InitItems.goldPaxel);
|
||||
// this.add(InitItems.diamondPaxel);
|
||||
// this.add(InitItems.emeraldPaxel);
|
||||
// this.add(InitItems.obsidianPaxel);
|
||||
// this.add(InitItems.quartzPaxel);
|
||||
// this.add(InitItems.itemPaxelCrystalRed);
|
||||
// this.add(InitItems.itemPaxelCrystalBlue);
|
||||
// this.add(InitItems.itemPaxelCrystalLightBlue);
|
||||
// this.add(InitItems.itemPaxelCrystalBlack);
|
||||
// this.add(InitItems.itemPaxelCrystalGreen);
|
||||
// this.add(InitItems.itemPaxelCrystalWhite);
|
||||
//
|
||||
// this.add(InitBlocks.blockCrystalClusterRedstone);
|
||||
// this.add(InitBlocks.blockCrystalClusterLapis);
|
||||
// this.add(InitBlocks.blockCrystalClusterDiamond);
|
||||
// this.add(InitBlocks.blockCrystalClusterCoal);
|
||||
// this.add(InitBlocks.blockCrystalClusterEmerald);
|
||||
// this.add(InitBlocks.blockCrystalClusterIron);
|
||||
// this.add(InitBlocks.blockCrystal);
|
||||
// this.add(InitBlocks.blockCrystalEmpowered);
|
||||
// this.add(InitItems.itemCrystal);
|
||||
// this.add(InitItems.itemCrystalEmpowered);
|
||||
// this.add(InitItems.itemCrystalShard);
|
||||
//
|
||||
// this.add(InitItems.itemJams);
|
||||
//
|
||||
// this.add(InitItems.itemPotionRing);
|
||||
// this.add(InitItems.itemPotionRingAdvanced);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeQuartz);
|
||||
// this.add(InitItems.itemSwordQuartz);
|
||||
// this.add(InitItems.itemAxeQuartz);
|
||||
// this.add(InitItems.itemShovelQuartz);
|
||||
// this.add(InitItems.itemHoeQuartz);
|
||||
//
|
||||
// this.add(InitItems.itemHelmQuartz);
|
||||
// this.add(InitItems.itemChestQuartz);
|
||||
// this.add(InitItems.itemPantsQuartz);
|
||||
// this.add(InitItems.itemBootsQuartz);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeEmerald);
|
||||
// this.add(InitItems.itemSwordEmerald);
|
||||
// this.add(InitItems.itemAxeEmerald);
|
||||
// this.add(InitItems.itemShovelEmerald);
|
||||
// this.add(InitItems.itemHoeEmerald);
|
||||
//
|
||||
// this.add(InitItems.itemHelmEmerald);
|
||||
// this.add(InitItems.itemChestEmerald);
|
||||
// this.add(InitItems.itemPantsEmerald);
|
||||
// this.add(InitItems.itemBootsEmerald);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeObsidian);
|
||||
// this.add(InitItems.itemSwordObsidian);
|
||||
// this.add(InitItems.itemAxeObsidian);
|
||||
// this.add(InitItems.itemShovelObsidian);
|
||||
// this.add(InitItems.itemHoeObsidian);
|
||||
//
|
||||
// this.add(InitItems.itemHelmObsidian);
|
||||
// this.add(InitItems.itemChestObsidian);
|
||||
// this.add(InitItems.itemPantsObsidian);
|
||||
// this.add(InitItems.itemBootsObsidian);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeCrystalRed);
|
||||
// this.add(InitItems.itemAxeCrystalRed);
|
||||
// this.add(InitItems.itemShovelCrystalRed);
|
||||
// this.add(InitItems.itemSwordCrystalRed);
|
||||
// this.add(InitItems.itemHoeCrystalRed);
|
||||
// this.add(InitItems.itemHelmCrystalRed);
|
||||
// this.add(InitItems.itemChestCrystalRed);
|
||||
// this.add(InitItems.itemPantsCrystalRed);
|
||||
// this.add(InitItems.itemBootsCrystalRed);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeCrystalBlue);
|
||||
// this.add(InitItems.itemAxeCrystalBlue);
|
||||
// this.add(InitItems.itemShovelCrystalBlue);
|
||||
// this.add(InitItems.itemSwordCrystalBlue);
|
||||
// this.add(InitItems.itemHoeCrystalBlue);
|
||||
// this.add(InitItems.itemHelmCrystalBlue);
|
||||
// this.add(InitItems.itemChestCrystalBlue);
|
||||
// this.add(InitItems.itemPantsCrystalBlue);
|
||||
// this.add(InitItems.itemBootsCrystalBlue);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeCrystalLightBlue);
|
||||
// this.add(InitItems.itemAxeCrystalLightBlue);
|
||||
// this.add(InitItems.itemShovelCrystalLightBlue);
|
||||
// this.add(InitItems.itemSwordCrystalLightBlue);
|
||||
// this.add(InitItems.itemHoeCrystalLightBlue);
|
||||
// this.add(InitItems.itemHelmCrystalLightBlue);
|
||||
// this.add(InitItems.itemChestCrystalLightBlue);
|
||||
// this.add(InitItems.itemPantsCrystalLightBlue);
|
||||
// this.add(InitItems.itemBootsCrystalLightBlue);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeCrystalBlack);
|
||||
// this.add(InitItems.itemAxeCrystalBlack);
|
||||
// this.add(InitItems.itemShovelCrystalBlack);
|
||||
// this.add(InitItems.itemSwordCrystalBlack);
|
||||
// this.add(InitItems.itemHoeCrystalBlack);
|
||||
// this.add(InitItems.itemHelmCrystalBlack);
|
||||
// this.add(InitItems.itemChestCrystalBlack);
|
||||
// this.add(InitItems.itemPantsCrystalBlack);
|
||||
// this.add(InitItems.itemBootsCrystalBlack);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeCrystalGreen);
|
||||
// this.add(InitItems.itemAxeCrystalGreen);
|
||||
// this.add(InitItems.itemShovelCrystalGreen);
|
||||
// this.add(InitItems.itemSwordCrystalGreen);
|
||||
// this.add(InitItems.itemHoeCrystalGreen);
|
||||
// this.add(InitItems.itemHelmCrystalGreen);
|
||||
// this.add(InitItems.itemChestCrystalGreen);
|
||||
// this.add(InitItems.itemPantsCrystalGreen);
|
||||
// this.add(InitItems.itemBootsCrystalGreen);
|
||||
//
|
||||
// this.add(InitItems.itemPickaxeCrystalWhite);
|
||||
// this.add(InitItems.itemAxeCrystalWhite);
|
||||
// this.add(InitItems.itemShovelCrystalWhite);
|
||||
// this.add(InitItems.itemSwordCrystalWhite);
|
||||
// this.add(InitItems.itemHoeCrystalWhite);
|
||||
// this.add(InitItems.itemHelmCrystalWhite);
|
||||
// this.add(InitItems.itemChestCrystalWhite);
|
||||
// this.add(InitItems.itemPantsCrystalWhite);
|
||||
// this.add(InitItems.itemBootsCrystalWhite);
|
||||
// }
|
||||
//
|
||||
// public void add(Item item) {
|
||||
// if (item != null && (!(item instanceof IDisableableItem) || item instanceof IDisableableItem && !((IDisableableItem) item).isDisabled())) {
|
||||
// item.getSubItems(INSTANCE, this.list);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void add(Block block) {
|
||||
// if (block != null) {
|
||||
// block.getSubBlocks(INSTANCE, this.list);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -16,8 +16,9 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -90,8 +91,8 @@ public final class PlayerData {
|
|||
compound.putBoolean("HasBatWings", this.hasBatWings);
|
||||
compound.putInt("BatWingsFlyTime", this.batWingsFlyTime);
|
||||
|
||||
compound.setTag("Bookmarks", this.saveBookmarks());
|
||||
compound.setTag("Trials", this.saveTrials());
|
||||
compound.put("Bookmarks", this.saveBookmarks());
|
||||
compound.put("Trials", this.saveTrials());
|
||||
|
||||
if (!savingToFile) {
|
||||
compound.putBoolean("ShouldDisableWings", this.shouldDisableBatWings);
|
||||
|
@ -101,7 +102,7 @@ public final class PlayerData {
|
|||
public ListNBT saveBookmarks() {
|
||||
ListNBT bookmarks = new ListNBT();
|
||||
for (IBookletPage bookmark : this.bookmarks) {
|
||||
bookmarks.appendTag(new NBTTagString(bookmark == null
|
||||
bookmarks.add(StringNBT.valueOf(bookmark == null
|
||||
? ""
|
||||
: bookmark.getIdentifier()));
|
||||
}
|
||||
|
@ -110,8 +111,8 @@ public final class PlayerData {
|
|||
|
||||
public void loadBookmarks(ListNBT bookmarks) {
|
||||
for (int i = 0; i < bookmarks.size(); i++) {
|
||||
String strg = bookmarks.getStringTagAt(i);
|
||||
if (strg != null && !strg.isEmpty()) {
|
||||
String strg = bookmarks.getString(i);
|
||||
if (!strg.isEmpty()) {
|
||||
IBookletPage page = BookletUtils.getBookletPageById(strg);
|
||||
this.bookmarks[i] = page;
|
||||
} else {
|
||||
|
@ -123,7 +124,7 @@ public final class PlayerData {
|
|||
public ListNBT saveTrials() {
|
||||
ListNBT trials = new ListNBT();
|
||||
for (String trial : this.completedTrials) {
|
||||
trials.appendTag(new NBTTagString(trial));
|
||||
trials.add(StringNBT.valueOf(trial));
|
||||
}
|
||||
return trials;
|
||||
}
|
||||
|
@ -132,8 +133,8 @@ public final class PlayerData {
|
|||
this.completedTrials.clear();
|
||||
|
||||
for (int i = 0; i < trials.size(); i++) {
|
||||
String strg = trials.getStringTagAt(i);
|
||||
if (strg != null && !strg.isEmpty()) {
|
||||
String strg = trials.getString(i);
|
||||
if (!strg.isEmpty()) {
|
||||
this.completedTrials.add(strg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,53 +18,35 @@ import io.netty.util.internal.ConcurrentSet;
|
|||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.world.storage.WorldSavedData;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
// TODO: [port] validate this still works
|
||||
public class WorldData extends WorldSavedData {
|
||||
|
||||
public static final String DATA_TAG = ActuallyAdditions.MODID + "data";
|
||||
public static final String SAVE_NAME = ActuallyAdditions.MODID + "_worldsave";
|
||||
private static WorldData data;
|
||||
public final ConcurrentSet<Network> laserRelayNetworks = new ConcurrentSet<>();
|
||||
public final ConcurrentHashMap<UUID, PlayerSave> playerSaveData = new ConcurrentHashMap<>();
|
||||
|
||||
public WorldData(String name) {
|
||||
super(name);
|
||||
public WorldData() {
|
||||
super(SAVE_NAME);
|
||||
}
|
||||
|
||||
public static WorldData get(World world, boolean forceLoad) {
|
||||
WorldData w = getInternal(world, forceLoad);
|
||||
if (w == null) {
|
||||
ActuallyAdditions.LOGGER.error("An impossible bug has occured.");
|
||||
public static WorldData get(World world) {
|
||||
WorldData storage = ((ServerWorld) world).getSavedData().get(WorldData::new, SAVE_NAME);
|
||||
|
||||
if (storage == null) {
|
||||
storage = new WorldData();
|
||||
storage.markDirty();
|
||||
((ServerWorld) world).getSavedData().set(storage);
|
||||
}
|
||||
return w == null
|
||||
? new WorldData(DATA_TAG)
|
||||
: w;
|
||||
}
|
||||
|
||||
private static WorldData getInternal(World world, boolean forceLoad) {
|
||||
if (forceLoad || data == null) {
|
||||
if (!world.isRemote) {
|
||||
WorldSavedData savedData = world.loadData(WorldData.class, DATA_TAG);
|
||||
|
||||
if (savedData == null) {
|
||||
ActuallyAdditions.LOGGER.info("No WorldData found, creating...");
|
||||
|
||||
WorldData newData = new WorldData(DATA_TAG);
|
||||
world.setData(DATA_TAG, newData);
|
||||
data = newData;
|
||||
} else {
|
||||
data = (WorldData) savedData;
|
||||
ActuallyAdditions.LOGGER.info("Successfully loaded WorldData!");
|
||||
}
|
||||
} else {
|
||||
data = new WorldData(DATA_TAG);
|
||||
ActuallyAdditions.LOGGER.info("Created temporary WorldData to cache data on the client!");
|
||||
}
|
||||
}
|
||||
return data;
|
||||
return storage;
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
|
@ -74,12 +56,8 @@ public class WorldData extends WorldSavedData {
|
|||
}
|
||||
}
|
||||
|
||||
public static WorldData get(World world) {
|
||||
return get(world, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(CompoundNBT compound) {
|
||||
public void read(CompoundNBT compound) {
|
||||
this.laserRelayNetworks.clear();
|
||||
ListNBT networkList = compound.getList("Networks", 10);
|
||||
for (int i = 0; i < networkList.size(); i++) {
|
||||
|
@ -93,7 +71,7 @@ public class WorldData extends WorldSavedData {
|
|||
CompoundNBT player = playerList.getCompound(i);
|
||||
|
||||
UUID id = player.getUniqueId("UUID");
|
||||
CompoundNBT data = player.getCompoundTag("Data");
|
||||
CompoundNBT data = player.getCompound("Data");
|
||||
|
||||
PlayerSave save = new PlayerSave(id);
|
||||
save.readFromNBT(data, true);
|
||||
|
@ -102,27 +80,27 @@ public class WorldData extends WorldSavedData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNBT(CompoundNBT compound) {
|
||||
public CompoundNBT write(CompoundNBT compound) {
|
||||
//Laser World Data
|
||||
ListNBT networkList = new ListNBT();
|
||||
for (Network network : this.laserRelayNetworks) {
|
||||
networkList.appendTag(LaserRelayConnectionHandler.writeNetworkToNBT(network));
|
||||
networkList.add(LaserRelayConnectionHandler.writeNetworkToNBT(network));
|
||||
}
|
||||
compound.setTag("Networks", networkList);
|
||||
compound.put("Networks", networkList);
|
||||
|
||||
//Player Data
|
||||
ListNBT playerList = new ListNBT();
|
||||
for (PlayerSave save : this.playerSaveData.values()) {
|
||||
CompoundNBT player = new CompoundNBT();
|
||||
player.setUniqueId("UUID", save.id);
|
||||
player.putUniqueId("UUID", save.id);
|
||||
|
||||
CompoundNBT data = new CompoundNBT();
|
||||
save.writeToNBT(data, true);
|
||||
player.setTag("Data", data);
|
||||
player.put("Data", data);
|
||||
|
||||
playerList.appendTag(player);
|
||||
playerList.add(player);
|
||||
}
|
||||
compound.setTag("PlayerData", playerList);
|
||||
compound.put("PlayerData", playerList);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
|
|
@ -14,27 +14,18 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
|||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Help;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
@ -48,8 +39,6 @@ import net.minecraftforge.event.TickEvent;
|
|||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ClientEvents {
|
||||
|
||||
|
@ -76,101 +65,103 @@ public class ClientEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onTooltipEvent(ItemTooltipEvent event) {
|
||||
ItemStack stack = event.getItemStack();
|
||||
if (StackUtil.isValid(stack)) {
|
||||
//Be da bland
|
||||
if (ConfigBoolValues.MOST_BLAND_PERSON_EVER.isEnabled()) {
|
||||
ResourceLocation regName = stack.getItem().getRegistryName();
|
||||
if (regName != null) {
|
||||
if (regName.toString().toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
|
||||
if (event.getToolTip().size() > 0) {
|
||||
event.getToolTip().set(0, TextFormatting.RESET + TextFormatting.WHITE.toString() + event.getToolTip().get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: [port] ADD BACK AS NEEDED
|
||||
|
||||
if (ItemWingsOfTheBats.THE_BAT_BAT.equalsIgnoreCase(stack.getDisplayName()) && stack.getItem() instanceof SwordItem) {
|
||||
event.getToolTip().set(0, TextFormatting.GOLD + event.getToolTip().get(0));
|
||||
event.getToolTip().add(1, TextFormatting.RED.toString() + TextFormatting.ITALIC + "That's a really bat pun");
|
||||
}
|
||||
}
|
||||
|
||||
//Advanced Item Info
|
||||
if (event.getFlags().isAdvanced() && StackUtil.isValid(event.getItemStack())) {
|
||||
if (ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()) {
|
||||
if (Screen.hasControlDown()) {
|
||||
event.getToolTip().add(Help.Trans("tooltip.", ".extraInfo.desc").mergeStyle(TextFormatting.DARK_GRAY).mergeStyle(TextFormatting.ITALIC).append(new StringTextComponent(":")));
|
||||
|
||||
// TODO: [port] come back to this and see if we can re-add it
|
||||
//OreDict Names
|
||||
// int[] oreIDs = OreDictionary.getOreIDs(event.getItemStack());
|
||||
// event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".oredictName.desc") + ":");
|
||||
// if (oreIDs.length > 0) {
|
||||
// for (int oreID : oreIDs) {
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + OreDictionary.getOreName(oreID));
|
||||
// }
|
||||
// } else {
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".noOredictNameAvail.desc"));
|
||||
// }
|
||||
|
||||
//Code Name
|
||||
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".codeName.desc") + ":");
|
||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + Item.REGISTRY.getNameForObject(event.getItemStack().getItem()));
|
||||
|
||||
//Base Item's Unlocalized Name
|
||||
String baseName = event.getItemStack().getItem().getTranslationKey();
|
||||
if (baseName != null) {
|
||||
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".baseUnlocName.desc") + ":");
|
||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + baseName);
|
||||
}
|
||||
|
||||
//Metadata
|
||||
int meta = event.getItemStack().getItemDamage();
|
||||
int max = event.getItemStack().getMaxDamage();
|
||||
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".meta.desc") + ":");
|
||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + meta + (max > 0
|
||||
? "/" + max
|
||||
: ""));
|
||||
|
||||
//Unlocalized Name
|
||||
String metaName = event.getItemStack().getItem().getTranslationKey(event.getItemStack());
|
||||
if (metaName != null && baseName != null && !metaName.equals(baseName)) {
|
||||
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".unlocName.desc") + ":");
|
||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + metaName);
|
||||
}
|
||||
|
||||
//NBT
|
||||
CompoundNBT compound = event.getItemStack().getTagCompound();
|
||||
if (compound != null && !compound.isEmpty()) {
|
||||
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".nbt.desc") + ":");
|
||||
if (Screen.hasShiftDown()) {
|
||||
int limit = ConfigIntValues.CTRL_INFO_NBT_CHAR_LIMIT.getValue();
|
||||
String compoundStrg = compound.toString();
|
||||
int compoundStrgLength = compoundStrg.length();
|
||||
|
||||
String compoundDisplay;
|
||||
if (limit > 0 && compoundStrgLength > limit) {
|
||||
compoundDisplay = compoundStrg.substring(0, limit) + TextFormatting.GRAY + " (" + (compoundStrgLength - limit) + " more characters...)";
|
||||
} else {
|
||||
compoundDisplay = compoundStrg;
|
||||
}
|
||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + compoundDisplay);
|
||||
} else {
|
||||
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + TextFormatting.ITALIC + "[" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".pressShift.desc") + "]");
|
||||
}
|
||||
}
|
||||
|
||||
//Disabling Info
|
||||
event.getToolTip().add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".disablingInfo.desc"));
|
||||
|
||||
} else {
|
||||
if (ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()) {
|
||||
event.getToolTip().add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".ctrlForMoreInfo.desc"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// ItemStack stack = event.getItemStack();
|
||||
// if (StackUtil.isValid(stack)) {
|
||||
// //Be da bland
|
||||
// if (ConfigBoolValues.MOST_BLAND_PERSON_EVER.isEnabled()) {
|
||||
// ResourceLocation regName = stack.getItem().getRegistryName();
|
||||
// if (regName != null) {
|
||||
// if (regName.toString().toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
|
||||
// if (event.getToolTip().size() > 0) {
|
||||
// event.getToolTip().set(0, TextFormatting.RESET + TextFormatting.WHITE.toString() + event.getToolTip().get(0));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (ItemWingsOfTheBats.THE_BAT_BAT.equalsIgnoreCase(stack.getDisplayName()) && stack.getItem() instanceof SwordItem) {
|
||||
// event.getToolTip().set(0, TextFormatting.GOLD + event.getToolTip().get(0));
|
||||
// event.getToolTip().add(1, TextFormatting.RED.toString() + TextFormatting.ITALIC + "That's a really bat pun");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Advanced Item Info
|
||||
// if (event.getFlags().isAdvanced() && StackUtil.isValid(event.getItemStack())) {
|
||||
// if (ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()) {
|
||||
// if (Screen.hasControlDown()) {
|
||||
// event.getToolTip().add(Help.Trans("tooltip.", ".extraInfo.desc").mergeStyle(TextFormatting.DARK_GRAY).mergeStyle(TextFormatting.ITALIC).append(new StringTextComponent(":")));
|
||||
//
|
||||
// // TODO: [port] come back to this and see if we can re-add it
|
||||
// //OreDict Names
|
||||
// // int[] oreIDs = OreDictionary.getOreIDs(event.getItemStack());
|
||||
// // event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".oredictName.desc") + ":");
|
||||
// // if (oreIDs.length > 0) {
|
||||
// // for (int oreID : oreIDs) {
|
||||
// // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + OreDictionary.getOreName(oreID));
|
||||
// // }
|
||||
// // } else {
|
||||
// // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".noOredictNameAvail.desc"));
|
||||
// // }
|
||||
//
|
||||
// //Code Name
|
||||
// event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".codeName.desc") + ":");
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + Item.REGISTRY.getNameForObject(event.getItemStack().getItem()));
|
||||
//
|
||||
// //Base Item's Unlocalized Name
|
||||
// String baseName = event.getItemStack().getItem().getTranslationKey();
|
||||
// if (baseName != null) {
|
||||
// event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".baseUnlocName.desc") + ":");
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + baseName);
|
||||
// }
|
||||
//
|
||||
// //Metadata
|
||||
// int meta = event.getItemStack().getItemDamage();
|
||||
// int max = event.getItemStack().getMaxDamage();
|
||||
// event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".meta.desc") + ":");
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + meta + (max > 0
|
||||
// ? "/" + max
|
||||
// : ""));
|
||||
//
|
||||
// //Unlocalized Name
|
||||
// String metaName = event.getItemStack().getItem().getTranslationKey(event.getItemStack());
|
||||
// if (metaName != null && baseName != null && !metaName.equals(baseName)) {
|
||||
// event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".unlocName.desc") + ":");
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + metaName);
|
||||
// }
|
||||
//
|
||||
// //NBT
|
||||
// CompoundNBT compound = event.getItemStack().getTagCompound();
|
||||
// if (compound != null && !compound.isEmpty()) {
|
||||
// event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".nbt.desc") + ":");
|
||||
// if (Screen.hasShiftDown()) {
|
||||
// int limit = ConfigIntValues.CTRL_INFO_NBT_CHAR_LIMIT.getValue();
|
||||
// String compoundStrg = compound.toString();
|
||||
// int compoundStrgLength = compoundStrg.length();
|
||||
//
|
||||
// String compoundDisplay;
|
||||
// if (limit > 0 && compoundStrgLength > limit) {
|
||||
// compoundDisplay = compoundStrg.substring(0, limit) + TextFormatting.GRAY + " (" + (compoundStrgLength - limit) + " more characters...)";
|
||||
// } else {
|
||||
// compoundDisplay = compoundStrg;
|
||||
// }
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + compoundDisplay);
|
||||
// } else {
|
||||
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + TextFormatting.ITALIC + "[" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".pressShift.desc") + "]");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Disabling Info
|
||||
// event.getToolTip().add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".disablingInfo.desc"));
|
||||
//
|
||||
// } else {
|
||||
// if (ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()) {
|
||||
// event.getToolTip().add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".ctrlForMoreInfo.desc"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -18,34 +18,35 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag;
|
|||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemBag;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemDrill;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.monster.SpiderEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class CommonEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBlockBreakEvent(BlockEvent.HarvestDropsEvent event) {
|
||||
public void onBlockBreakEvent(BlockEvent.BreakEvent event) {
|
||||
BlockState state = event.getState();
|
||||
if (state != null && state.getBlock() == Blocks.MOB_SPAWNER) {
|
||||
event.getDrops().add(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal()));
|
||||
if (state != null && state.getBlock() == Blocks.SPAWNER) {
|
||||
// TODO: [port] add back once we've unflattened
|
||||
// event.getDrops().add(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,17 +56,17 @@ public class CommonEvents {
|
|||
return;
|
||||
}
|
||||
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
EntityItem item = event.getItem();
|
||||
if (item != null && !item.isDead) {
|
||||
PlayerEntity player = event.getPlayer();
|
||||
ItemEntity item = event.getItem();
|
||||
if (item != null && item.isAlive()) {
|
||||
ItemStack stack = item.getItem();
|
||||
if (StackUtil.isValid(stack)) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (i != player.inventory.currentItem) {
|
||||
|
||||
ItemStack invStack = player.inventory.getStackInSlot(i);
|
||||
if (StackUtil.isValid(invStack) && invStack.getItem() instanceof ItemBag && invStack.hasTagCompound()) {
|
||||
if (invStack.getTagCompound().getBoolean("AutoInsert")) {
|
||||
if (StackUtil.isValid(invStack) && invStack.getItem() instanceof ItemBag && invStack.hasTag()) {
|
||||
if (invStack.getOrCreateTag().getBoolean("AutoInsert")) {
|
||||
boolean changed = false;
|
||||
|
||||
boolean isVoid = ((ItemBag) invStack.getItem()).isVoid;
|
||||
|
@ -73,7 +74,7 @@ public class CommonEvents {
|
|||
ItemDrill.loadSlotsFromNBT(inv, invStack);
|
||||
|
||||
FilterSettings filter = new FilterSettings(4, false, false, false, false, 0, 0);
|
||||
filter.readFromNBT(invStack.getTagCompound(), "Filter");
|
||||
filter.readFromNBT(invStack.getOrCreateTag(), "Filter");
|
||||
if (filter.check(stack)) {
|
||||
if (isVoid) {
|
||||
stack.setCount(0);
|
||||
|
@ -140,9 +141,9 @@ public class CommonEvents {
|
|||
public void onEntityDropEvent(LivingDropsEvent event) {
|
||||
if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof PlayerEntity) {
|
||||
//Drop Cobwebs from Spiders
|
||||
if (ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof EntitySpider) {
|
||||
if (ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof SpiderEntity) {
|
||||
if (event.getEntityLiving().world.rand.nextInt(20) <= event.getLootingLevel() * 2) {
|
||||
event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(Blocks.WEB, event.getEntityLiving().world.rand.nextInt(2 + event.getLootingLevel()) + 1)));
|
||||
event.getDrops().add(new ItemEntity(event.getEntityLiving().world, event.getEntityLiving().getPosX(), event.getEntityLiving().getPosY(), event.getEntityLiving().getPosZ(), new ItemStack(Blocks.COBWEB, event.getEntityLiving().world.rand.nextInt(2 + event.getLootingLevel()) + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,8 +151,8 @@ public class CommonEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onLogInEvent(PlayerEvent.PlayerLoggedInEvent event) {
|
||||
if (!event.player.world.isRemote && event.player instanceof ServerPlayerEntity) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) event.player;
|
||||
if (!event.getPlayer().world.isRemote && event.getPlayer() instanceof ServerPlayerEntity) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer();
|
||||
PacketHandlerHelper.syncPlayerData(player, true);
|
||||
ActuallyAdditions.LOGGER.info("Sending Player Data to player " + player.getName() + " with UUID " + player.getUniqueID() + ".");
|
||||
}
|
||||
|
@ -162,18 +163,18 @@ public class CommonEvents {
|
|||
//checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
|
||||
|
||||
if (ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()) {
|
||||
if (!event.player.world.isRemote && StackUtil.isValid(event.crafting) && event.crafting.getItem() != InitItems.itemBooklet) {
|
||||
if (!event.getPlayer().world.isRemote && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != InitItems.itemBooklet) {
|
||||
|
||||
String name = event.crafting.getItem().getRegistryName().toString();
|
||||
String name = event.getCrafting().getItem().getRegistryName().toString();
|
||||
if (name != null && name.toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
|
||||
PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(event.player);
|
||||
PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(event.getPlayer());
|
||||
if (save != null && !save.bookGottenAlready) {
|
||||
save.bookGottenAlready = true;
|
||||
WorldData.get(event.player.getEntityWorld()).markDirty();
|
||||
WorldData.get(event.getPlayer().getEntityWorld()).markDirty();
|
||||
|
||||
EntityItem entityItem = new EntityItem(event.player.world, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(InitItems.itemBooklet));
|
||||
ItemEntity entityItem = new ItemEntity(event.getPlayer().world, event.getPlayer().getPosX(), event.getPlayer().getPosY(), event.getPlayer().getPosZ(), new ItemStack(InitItems.itemBooklet));
|
||||
entityItem.setPickupDelay(0);
|
||||
event.player.world.spawnEntity(entityItem);
|
||||
event.getPlayer().world.addEntity(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue