chore: minor porting and removing files

This commit is contained in:
Michael Hillcox 2021-02-27 16:35:21 +00:00
parent 32f7a3915f
commit 7cd34c5360
6 changed files with 561 additions and 588 deletions

View file

@ -1,40 +1,41 @@
/* // 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 // * This file ("GuiFactory.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.config; //
//package de.ellpeck.actuallyadditions.mod.config;
import java.util.Set; //
//import java.util.Set;
import net.minecraft.client.Minecraft; //
import net.minecraft.client.gui.GuiScreen; //import net.minecraft.client.Minecraft;
import net.minecraftforge.fml.client.IModGuiFactory; //import net.minecraft.client.gui.GuiScreen;
//import net.minecraftforge.fml.client.IModGuiFactory;
public class GuiFactory implements IModGuiFactory { //
//public class GuiFactory implements IModGuiFactory {
@Override //
public void initialize(Minecraft minecraftInstance) { // @Override
// public void initialize(Minecraft minecraftInstance) {
} //
// }
@Override //
public boolean hasConfigGui() { // @Override
return true; // public boolean hasConfigGui() {
} // return true;
// }
@Override //
public GuiScreen createConfigGui(GuiScreen parentScreen) { // @Override
return new GuiConfiguration(parentScreen); // public GuiScreen createConfigGui(GuiScreen parentScreen) {
} // return new GuiConfiguration(parentScreen);
// }
@Override //
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { // @Override
return null; // public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
} // return null;
} // }
//}

View file

@ -1,363 +1,364 @@
/* // 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 // * This file ("CreativeTab.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.creative; //
//package de.ellpeck.actuallyadditions.mod.creative;
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; //
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; //import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.items.InitItems; //import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import net.minecraft.block.Block; //import de.ellpeck.actuallyadditions.mod.items.InitItems;
import net.minecraft.creativetab.CreativeTabs; //import net.minecraft.block.Block;
import net.minecraft.item.Item; //import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack; //import net.minecraft.item.Item;
import net.minecraft.util.NonNullList; //import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid; //import net.minecraft.util.NonNullList;
import net.minecraftforge.fluids.FluidStack; //import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidUtil; //import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side; //import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fml.relauncher.OnlyIn; //import net.minecraftforge.fml.relauncher.Side;
//import net.minecraftforge.fml.relauncher.OnlyIn;
public class CreativeTab extends CreativeTabs { //
//public class CreativeTab extends CreativeTabs {
public static final CreativeTab INSTANCE = new CreativeTab(); //
private NonNullList<ItemStack> list; // public static final CreativeTab INSTANCE = new CreativeTab();
// private NonNullList<ItemStack> list;
public CreativeTab() { //
super(ActuallyAdditions.MODID); // public CreativeTab() {
this.setBackgroundImageName(ActuallyAdditions.MODID + ".png"); // super(ActuallyAdditions.MODID);
} // this.setBackgroundImageName(ActuallyAdditions.MODID + ".png");
// }
@Override //
public boolean hasSearchBar() { // @Override
return true; // public boolean hasSearchBar() {
} // return true;
// }
@Override //
public int getSearchbarWidth() { // @Override
return 70; // public int getSearchbarWidth() {
} // return 70;
// }
@Override //
public ItemStack createIcon() { // @Override
return new ItemStack(InitItems.itemBooklet); // public ItemStack createIcon() {
} // return new ItemStack(InitItems.itemBooklet);
// }
@Override //
@OnlyIn(Dist.CLIENT) // @Override
public void displayAllRelevantItems(NonNullList<ItemStack> list) { // @OnlyIn(Dist.CLIENT)
this.list = list; // public void displayAllRelevantItems(NonNullList<ItemStack> list) {
// this.list = list;
this.add(InitItems.itemBooklet); //
this.add(InitBlocks.blockSmileyCloud); // this.add(InitItems.itemBooklet);
this.add(InitBlocks.blockTinyTorch); // this.add(InitBlocks.blockSmileyCloud);
// this.add(InitBlocks.blockTinyTorch);
this.add(InitBlocks.blockFireworkBox); //
this.add(InitBlocks.blockLaserRelay); // this.add(InitBlocks.blockFireworkBox);
this.add(InitBlocks.blockLaserRelayAdvanced); // this.add(InitBlocks.blockLaserRelay);
this.add(InitBlocks.blockLaserRelayExtreme); // this.add(InitBlocks.blockLaserRelayAdvanced);
this.add(InitBlocks.blockLaserRelayFluids); // this.add(InitBlocks.blockLaserRelayExtreme);
this.add(InitBlocks.blockLaserRelayItem); // this.add(InitBlocks.blockLaserRelayFluids);
this.add(InitBlocks.blockLaserRelayItemWhitelist); // this.add(InitBlocks.blockLaserRelayItem);
this.add(InitBlocks.blockItemViewer); // this.add(InitBlocks.blockLaserRelayItemWhitelist);
this.add(InitBlocks.blockItemViewerHopping); // this.add(InitBlocks.blockItemViewer);
this.add(InitBlocks.blockAtomicReconstructor); // this.add(InitBlocks.blockItemViewerHopping);
this.add(InitBlocks.blockEmpowerer); // this.add(InitBlocks.blockAtomicReconstructor);
this.add(InitBlocks.blockPhantomface); // this.add(InitBlocks.blockEmpowerer);
this.add(InitBlocks.blockPhantomEnergyface); // this.add(InitBlocks.blockPhantomface);
this.add(InitBlocks.blockPhantomLiquiface); // this.add(InitBlocks.blockPhantomEnergyface);
this.add(InitBlocks.blockPhantomRedstoneface); // this.add(InitBlocks.blockPhantomLiquiface);
this.add(InitBlocks.blockPhantomPlacer); // this.add(InitBlocks.blockPhantomRedstoneface);
this.add(InitBlocks.blockPhantomBreaker); // this.add(InitBlocks.blockPhantomPlacer);
this.add(InitBlocks.blockPlayerInterface); // this.add(InitBlocks.blockPhantomBreaker);
this.add(InitBlocks.blockInputter); // this.add(InitBlocks.blockPlayerInterface);
this.add(InitBlocks.blockInputterAdvanced); // this.add(InitBlocks.blockInputter);
this.add(InitBlocks.blockPhantomBooster); // this.add(InitBlocks.blockInputterAdvanced);
this.add(InitBlocks.blockCoffeeMachine); // this.add(InitBlocks.blockPhantomBooster);
this.add(InitBlocks.blockXPSolidifier); // this.add(InitBlocks.blockCoffeeMachine);
this.add(InitBlocks.blockDisplayStand); // this.add(InitBlocks.blockXPSolidifier);
// this.add(InitBlocks.blockDisplayStand);
this.add(InitBlocks.blockFarmer); //
this.add(InitBlocks.blockShockSuppressor); // this.add(InitBlocks.blockFarmer);
this.add(InitBlocks.blockMiner); // this.add(InitBlocks.blockShockSuppressor);
this.add(InitBlocks.blockGreenhouseGlass); // this.add(InitBlocks.blockMiner);
this.add(InitBlocks.blockGrinder); // this.add(InitBlocks.blockGreenhouseGlass);
this.add(InitBlocks.blockGrinderDouble); // this.add(InitBlocks.blockGrinder);
this.add(InitBlocks.blockFurnaceDouble); // this.add(InitBlocks.blockGrinderDouble);
this.add(InitBlocks.blockLavaFactoryController); // this.add(InitBlocks.blockFurnaceDouble);
// this.add(InitBlocks.blockLavaFactoryController);
this.add(InitBlocks.blockEnergizer); //
this.add(InitBlocks.blockEnervator); // this.add(InitBlocks.blockEnergizer);
// this.add(InitBlocks.blockEnervator);
this.add(InitBlocks.blockFurnaceSolar); //
this.add(InitBlocks.blockHeatCollector); // this.add(InitBlocks.blockFurnaceSolar);
this.add(InitBlocks.blockCoalGenerator); // this.add(InitBlocks.blockHeatCollector);
this.add(InitBlocks.blockOilGenerator); // this.add(InitBlocks.blockCoalGenerator);
this.add(InitBlocks.blockLeafGenerator); // this.add(InitBlocks.blockOilGenerator);
this.add(InitBlocks.blockBioReactor); // this.add(InitBlocks.blockLeafGenerator);
// this.add(InitBlocks.blockBioReactor);
this.add(InitBlocks.blockItemRepairer); //
this.add(InitBlocks.blockFishingNet); // this.add(InitBlocks.blockItemRepairer);
this.add(InitBlocks.blockBreaker); // this.add(InitBlocks.blockFishingNet);
this.add(InitBlocks.blockDirectionalBreaker); // this.add(InitBlocks.blockBreaker);
this.add(InitBlocks.blockRangedCollector); // this.add(InitBlocks.blockDirectionalBreaker);
this.add(InitBlocks.blockPlacer); // this.add(InitBlocks.blockRangedCollector);
this.add(InitBlocks.blockDropper); // this.add(InitBlocks.blockPlacer);
this.add(InitBlocks.blockFluidPlacer); // this.add(InitBlocks.blockDropper);
this.add(InitBlocks.blockFluidCollector); // this.add(InitBlocks.blockFluidPlacer);
this.add(InitBlocks.blockBatteryBox); // this.add(InitBlocks.blockFluidCollector);
// this.add(InitBlocks.blockBatteryBox);
this.add(InitBlocks.blockMisc); //
this.add(InitBlocks.blockFeeder); // this.add(InitBlocks.blockMisc);
this.add(InitBlocks.blockCompost); // this.add(InitBlocks.blockFeeder);
this.add(InitBlocks.blockGiantChest); // this.add(InitBlocks.blockCompost);
this.add(InitBlocks.blockGiantChestMedium); // this.add(InitBlocks.blockGiantChest);
this.add(InitBlocks.blockGiantChestLarge); // this.add(InitBlocks.blockGiantChestMedium);
this.add(InitBlocks.blockCanolaPress); // this.add(InitBlocks.blockGiantChestLarge);
this.add(InitBlocks.blockFermentingBarrel); // this.add(InitBlocks.blockCanolaPress);
// this.add(InitBlocks.blockFermentingBarrel);
this.add(InitBlocks.blockTestifiBucksGreenWall); //
this.add(InitBlocks.blockTestifiBucksWhiteWall); // this.add(InitBlocks.blockTestifiBucksGreenWall);
this.add(InitBlocks.blockTestifiBucksGreenStairs); // this.add(InitBlocks.blockTestifiBucksWhiteWall);
this.add(InitBlocks.blockTestifiBucksWhiteStairs); // this.add(InitBlocks.blockTestifiBucksGreenStairs);
this.add(InitBlocks.blockTestifiBucksGreenSlab); // this.add(InitBlocks.blockTestifiBucksWhiteStairs);
this.add(InitBlocks.blockTestifiBucksWhiteSlab); // this.add(InitBlocks.blockTestifiBucksGreenSlab);
this.add(InitBlocks.blockTestifiBucksGreenFence); // this.add(InitBlocks.blockTestifiBucksWhiteSlab);
this.add(InitBlocks.blockTestifiBucksWhiteFence); // this.add(InitBlocks.blockTestifiBucksGreenFence);
// this.add(InitBlocks.blockTestifiBucksWhiteFence);
this.add(InitBlocks.blockQuartzWall); //
this.add(InitBlocks.blockQuartzStair); // this.add(InitBlocks.blockQuartzWall);
this.add(InitBlocks.blockQuartzSlab); // this.add(InitBlocks.blockQuartzStair);
this.add(InitBlocks.blockChiseledQuartzWall); // this.add(InitBlocks.blockQuartzSlab);
this.add(InitBlocks.blockChiseledQuartzStair); // this.add(InitBlocks.blockChiseledQuartzWall);
this.add(InitBlocks.blockChiseledQuartzSlab); // this.add(InitBlocks.blockChiseledQuartzStair);
this.add(InitBlocks.blockPillarQuartzWall); // this.add(InitBlocks.blockChiseledQuartzSlab);
this.add(InitBlocks.blockPillarQuartzStair); // this.add(InitBlocks.blockPillarQuartzWall);
this.add(InitBlocks.blockPillarQuartzSlab); // this.add(InitBlocks.blockPillarQuartzStair);
// this.add(InitBlocks.blockPillarQuartzSlab);
this.add(InitBlocks.blockColoredLamp); //
this.add(InitBlocks.blockColoredLampOn); // this.add(InitBlocks.blockColoredLamp);
this.add(InitBlocks.blockLampPowerer); // this.add(InitBlocks.blockColoredLampOn);
this.add(InitBlocks.blockTreasureChest); // this.add(InitBlocks.blockLampPowerer);
// this.add(InitBlocks.blockTreasureChest);
this.add(InitBlocks.blockBlackLotus); //
// this.add(InitBlocks.blockBlackLotus);
this.add(InitItems.itemBag); //
this.add(InitItems.itemVoidBag); // this.add(InitItems.itemBag);
// this.add(InitItems.itemVoidBag);
this.add(InitItems.itemWorm); //
this.add(InitItems.itemPlayerProbe); // this.add(InitItems.itemWorm);
this.add(InitItems.itemColorLens); // this.add(InitItems.itemPlayerProbe);
this.add(InitItems.itemExplosionLens); // this.add(InitItems.itemColorLens);
this.add(InitItems.itemDamageLens); // this.add(InitItems.itemExplosionLens);
this.add(InitItems.itemMoreDamageLens); // this.add(InitItems.itemDamageLens);
this.add(InitItems.itemDisenchantingLens); // this.add(InitItems.itemMoreDamageLens);
this.add(InitItems.itemMiningLens); // this.add(InitItems.itemDisenchantingLens);
this.add(InitItems.itemLaserWrench); // this.add(InitItems.itemMiningLens);
this.add(InitItems.itemLaserUpgradeInvisibility); // this.add(InitItems.itemLaserWrench);
this.add(InitItems.itemLaserUpgradeRange); // this.add(InitItems.itemLaserUpgradeInvisibility);
this.add(InitItems.itemEngineerGoggles); // this.add(InitItems.itemLaserUpgradeRange);
this.add(InitItems.itemEngineerGogglesAdvanced); // this.add(InitItems.itemEngineerGoggles);
this.add(InitItems.itemCrateKeeper); // this.add(InitItems.itemEngineerGogglesAdvanced);
this.add(InitItems.itemChestToCrateUpgrade); // this.add(InitItems.itemCrateKeeper);
this.add(InitItems.itemSmallToMediumCrateUpgrade); // this.add(InitItems.itemChestToCrateUpgrade);
this.add(InitItems.itemMediumToLargeCrateUpgrade); // this.add(InitItems.itemSmallToMediumCrateUpgrade);
this.add(InitItems.itemSpawnerChanger); // this.add(InitItems.itemMediumToLargeCrateUpgrade);
this.add(InitItems.itemWaterBowl); // this.add(InitItems.itemSpawnerChanger);
// this.add(InitItems.itemWaterBowl);
this.add(InitItems.itemDrill); //
this.add(InitItems.itemDrillUpgradeSpeed); // this.add(InitItems.itemDrill);
this.add(InitItems.itemDrillUpgradeSpeedII); // this.add(InitItems.itemDrillUpgradeSpeed);
this.add(InitItems.itemDrillUpgradeSpeedIII); // this.add(InitItems.itemDrillUpgradeSpeedII);
this.add(InitItems.itemDrillUpgradeSilkTouch); // this.add(InitItems.itemDrillUpgradeSpeedIII);
this.add(InitItems.itemDrillUpgradeFortune); // this.add(InitItems.itemDrillUpgradeSilkTouch);
this.add(InitItems.itemDrillUpgradeFortuneII); // this.add(InitItems.itemDrillUpgradeFortune);
this.add(InitItems.itemDrillUpgradeThreeByThree); // this.add(InitItems.itemDrillUpgradeFortuneII);
this.add(InitItems.itemDrillUpgradeFiveByFive); // this.add(InitItems.itemDrillUpgradeThreeByThree);
this.add(InitItems.itemDrillUpgradeBlockPlacing); // this.add(InitItems.itemDrillUpgradeFiveByFive);
this.add(InitItems.itemBattery); // this.add(InitItems.itemDrillUpgradeBlockPlacing);
this.add(InitItems.itemBatteryDouble); // this.add(InitItems.itemBattery);
this.add(InitItems.itemBatteryTriple); // this.add(InitItems.itemBatteryDouble);
this.add(InitItems.itemBatteryQuadruple); // this.add(InitItems.itemBatteryTriple);
this.add(InitItems.itemBatteryQuintuple); // this.add(InitItems.itemBatteryQuadruple);
this.add(InitItems.itemTeleStaff); // this.add(InitItems.itemBatteryQuintuple);
this.add(InitItems.itemFillingWand); // this.add(InitItems.itemTeleStaff);
// this.add(InitItems.itemFillingWand);
this.add(InitItems.itemGrowthRing); //
this.add(InitItems.itemMagnetRing); // this.add(InitItems.itemGrowthRing);
this.add(InitItems.itemWaterRemovalRing); // 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.fluidCanolaOil, Fluid.BUCKET_VOLUME)));
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, Fluid.BUCKET_VOLUME))); // this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidRefinedCanolaOil, Fluid.BUCKET_VOLUME)));
this.list.add(FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, 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.itemPhantomConnector);
this.add(InitItems.itemWingsOfTheBats); // this.add(InitItems.itemFilter);
// this.add(InitItems.itemWingsOfTheBats);
this.add(InitItems.itemCoffeeSeed); //
this.add(InitItems.itemCoffeeBean); // this.add(InitItems.itemCoffeeSeed);
this.add(InitItems.itemRiceSeed); // this.add(InitItems.itemCoffeeBean);
this.add(InitItems.itemCanolaSeed); // this.add(InitItems.itemRiceSeed);
this.add(InitItems.itemFlaxSeed); // this.add(InitItems.itemCanolaSeed);
this.add(InitItems.itemHairyBall); // this.add(InitItems.itemFlaxSeed);
this.add(InitItems.itemMisc); // this.add(InitItems.itemHairyBall);
this.add(InitItems.itemResonantRice); // this.add(InitItems.itemMisc);
this.add(InitItems.itemFertilizer); // this.add(InitItems.itemResonantRice);
// this.add(InitItems.itemFertilizer);
this.add(InitItems.itemCoffee); //
this.add(InitItems.itemFoods); // this.add(InitItems.itemCoffee);
this.add(InitItems.itemKnife); // this.add(InitItems.itemFoods);
this.add(InitItems.itemCrafterOnAStick); // this.add(InitItems.itemKnife);
this.add(InitItems.itemDust); // this.add(InitItems.itemCrafterOnAStick);
this.add(InitItems.itemSolidifiedExperience); // this.add(InitItems.itemDust);
this.add(InitItems.itemLeafBlower); // this.add(InitItems.itemSolidifiedExperience);
this.add(InitItems.itemLeafBlowerAdvanced); // this.add(InitItems.itemLeafBlower);
// this.add(InitItems.itemLeafBlowerAdvanced);
this.add(InitItems.woodenPaxel); //
this.add(InitItems.stonePaxel); // this.add(InitItems.woodenPaxel);
this.add(InitItems.ironPaxel); // this.add(InitItems.stonePaxel);
this.add(InitItems.goldPaxel); // this.add(InitItems.ironPaxel);
this.add(InitItems.diamondPaxel); // this.add(InitItems.goldPaxel);
this.add(InitItems.emeraldPaxel); // this.add(InitItems.diamondPaxel);
this.add(InitItems.obsidianPaxel); // this.add(InitItems.emeraldPaxel);
this.add(InitItems.quartzPaxel); // this.add(InitItems.obsidianPaxel);
this.add(InitItems.itemPaxelCrystalRed); // this.add(InitItems.quartzPaxel);
this.add(InitItems.itemPaxelCrystalBlue); // this.add(InitItems.itemPaxelCrystalRed);
this.add(InitItems.itemPaxelCrystalLightBlue); // this.add(InitItems.itemPaxelCrystalBlue);
this.add(InitItems.itemPaxelCrystalBlack); // this.add(InitItems.itemPaxelCrystalLightBlue);
this.add(InitItems.itemPaxelCrystalGreen); // this.add(InitItems.itemPaxelCrystalBlack);
this.add(InitItems.itemPaxelCrystalWhite); // this.add(InitItems.itemPaxelCrystalGreen);
// this.add(InitItems.itemPaxelCrystalWhite);
this.add(InitBlocks.blockCrystalClusterRedstone); //
this.add(InitBlocks.blockCrystalClusterLapis); // this.add(InitBlocks.blockCrystalClusterRedstone);
this.add(InitBlocks.blockCrystalClusterDiamond); // this.add(InitBlocks.blockCrystalClusterLapis);
this.add(InitBlocks.blockCrystalClusterCoal); // this.add(InitBlocks.blockCrystalClusterDiamond);
this.add(InitBlocks.blockCrystalClusterEmerald); // this.add(InitBlocks.blockCrystalClusterCoal);
this.add(InitBlocks.blockCrystalClusterIron); // this.add(InitBlocks.blockCrystalClusterEmerald);
this.add(InitBlocks.blockCrystal); // this.add(InitBlocks.blockCrystalClusterIron);
this.add(InitBlocks.blockCrystalEmpowered); // this.add(InitBlocks.blockCrystal);
this.add(InitItems.itemCrystal); // this.add(InitBlocks.blockCrystalEmpowered);
this.add(InitItems.itemCrystalEmpowered); // this.add(InitItems.itemCrystal);
this.add(InitItems.itemCrystalShard); // this.add(InitItems.itemCrystalEmpowered);
// this.add(InitItems.itemCrystalShard);
this.add(InitItems.itemJams); //
// this.add(InitItems.itemJams);
this.add(InitItems.itemPotionRing); //
this.add(InitItems.itemPotionRingAdvanced); // this.add(InitItems.itemPotionRing);
// this.add(InitItems.itemPotionRingAdvanced);
this.add(InitItems.itemPickaxeQuartz); //
this.add(InitItems.itemSwordQuartz); // this.add(InitItems.itemPickaxeQuartz);
this.add(InitItems.itemAxeQuartz); // this.add(InitItems.itemSwordQuartz);
this.add(InitItems.itemShovelQuartz); // this.add(InitItems.itemAxeQuartz);
this.add(InitItems.itemHoeQuartz); // this.add(InitItems.itemShovelQuartz);
// this.add(InitItems.itemHoeQuartz);
this.add(InitItems.itemHelmQuartz); //
this.add(InitItems.itemChestQuartz); // this.add(InitItems.itemHelmQuartz);
this.add(InitItems.itemPantsQuartz); // this.add(InitItems.itemChestQuartz);
this.add(InitItems.itemBootsQuartz); // this.add(InitItems.itemPantsQuartz);
// this.add(InitItems.itemBootsQuartz);
this.add(InitItems.itemPickaxeEmerald); //
this.add(InitItems.itemSwordEmerald); // this.add(InitItems.itemPickaxeEmerald);
this.add(InitItems.itemAxeEmerald); // this.add(InitItems.itemSwordEmerald);
this.add(InitItems.itemShovelEmerald); // this.add(InitItems.itemAxeEmerald);
this.add(InitItems.itemHoeEmerald); // this.add(InitItems.itemShovelEmerald);
// this.add(InitItems.itemHoeEmerald);
this.add(InitItems.itemHelmEmerald); //
this.add(InitItems.itemChestEmerald); // this.add(InitItems.itemHelmEmerald);
this.add(InitItems.itemPantsEmerald); // this.add(InitItems.itemChestEmerald);
this.add(InitItems.itemBootsEmerald); // this.add(InitItems.itemPantsEmerald);
// this.add(InitItems.itemBootsEmerald);
this.add(InitItems.itemPickaxeObsidian); //
this.add(InitItems.itemSwordObsidian); // this.add(InitItems.itemPickaxeObsidian);
this.add(InitItems.itemAxeObsidian); // this.add(InitItems.itemSwordObsidian);
this.add(InitItems.itemShovelObsidian); // this.add(InitItems.itemAxeObsidian);
this.add(InitItems.itemHoeObsidian); // this.add(InitItems.itemShovelObsidian);
// this.add(InitItems.itemHoeObsidian);
this.add(InitItems.itemHelmObsidian); //
this.add(InitItems.itemChestObsidian); // this.add(InitItems.itemHelmObsidian);
this.add(InitItems.itemPantsObsidian); // this.add(InitItems.itemChestObsidian);
this.add(InitItems.itemBootsObsidian); // this.add(InitItems.itemPantsObsidian);
// this.add(InitItems.itemBootsObsidian);
this.add(InitItems.itemPickaxeCrystalRed); //
this.add(InitItems.itemAxeCrystalRed); // this.add(InitItems.itemPickaxeCrystalRed);
this.add(InitItems.itemShovelCrystalRed); // this.add(InitItems.itemAxeCrystalRed);
this.add(InitItems.itemSwordCrystalRed); // this.add(InitItems.itemShovelCrystalRed);
this.add(InitItems.itemHoeCrystalRed); // this.add(InitItems.itemSwordCrystalRed);
this.add(InitItems.itemHelmCrystalRed); // this.add(InitItems.itemHoeCrystalRed);
this.add(InitItems.itemChestCrystalRed); // this.add(InitItems.itemHelmCrystalRed);
this.add(InitItems.itemPantsCrystalRed); // this.add(InitItems.itemChestCrystalRed);
this.add(InitItems.itemBootsCrystalRed); // this.add(InitItems.itemPantsCrystalRed);
// this.add(InitItems.itemBootsCrystalRed);
this.add(InitItems.itemPickaxeCrystalBlue); //
this.add(InitItems.itemAxeCrystalBlue); // this.add(InitItems.itemPickaxeCrystalBlue);
this.add(InitItems.itemShovelCrystalBlue); // this.add(InitItems.itemAxeCrystalBlue);
this.add(InitItems.itemSwordCrystalBlue); // this.add(InitItems.itemShovelCrystalBlue);
this.add(InitItems.itemHoeCrystalBlue); // this.add(InitItems.itemSwordCrystalBlue);
this.add(InitItems.itemHelmCrystalBlue); // this.add(InitItems.itemHoeCrystalBlue);
this.add(InitItems.itemChestCrystalBlue); // this.add(InitItems.itemHelmCrystalBlue);
this.add(InitItems.itemPantsCrystalBlue); // this.add(InitItems.itemChestCrystalBlue);
this.add(InitItems.itemBootsCrystalBlue); // this.add(InitItems.itemPantsCrystalBlue);
// this.add(InitItems.itemBootsCrystalBlue);
this.add(InitItems.itemPickaxeCrystalLightBlue); //
this.add(InitItems.itemAxeCrystalLightBlue); // this.add(InitItems.itemPickaxeCrystalLightBlue);
this.add(InitItems.itemShovelCrystalLightBlue); // this.add(InitItems.itemAxeCrystalLightBlue);
this.add(InitItems.itemSwordCrystalLightBlue); // this.add(InitItems.itemShovelCrystalLightBlue);
this.add(InitItems.itemHoeCrystalLightBlue); // this.add(InitItems.itemSwordCrystalLightBlue);
this.add(InitItems.itemHelmCrystalLightBlue); // this.add(InitItems.itemHoeCrystalLightBlue);
this.add(InitItems.itemChestCrystalLightBlue); // this.add(InitItems.itemHelmCrystalLightBlue);
this.add(InitItems.itemPantsCrystalLightBlue); // this.add(InitItems.itemChestCrystalLightBlue);
this.add(InitItems.itemBootsCrystalLightBlue); // this.add(InitItems.itemPantsCrystalLightBlue);
// this.add(InitItems.itemBootsCrystalLightBlue);
this.add(InitItems.itemPickaxeCrystalBlack); //
this.add(InitItems.itemAxeCrystalBlack); // this.add(InitItems.itemPickaxeCrystalBlack);
this.add(InitItems.itemShovelCrystalBlack); // this.add(InitItems.itemAxeCrystalBlack);
this.add(InitItems.itemSwordCrystalBlack); // this.add(InitItems.itemShovelCrystalBlack);
this.add(InitItems.itemHoeCrystalBlack); // this.add(InitItems.itemSwordCrystalBlack);
this.add(InitItems.itemHelmCrystalBlack); // this.add(InitItems.itemHoeCrystalBlack);
this.add(InitItems.itemChestCrystalBlack); // this.add(InitItems.itemHelmCrystalBlack);
this.add(InitItems.itemPantsCrystalBlack); // this.add(InitItems.itemChestCrystalBlack);
this.add(InitItems.itemBootsCrystalBlack); // this.add(InitItems.itemPantsCrystalBlack);
// this.add(InitItems.itemBootsCrystalBlack);
this.add(InitItems.itemPickaxeCrystalGreen); //
this.add(InitItems.itemAxeCrystalGreen); // this.add(InitItems.itemPickaxeCrystalGreen);
this.add(InitItems.itemShovelCrystalGreen); // this.add(InitItems.itemAxeCrystalGreen);
this.add(InitItems.itemSwordCrystalGreen); // this.add(InitItems.itemShovelCrystalGreen);
this.add(InitItems.itemHoeCrystalGreen); // this.add(InitItems.itemSwordCrystalGreen);
this.add(InitItems.itemHelmCrystalGreen); // this.add(InitItems.itemHoeCrystalGreen);
this.add(InitItems.itemChestCrystalGreen); // this.add(InitItems.itemHelmCrystalGreen);
this.add(InitItems.itemPantsCrystalGreen); // this.add(InitItems.itemChestCrystalGreen);
this.add(InitItems.itemBootsCrystalGreen); // this.add(InitItems.itemPantsCrystalGreen);
// this.add(InitItems.itemBootsCrystalGreen);
this.add(InitItems.itemPickaxeCrystalWhite); //
this.add(InitItems.itemAxeCrystalWhite); // this.add(InitItems.itemPickaxeCrystalWhite);
this.add(InitItems.itemShovelCrystalWhite); // this.add(InitItems.itemAxeCrystalWhite);
this.add(InitItems.itemSwordCrystalWhite); // this.add(InitItems.itemShovelCrystalWhite);
this.add(InitItems.itemHoeCrystalWhite); // this.add(InitItems.itemSwordCrystalWhite);
this.add(InitItems.itemHelmCrystalWhite); // this.add(InitItems.itemHoeCrystalWhite);
this.add(InitItems.itemChestCrystalWhite); // this.add(InitItems.itemHelmCrystalWhite);
this.add(InitItems.itemPantsCrystalWhite); // this.add(InitItems.itemChestCrystalWhite);
this.add(InitItems.itemBootsCrystalWhite); // 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())) { // public void add(Item item) {
item.getSubItems(INSTANCE, this.list); // 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) { // public void add(Block block) {
block.getSubBlocks(INSTANCE, this.list); // if (block != null) {
} // block.getSubBlocks(INSTANCE, this.list);
} // }
} // }
//}

View file

@ -16,8 +16,9 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.NBTTagString; import net.minecraft.nbt.StringNBT;
import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -90,8 +91,8 @@ public final class PlayerData {
compound.putBoolean("HasBatWings", this.hasBatWings); compound.putBoolean("HasBatWings", this.hasBatWings);
compound.putInt("BatWingsFlyTime", this.batWingsFlyTime); compound.putInt("BatWingsFlyTime", this.batWingsFlyTime);
compound.setTag("Bookmarks", this.saveBookmarks()); compound.put("Bookmarks", this.saveBookmarks());
compound.setTag("Trials", this.saveTrials()); compound.put("Trials", this.saveTrials());
if (!savingToFile) { if (!savingToFile) {
compound.putBoolean("ShouldDisableWings", this.shouldDisableBatWings); compound.putBoolean("ShouldDisableWings", this.shouldDisableBatWings);
@ -101,7 +102,7 @@ public final class PlayerData {
public ListNBT saveBookmarks() { public ListNBT saveBookmarks() {
ListNBT bookmarks = new ListNBT(); ListNBT bookmarks = new ListNBT();
for (IBookletPage bookmark : this.bookmarks) { for (IBookletPage bookmark : this.bookmarks) {
bookmarks.appendTag(new NBTTagString(bookmark == null bookmarks.add(StringNBT.valueOf(bookmark == null
? "" ? ""
: bookmark.getIdentifier())); : bookmark.getIdentifier()));
} }
@ -110,8 +111,8 @@ public final class PlayerData {
public void loadBookmarks(ListNBT bookmarks) { public void loadBookmarks(ListNBT bookmarks) {
for (int i = 0; i < bookmarks.size(); i++) { for (int i = 0; i < bookmarks.size(); i++) {
String strg = bookmarks.getStringTagAt(i); String strg = bookmarks.getString(i);
if (strg != null && !strg.isEmpty()) { if (!strg.isEmpty()) {
IBookletPage page = BookletUtils.getBookletPageById(strg); IBookletPage page = BookletUtils.getBookletPageById(strg);
this.bookmarks[i] = page; this.bookmarks[i] = page;
} else { } else {
@ -123,7 +124,7 @@ public final class PlayerData {
public ListNBT saveTrials() { public ListNBT saveTrials() {
ListNBT trials = new ListNBT(); ListNBT trials = new ListNBT();
for (String trial : this.completedTrials) { for (String trial : this.completedTrials) {
trials.appendTag(new NBTTagString(trial)); trials.add(StringNBT.valueOf(trial));
} }
return trials; return trials;
} }
@ -132,8 +133,8 @@ public final class PlayerData {
this.completedTrials.clear(); this.completedTrials.clear();
for (int i = 0; i < trials.size(); i++) { for (int i = 0; i < trials.size(); i++) {
String strg = trials.getStringTagAt(i); String strg = trials.getString(i);
if (strg != null && !strg.isEmpty()) { if (!strg.isEmpty()) {
this.completedTrials.add(strg); this.completedTrials.add(strg);
} }
} }

View file

@ -18,53 +18,35 @@ import io.netty.util.internal.ConcurrentSet;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.WorldSavedData; import net.minecraft.world.storage.WorldSavedData;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
// TODO: [port] validate this still works
public class WorldData extends WorldSavedData { public class WorldData extends WorldSavedData {
public static final String DATA_TAG = ActuallyAdditions.MODID + "data"; public static final String DATA_TAG = ActuallyAdditions.MODID + "data";
public static final String SAVE_NAME = ActuallyAdditions.MODID + "_worldsave";
private static WorldData data; private static WorldData data;
public final ConcurrentSet<Network> laserRelayNetworks = new ConcurrentSet<>(); public final ConcurrentSet<Network> laserRelayNetworks = new ConcurrentSet<>();
public final ConcurrentHashMap<UUID, PlayerSave> playerSaveData = new ConcurrentHashMap<>(); public final ConcurrentHashMap<UUID, PlayerSave> playerSaveData = new ConcurrentHashMap<>();
public WorldData(String name) { public WorldData() {
super(name); super(SAVE_NAME);
} }
public static WorldData get(World world, boolean forceLoad) { public static WorldData get(World world) {
WorldData w = getInternal(world, forceLoad); WorldData storage = ((ServerWorld) world).getSavedData().get(WorldData::new, SAVE_NAME);
if (w == null) {
ActuallyAdditions.LOGGER.error("An impossible bug has occured."); 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) { return storage;
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;
} }
public static void clear() { public static void clear() {
@ -74,12 +56,8 @@ public class WorldData extends WorldSavedData {
} }
} }
public static WorldData get(World world) {
return get(world, false);
}
@Override @Override
public void readFromNBT(CompoundNBT compound) { public void read(CompoundNBT compound) {
this.laserRelayNetworks.clear(); this.laserRelayNetworks.clear();
ListNBT networkList = compound.getList("Networks", 10); ListNBT networkList = compound.getList("Networks", 10);
for (int i = 0; i < networkList.size(); i++) { for (int i = 0; i < networkList.size(); i++) {
@ -93,7 +71,7 @@ public class WorldData extends WorldSavedData {
CompoundNBT player = playerList.getCompound(i); CompoundNBT player = playerList.getCompound(i);
UUID id = player.getUniqueId("UUID"); UUID id = player.getUniqueId("UUID");
CompoundNBT data = player.getCompoundTag("Data"); CompoundNBT data = player.getCompound("Data");
PlayerSave save = new PlayerSave(id); PlayerSave save = new PlayerSave(id);
save.readFromNBT(data, true); save.readFromNBT(data, true);
@ -102,27 +80,27 @@ public class WorldData extends WorldSavedData {
} }
@Override @Override
public CompoundNBT writeToNBT(CompoundNBT compound) { public CompoundNBT write(CompoundNBT compound) {
//Laser World Data //Laser World Data
ListNBT networkList = new ListNBT(); ListNBT networkList = new ListNBT();
for (Network network : this.laserRelayNetworks) { 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 //Player Data
ListNBT playerList = new ListNBT(); ListNBT playerList = new ListNBT();
for (PlayerSave save : this.playerSaveData.values()) { for (PlayerSave save : this.playerSaveData.values()) {
CompoundNBT player = new CompoundNBT(); CompoundNBT player = new CompoundNBT();
player.setUniqueId("UUID", save.id); player.putUniqueId("UUID", save.id);
CompoundNBT data = new CompoundNBT(); CompoundNBT data = new CompoundNBT();
save.writeToNBT(data, true); 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; return compound;
} }

View file

@ -14,27 +14,18 @@ import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay; import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues; 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.data.WorldData;
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay; 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.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; 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.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent; 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.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.Locale;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class ClientEvents { public class ClientEvents {
@ -76,101 +65,103 @@ public class ClientEvents {
@SubscribeEvent @SubscribeEvent
public void onTooltipEvent(ItemTooltipEvent event) { public void onTooltipEvent(ItemTooltipEvent event) {
ItemStack stack = event.getItemStack(); // TODO: [port] ADD BACK AS NEEDED
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) { // ItemStack stack = event.getItemStack();
event.getToolTip().set(0, TextFormatting.GOLD + event.getToolTip().get(0)); // if (StackUtil.isValid(stack)) {
event.getToolTip().add(1, TextFormatting.RED.toString() + TextFormatting.ITALIC + "That's a really bat pun"); // //Be da bland
} // if (ConfigBoolValues.MOST_BLAND_PERSON_EVER.isEnabled()) {
} // ResourceLocation regName = stack.getItem().getRegistryName();
// if (regName != null) {
//Advanced Item Info // if (regName.toString().toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
if (event.getFlags().isAdvanced() && StackUtil.isValid(event.getItemStack())) { // if (event.getToolTip().size() > 0) {
if (ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()) { // event.getToolTip().set(0, TextFormatting.RESET + TextFormatting.WHITE.toString() + event.getToolTip().get(0));
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()); // if (ItemWingsOfTheBats.THE_BAT_BAT.equalsIgnoreCase(stack.getDisplayName()) && stack.getItem() instanceof SwordItem) {
// event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".oredictName.desc") + ":"); // event.getToolTip().set(0, TextFormatting.GOLD + event.getToolTip().get(0));
// if (oreIDs.length > 0) { // event.getToolTip().add(1, TextFormatting.RED.toString() + TextFormatting.ITALIC + "That's a really bat pun");
// for (int oreID : oreIDs) { // }
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + OreDictionary.getOreName(oreID)); // }
// } //
// } else { // //Advanced Item Info
// event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".noOredictNameAvail.desc")); // if (event.getFlags().isAdvanced() && StackUtil.isValid(event.getItemStack())) {
// } // if (ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()) {
// if (Screen.hasControlDown()) {
//Code Name // event.getToolTip().add(Help.Trans("tooltip.", ".extraInfo.desc").mergeStyle(TextFormatting.DARK_GRAY).mergeStyle(TextFormatting.ITALIC).append(new StringTextComponent(":")));
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())); // // TODO: [port] come back to this and see if we can re-add it
// //OreDict Names
//Base Item's Unlocalized Name // // int[] oreIDs = OreDictionary.getOreIDs(event.getItemStack());
String baseName = event.getItemStack().getItem().getTranslationKey(); // // event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".oredictName.desc") + ":");
if (baseName != null) { // // if (oreIDs.length > 0) {
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".baseUnlocName.desc") + ":"); // // for (int oreID : oreIDs) {
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + baseName); // // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + OreDictionary.getOreName(oreID));
} // // }
// // } else {
//Metadata // // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".noOredictNameAvail.desc"));
int meta = event.getItemStack().getItemDamage(); // // }
int max = event.getItemStack().getMaxDamage(); //
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".meta.desc") + ":"); // //Code Name
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + meta + (max > 0 // event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".codeName.desc") + ":");
? "/" + max // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + Item.REGISTRY.getNameForObject(event.getItemStack().getItem()));
: "")); //
// //Base Item's Unlocalized Name
//Unlocalized Name // String baseName = event.getItemStack().getItem().getTranslationKey();
String metaName = event.getItemStack().getItem().getTranslationKey(event.getItemStack()); // if (baseName != null) {
if (metaName != null && baseName != null && !metaName.equals(baseName)) { // event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".baseUnlocName.desc") + ":");
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".unlocName.desc") + ":"); // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + baseName);
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + metaName); // }
} //
// //Metadata
//NBT // int meta = event.getItemStack().getItemDamage();
CompoundNBT compound = event.getItemStack().getTagCompound(); // int max = event.getItemStack().getMaxDamage();
if (compound != null && !compound.isEmpty()) { // event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".meta.desc") + ":");
event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".nbt.desc") + ":"); // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + meta + (max > 0
if (Screen.hasShiftDown()) { // ? "/" + max
int limit = ConfigIntValues.CTRL_INFO_NBT_CHAR_LIMIT.getValue(); // : ""));
String compoundStrg = compound.toString(); //
int compoundStrgLength = compoundStrg.length(); // //Unlocalized Name
// String metaName = event.getItemStack().getItem().getTranslationKey(event.getItemStack());
String compoundDisplay; // if (metaName != null && baseName != null && !metaName.equals(baseName)) {
if (limit > 0 && compoundStrgLength > limit) { // event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".unlocName.desc") + ":");
compoundDisplay = compoundStrg.substring(0, limit) + TextFormatting.GRAY + " (" + (compoundStrgLength - limit) + " more characters...)"; // event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + metaName);
} else { // }
compoundDisplay = compoundStrg; //
} // //NBT
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + compoundDisplay); // CompoundNBT compound = event.getItemStack().getTagCompound();
} else { // if (compound != null && !compound.isEmpty()) {
event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + TextFormatting.ITALIC + "[" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".pressShift.desc") + "]"); // 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();
//Disabling Info // int compoundStrgLength = compoundStrg.length();
event.getToolTip().add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".disablingInfo.desc")); //
// String compoundDisplay;
} else { // if (limit > 0 && compoundStrgLength > limit) {
if (ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()) { // compoundDisplay = compoundStrg.substring(0, limit) + TextFormatting.GRAY + " (" + (compoundStrgLength - limit) + " more characters...)";
event.getToolTip().add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".ctrlForMoreInfo.desc")); // } 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 @SubscribeEvent

View file

@ -18,34 +18,35 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemBag; import de.ellpeck.actuallyadditions.mod.items.ItemBag;
import de.ellpeck.actuallyadditions.mod.items.ItemDrill; 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.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.item.EntityItem; import net.minecraft.block.BlockState;
import net.minecraft.entity.monster.EntitySpider; 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.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import java.util.Locale; import java.util.Locale;
public class CommonEvents { public class CommonEvents {
@SubscribeEvent @SubscribeEvent
public void onBlockBreakEvent(BlockEvent.HarvestDropsEvent event) { public void onBlockBreakEvent(BlockEvent.BreakEvent event) {
BlockState state = event.getState(); BlockState state = event.getState();
if (state != null && state.getBlock() == Blocks.MOB_SPAWNER) { if (state != null && state.getBlock() == Blocks.SPAWNER) {
event.getDrops().add(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal())); // 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; return;
} }
PlayerEntity player = event.getEntityPlayer(); PlayerEntity player = event.getPlayer();
EntityItem item = event.getItem(); ItemEntity item = event.getItem();
if (item != null && !item.isDead) { if (item != null && item.isAlive()) {
ItemStack stack = item.getItem(); ItemStack stack = item.getItem();
if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
for (int i = 0; i < player.inventory.getSizeInventory(); i++) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
if (i != player.inventory.currentItem) { if (i != player.inventory.currentItem) {
ItemStack invStack = player.inventory.getStackInSlot(i); ItemStack invStack = player.inventory.getStackInSlot(i);
if (StackUtil.isValid(invStack) && invStack.getItem() instanceof ItemBag && invStack.hasTagCompound()) { if (StackUtil.isValid(invStack) && invStack.getItem() instanceof ItemBag && invStack.hasTag()) {
if (invStack.getTagCompound().getBoolean("AutoInsert")) { if (invStack.getOrCreateTag().getBoolean("AutoInsert")) {
boolean changed = false; boolean changed = false;
boolean isVoid = ((ItemBag) invStack.getItem()).isVoid; boolean isVoid = ((ItemBag) invStack.getItem()).isVoid;
@ -73,7 +74,7 @@ public class CommonEvents {
ItemDrill.loadSlotsFromNBT(inv, invStack); ItemDrill.loadSlotsFromNBT(inv, invStack);
FilterSettings filter = new FilterSettings(4, false, false, false, false, 0, 0); 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 (filter.check(stack)) {
if (isVoid) { if (isVoid) {
stack.setCount(0); stack.setCount(0);
@ -140,9 +141,9 @@ public class CommonEvents {
public void onEntityDropEvent(LivingDropsEvent event) { public void onEntityDropEvent(LivingDropsEvent event) {
if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof PlayerEntity) { if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof PlayerEntity) {
//Drop Cobwebs from Spiders //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) { 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 @SubscribeEvent
public void onLogInEvent(PlayerEvent.PlayerLoggedInEvent event) { public void onLogInEvent(PlayerEvent.PlayerLoggedInEvent event) {
if (!event.player.world.isRemote && event.player instanceof ServerPlayerEntity) { if (!event.getPlayer().world.isRemote && event.getPlayer() instanceof ServerPlayerEntity) {
ServerPlayerEntity player = (ServerPlayerEntity) event.player; ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer();
PacketHandlerHelper.syncPlayerData(player, true); PacketHandlerHelper.syncPlayerData(player, true);
ActuallyAdditions.LOGGER.info("Sending Player Data to player " + player.getName() + " with UUID " + player.getUniqueID() + "."); 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); //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.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)) { 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) { if (save != null && !save.bookGottenAlready) {
save.bookGottenAlready = true; 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); entityItem.setPickupDelay(0);
event.player.world.spawnEntity(entityItem); event.getPlayer().world.addEntity(entityItem);
} }
} }
} }