From cb1b37c96eb1d2a892c961f83e34b112c54e3eed Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 22 Sep 2020 03:17:02 +0200 Subject: [PATCH] IT COMPILES I'll test it tomorrow :^) --- build.gradle | 19 ++- .../java/de/ellpeck/naturesaura/Helper.java | 17 +-- .../de/ellpeck/naturesaura/InternalHooks.java | 16 +-- .../de/ellpeck/naturesaura/ModConfig.java | 6 +- .../naturesaura/api/NaturesAuraAPI.java | 12 +- .../api/aura/type/BasicAuraType.java | 17 +-- .../naturesaura/api/misc/IWorldData.java | 4 +- .../naturesaura/api/multiblock/Matcher.java | 5 +- .../naturesaura/blocks/BlockAncientLog.java | 6 +- .../blocks/BlockAncientSapling.java | 6 +- .../naturesaura/blocks/BlockAuraBloom.java | 6 +- .../naturesaura/blocks/BlockAuraTimer.java | 7 +- .../blocks/BlockContainerImpl.java | 17 +-- .../blocks/BlockDecayedLeaves.java | 2 +- .../blocks/BlockDimensionRail.java | 42 ++++--- .../naturesaura/blocks/BlockEndFlower.java | 14 +-- .../naturesaura/blocks/BlockEnderCrate.java | 2 +- .../naturesaura/blocks/BlockFieldCreator.java | 9 +- .../naturesaura/blocks/BlockFlowerPot.java | 6 +- .../blocks/BlockFurnaceHeater.java | 5 - .../naturesaura/blocks/BlockGoldPowder.java | 41 ++++--- .../naturesaura/blocks/BlockGoldenLeaves.java | 10 +- .../naturesaura/blocks/BlockGratedChute.java | 2 +- .../blocks/BlockItemDistributor.java | 2 +- .../naturesaura/blocks/BlockLight.java | 4 +- .../naturesaura/blocks/BlockNetherGrass.java | 2 +- .../blocks/BlockPickupStopper.java | 2 +- .../naturesaura/blocks/BlockSpawnLamp.java | 11 +- .../naturesaura/blocks/multi/Multiblocks.java | 4 +- .../tiles/TileEntityAnimalContainer.java | 8 +- .../blocks/tiles/TileEntityAuraTimer.java | 2 +- .../blocks/tiles/TileEntityFieldCreator.java | 14 +-- .../tiles/TileEntityFireworkGenerator.java | 2 +- .../blocks/tiles/TileEntityImpl.java | 7 +- .../blocks/tiles/TileEntityOakGenerator.java | 4 +- .../blocks/tiles/TileEntityOfferingTable.java | 6 +- .../blocks/tiles/TileEntityPlacer.java | 4 +- .../blocks/tiles/TileEntitySnowCreator.java | 1 - .../blocks/tiles/TileEntityTimeChanger.java | 7 +- .../blocks/tiles/TileEntityWoodStand.java | 6 +- .../blocks/tiles/render/RenderAuraTimer.java | 2 +- .../blocks/tiles/render/RenderEnderCrate.java | 6 +- .../render/RenderGeneratorLimitRemover.java | 4 +- .../tiles/render/RenderNatureAltar.java | 2 +- .../tiles/render/RenderOfferingTable.java | 2 +- .../render/RenderProjectileGenerator.java | 4 +- .../blocks/tiles/render/RenderWoodStand.java | 2 +- .../chunk/effect/AnimalEffect.java | 2 +- .../chunk/effect/BreathlessEffect.java | 2 +- .../chunk/effect/CacheRechargeEffect.java | 2 +- .../chunk/effect/OreSpawnEffect.java | 13 +- .../naturesaura/compat/CuriosCompat.java | 25 ++-- .../EnchantibilityAuraMending.java | 2 +- .../compat/jei/AnimalSpawnerCategory.java | 11 +- .../compat/patchouli/PatchouliCompat.java | 26 ++-- .../compat/patchouli/ProcessorAltar.java | 26 ++-- .../patchouli/ProcessorAnimalSpawner.java | 21 ++-- .../compat/patchouli/ProcessorOffering.java | 19 +-- .../compat/patchouli/ProcessorTreeRitual.java | 21 ++-- .../naturesaura/data/BlockLootProvider.java | 10 +- .../naturesaura/data/BlockStateGenerator.java | 2 +- .../naturesaura/data/BlockTagProvider.java | 16 +-- .../naturesaura/data/ItemModelGenerator.java | 2 +- .../naturesaura/data/ItemTagProvider.java | 13 +- .../de/ellpeck/naturesaura/data/ModData.java | 7 +- .../enchant/AuraMendingEnchantment.java | 2 +- .../entities/EntityEffectInhibitor.java | 16 +-- .../entities/EntityMoverMinecart.java | 10 +- .../entities/EntityStructureFinder.java | 8 +- .../render/RenderEffectInhibitor.java | 5 +- .../entities/render/RenderMoverMinecart.java | 6 +- .../entities/render/RenderStub.java | 4 +- .../naturesaura/events/ClientEvents.java | 113 ++++++++---------- .../naturesaura/events/CommonEvents.java | 2 +- .../ellpeck/naturesaura/gen/ModFeatures.java | 5 +- .../naturesaura/gen/WorldGenAncientTree.java | 53 ++++---- .../naturesaura/gen/WorldGenAuraBloom.java | 7 +- .../gen/WorldGenNetherWartMushroom.java | 10 +- .../naturesaura/gui/GuiEnderCrate.java | 21 ++-- .../naturesaura/items/ItemAuraCache.java | 6 +- .../items/ItemBreakPrevention.java | 11 +- .../naturesaura/items/ItemColorChanger.java | 9 +- .../naturesaura/items/ItemCrimsonMeal.java | 2 +- .../naturesaura/items/ItemEffectPowder.java | 4 +- .../de/ellpeck/naturesaura/items/ItemEye.java | 4 +- .../naturesaura/items/ItemLightStaff.java | 2 +- .../items/ItemMultiblockMaker.java | 5 +- .../items/ItemRangeVisualizer.java | 16 +-- .../items/ItemShockwaveCreator.java | 8 +- .../items/ItemStructureFinder.java | 7 +- .../naturesaura/items/tools/ItemArmor.java | 8 +- .../naturesaura/items/tools/ItemAxe.java | 4 +- .../naturesaura/items/tools/ItemHoe.java | 4 +- .../naturesaura/items/tools/ItemShovel.java | 2 +- .../naturesaura/misc/ColoredBlockHelper.java | 2 +- .../ellpeck/naturesaura/misc/WorldData.java | 4 +- .../naturesaura/packet/PacketClient.java | 5 +- .../naturesaura/packet/PacketHandler.java | 4 +- .../naturesaura/packet/PacketParticles.java | 2 +- .../particles/ParticleHandler.java | 2 +- .../naturesaura/particles/ParticleMagic.java | 11 +- .../recipes/AnimalSpawnerRecipe.java | 4 +- .../naturesaura/recipes/ModRecipes.java | 4 +- .../naturesaura/reg/ModArmorMaterial.java | 5 + .../ellpeck/naturesaura/reg/ModRegistry.java | 27 +++-- .../renderers/PlayerLayerTrinkets.java | 9 +- .../renderers/SupporterFancyHandler.java | 5 +- 107 files changed, 526 insertions(+), 511 deletions(-) diff --git a/build.gradle b/build.gradle index bc5b760e..0112871c 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ if (System.getenv('BUILD_NUMBER') != null) { sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. minecraft { - mappings channel: 'snapshot', version: '20200128-1.15.1' + mappings channel: 'snapshot', version: '20200723-1.16.1' runs { client { @@ -98,19 +98,18 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.15.2-31.1.24' + minecraft 'net.minecraftforge:forge:1.16.3-34.0.9' - compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api") - runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2") + compileOnly fg.deobf("mezz.jei:jei-1.16.2:7.3.2.25:api") + runtimeOnly fg.deobf("mezz.jei:jei-1.16.2:7.3.2.25") - compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.15.2-1.2-32.160:api") - runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.15.2-1.2-32.160") + compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.16.2-44:api") + runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.16.2-44") - runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2") - compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2:api") + runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.3-4.0.2.0") + compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.3-4.0.2.0:api") - compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.15.1:6.0.0.4") - compile fg.deobf("quarris.enchantability:enchantability:8.1.15") + compile fg.deobf("quarris.enchantability:Enchantability:8.5.25") } // Example for how to get properties into the manifest for reading by the runtime.. diff --git a/src/main/java/de/ellpeck/naturesaura/Helper.java b/src/main/java/de/ellpeck/naturesaura/Helper.java index 5c0adab7..cc608981 100644 --- a/src/main/java/de/ellpeck/naturesaura/Helper.java +++ b/src/main/java/de/ellpeck/naturesaura/Helper.java @@ -21,13 +21,14 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.INBT; -import net.minecraft.state.IProperty; +import net.minecraft.state.Property; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.Vec3d; + +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.chunk.AbstractChunkProvider; @@ -45,7 +46,6 @@ import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistryEntry; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.lwjgl.opengl.GL11; -import top.theillusivec4.curios.api.CuriosAPI; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -209,7 +209,7 @@ public final class Helper { if (split.length > 1) { for (String part : split[1].replace("]", "").split(",")) { String[] keyValue = part.split("="); - for (IProperty prop : state.getProperties()) { + for (Property prop : state.getProperties()) { BlockState changed = findProperty(state, prop, keyValue[0], keyValue[1]); if (changed != null) { state = changed; @@ -223,7 +223,7 @@ public final class Helper { return null; } - private static > BlockState findProperty(BlockState state, IProperty prop, String key, String newValue) { + private static > BlockState findProperty(BlockState state, Property prop, String key, String newValue) { if (key.equals(prop.getName())) for (T value : prop.getAllowedValues()) if (prop.getName(value).equals(newValue)) @@ -307,7 +307,7 @@ public final class Helper { return true; } - public static AxisAlignedBB aabb(Vec3d pos) { + public static AxisAlignedBB aabb(Vector3d pos) { return new AxisAlignedBB(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z); } @@ -331,9 +331,10 @@ public final class Helper { public static ItemStack getEquippedItem(Predicate predicate, PlayerEntity player) { if (Compat.hasCompat("curios")) { - Optional stack = CuriosAPI.getCurioEquipped(predicate, player).map(ImmutableTriple::getRight); + // TODO curios + /* Optional stack = CuriosAPI.getCurioEquipped(predicate, player).map(ImmutableTriple::getRight); if (stack.isPresent()) - return stack.get(); + return stack.get();*/ } for (int i = 0; i < player.inventory.getSizeInventory(); i++) { ItemStack slot = player.inventory.getStackInSlot(i); diff --git a/src/main/java/de/ellpeck/naturesaura/InternalHooks.java b/src/main/java/de/ellpeck/naturesaura/InternalHooks.java index 4034ad6a..97c016b2 100644 --- a/src/main/java/de/ellpeck/naturesaura/InternalHooks.java +++ b/src/main/java/de/ellpeck/naturesaura/InternalHooks.java @@ -13,7 +13,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import org.apache.commons.lang3.mutable.MutableFloat; import org.apache.commons.lang3.mutable.MutableInt; @@ -57,7 +57,7 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks { @Override public void spawnParticleStream(float startX, float startY, float startZ, float endX, float endY, float endZ, float speed, int color, float scale) { - Vec3d dir = new Vec3d(endX - startX, endY - startY, endZ - startZ); + Vector3d dir = new Vector3d(endX - startX, endY - startY, endZ - startZ); double length = dir.length(); if (length > 0) { dir = dir.normalize(); @@ -88,9 +88,9 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks { } @Override - public List> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name) { - List> found = new ArrayList<>(); - for (Tuple powder : ((WorldData) IWorldData.getWorldData(world)).effectPowders.get(name)) + public List> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name) { + List> found = new ArrayList<>(); + for (Tuple powder : ((WorldData) IWorldData.getWorldData(world)).effectPowders.get(name)) if (area.contains(powder.getA())) found.add(powder); return found; @@ -98,9 +98,9 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks { @Override public boolean isEffectPowderActive(World world, BlockPos pos, ResourceLocation name) { - Vec3d posVec = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); - List> powders = this.getActiveEffectPowders(world, new AxisAlignedBB(pos).grow(64), name); - for (Tuple powder : powders) { + Vector3d posVec = new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); + List> powders = this.getActiveEffectPowders(world, new AxisAlignedBB(pos).grow(64), name); + for (Tuple powder : powders) { AxisAlignedBB bounds = Helper.aabb(powder.getA()).grow(powder.getB()); if (bounds.contains(posVec)) return true; diff --git a/src/main/java/de/ellpeck/naturesaura/ModConfig.java b/src/main/java/de/ellpeck/naturesaura/ModConfig.java index f24ad5ea..24b4cccd 100644 --- a/src/main/java/de/ellpeck/naturesaura/ModConfig.java +++ b/src/main/java/de/ellpeck/naturesaura/ModConfig.java @@ -10,7 +10,6 @@ import net.minecraft.entity.EntityType; import net.minecraft.tags.BlockTags; import net.minecraft.tags.Tag; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.registries.ForgeRegistries; @@ -182,12 +181,13 @@ public final class ModConfig { } try { - for (String s : this.auraTypeOverrides.get()) { + // TODO aura type config + /*for (String s : this.auraTypeOverrides.get()) { String[] split = s.split("->"); ResourceLocation dim = new ResourceLocation(split[0]); BasicAuraType type = Objects.requireNonNull((BasicAuraType) NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(split[1])), "type"); type.addDimensionType(dim); - } + }*/ } catch (Exception e) { NaturesAura.LOGGER.warn("Error parsing auraTypeOverrides", e); } diff --git a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java index f911eade..cc97d765 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java +++ b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java @@ -19,10 +19,10 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.DimensionType; import net.minecraft.world.IWorld; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; @@ -54,9 +54,9 @@ public final class NaturesAuraAPI { * easily registered using {@link BasicAuraType#register()}. */ public static final Map AURA_TYPES = new HashMap<>(); - public static final BasicAuraType TYPE_OVERWORLD = new BasicAuraType(new ResourceLocation(MOD_ID, "overworld"), DimensionType.OVERWORLD, 0x89cc37, 0).register(); - public static final BasicAuraType TYPE_NETHER = new BasicAuraType(new ResourceLocation(MOD_ID, "nether"), DimensionType.THE_NETHER, 0x871c0c, 0).register(); - public static final BasicAuraType TYPE_END = new BasicAuraType(new ResourceLocation(MOD_ID, "end"), DimensionType.THE_END, 0x302624, 0).register(); + public static final BasicAuraType TYPE_OVERWORLD = new BasicAuraType(new ResourceLocation(MOD_ID, "overworld"), World.field_234918_g_, 0x89cc37, 0).register(); + public static final BasicAuraType TYPE_NETHER = new BasicAuraType(new ResourceLocation(MOD_ID, "nether"), World.field_234919_h_, 0x871c0c, 0).register(); + public static final BasicAuraType TYPE_END = new BasicAuraType(new ResourceLocation(MOD_ID, "end"), World.field_234920_i_, 0x302624, 0).register(); public static final BasicAuraType TYPE_OTHER = new BasicAuraType(new ResourceLocation(MOD_ID, "other"), null, 0x2fa8a0, Integer.MIN_VALUE).register(); /** * A map of all {@link IDrainSpotEffect} suppliers which are effects that @@ -267,7 +267,7 @@ public final class NaturesAuraAPI { * @param name The registry name of the powder * @return A list of powders' positions and ranges */ - List> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name); + List> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name); /** * Returns true if there is an effect powder entity active anywhere diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java b/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java index 440353a3..38f17590 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java @@ -1,9 +1,12 @@ package de.ellpeck.naturesaura.api.aura.type; import de.ellpeck.naturesaura.api.NaturesAuraAPI; +import net.minecraft.util.RegistryKey; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.DimensionType; import net.minecraft.world.IWorld; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.World; +import net.minecraftforge.registries.ForgeRegistries; import java.util.HashSet; import java.util.Set; @@ -13,14 +16,14 @@ public class BasicAuraType implements IAuraType { private final ResourceLocation name; private final int color; private final int priority; - private final Set dimensions = new HashSet<>(); + private final Set> dimensions = new HashSet<>(); - public BasicAuraType(ResourceLocation name, DimensionType dimension, int color, int priority) { + public BasicAuraType(ResourceLocation name, RegistryKey dimension, int color, int priority) { this.name = name; this.color = color; this.priority = priority; if (dimension != null) - this.dimensions.add(dimension.getRegistryName()); + this.dimensions.add(dimension); } public BasicAuraType register() { @@ -35,7 +38,7 @@ public class BasicAuraType implements IAuraType { @Override public boolean isPresentInWorld(IWorld world) { - return this.dimensions.isEmpty() || this.dimensions.contains(world.getDimension().getType().getRegistryName()); + return this.dimensions.isEmpty() || this.dimensions.contains(((World) world).func_234923_W_()); } @Override @@ -48,7 +51,7 @@ public class BasicAuraType implements IAuraType { return this.priority; } - public void addDimensionType(ResourceLocation typeName) { - this.dimensions.add(typeName); + public void addDimensionType(RegistryKey type) { + this.dimensions.add(type); } } diff --git a/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java b/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java index 417445f2..6725e88e 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java +++ b/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java @@ -2,8 +2,8 @@ package de.ellpeck.naturesaura.api.misc; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.world.DimensionType; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.items.IItemHandlerModifiable; @@ -16,7 +16,7 @@ public interface IWorldData extends ICapabilityProvider, INBTSerializable state.getBlock().getTags().contains(tag.getId())); + public static Matcher tag(Block defaultBlock, ITag.INamedTag tag) { + return new Matcher(defaultBlock.getDefaultState(), (world, start, offset, pos, state, c) -> state.getBlock().getTags().contains(tag.getName())); } public BlockState getDefaultState() { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java index a69f48b4..07982f43 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java @@ -4,17 +4,17 @@ import de.ellpeck.naturesaura.data.BlockStateGenerator; import de.ellpeck.naturesaura.reg.ICustomBlockState; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.block.LogBlock; +import net.minecraft.block.RotatedPillarBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; -public class BlockAncientLog extends LogBlock implements IModItem, ICustomBlockState { +public class BlockAncientLog extends RotatedPillarBlock implements IModItem, ICustomBlockState { private final String baseName; public BlockAncientLog(String baseName) { - super(MaterialColor.PURPLE, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2.0F).sound(SoundType.WOOD)); + super(ModBlocks.prop(Material.WOOD,MaterialColor.PURPLE).hardnessAndResistance(2.0F).sound(SoundType.WOOD)); this.baseName = baseName; ModRegistry.add(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java index a841d6dc..eec4b93b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java @@ -67,9 +67,9 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte @Override public void grow(ServerWorld world, Random rand, BlockPos pos, BlockState state) { if (state.get(SaplingBlock.STAGE) == 0) { - world.setBlockState(pos, state.cycle(SaplingBlock.STAGE), 4); + world.setBlockState(pos, state.func_235896_a_(SaplingBlock.STAGE), 4); } else if (ForgeEventFactory.saplingGrowTree(world, rand, pos)) { - ModFeatures.ANCIENT_TREE.place(world, world.getChunkProvider().getChunkGenerator(), rand, pos, WorldGenAncientTree.CONFIG); + ModFeatures.ANCIENT_TREE.func_241855_a(world, world.getChunkProvider().getChunkGenerator(), rand, pos, WorldGenAncientTree.CONFIG); } } @@ -85,6 +85,6 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte @Override public Supplier getRenderType() { - return RenderType::cutoutMipped; + return RenderType::getCutoutMipped; } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraBloom.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraBloom.java index dafb8c7b..10608eec 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraBloom.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraBloom.java @@ -10,9 +10,9 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; @@ -49,7 +49,7 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - Vec3d vec3d = state.getOffset(worldIn, pos); + Vector3d vec3d = state.getOffset(worldIn, pos); return SHAPE.withOffset(vec3d.x, vec3d.y, vec3d.z); } @@ -65,7 +65,7 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS @Override public Supplier getRenderType() { - return RenderType::cutout; + return RenderType::getCutout; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraTimer.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraTimer.java index a477e42b..df57f47a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraTimer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraTimer.java @@ -65,7 +65,7 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt @Override public Supplier getRenderType() { - return RenderType::cutout; + return RenderType::getCutout; } @Override @@ -88,11 +88,6 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt return state.get(BlockStateProperties.POWERED) ? 15 : 0; } - @Override - public int tickRate(IWorldReader world) { - return 4; - } - @Override public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { super.tick(state, worldIn, pos, random); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java index 325e424a..5e1e0ece 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java @@ -7,10 +7,12 @@ import de.ellpeck.naturesaura.reg.ModTileType; import net.minecraft.block.*; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameters; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tags.FluidTags; @@ -22,8 +24,6 @@ import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.LootParameters; import javax.annotation.Nullable; import java.util.List; @@ -59,7 +59,7 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem { } @Override - public IFluidState getFluidState(BlockState state) { + public FluidState getFluidState(BlockState state) { return this.hasWaterlogging() && state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state); } @@ -74,7 +74,7 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem { @Nullable public BlockState getStateForPlacement(BlockItemUseContext context) { if (this.hasWaterlogging()) { - IFluidState state = context.getWorld().getFluidState(context.getPos()); + FluidState state = context.getWorld().getFluidState(context.getPos()); return this.getDefaultState().with(BlockStateProperties.WATERLOGGED, state.isTagged(FluidTags.WATER) && state.getLevel() == 8); } return super.getStateForPlacement(context); @@ -157,16 +157,11 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem { TileEntityImpl impl = (TileEntityImpl) tile; int newPower = world.getRedstonePowerFromNeighbors(pos); if (impl.redstonePower != newPower) - world.getPendingBlockTicks().scheduleTick(pos, this, this.tickRate(world)); + world.getPendingBlockTicks().scheduleTick(pos, this, 4); } } } - @Override - public int tickRate(IWorldReader worldIn) { - return 4; - } - @Override public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { if (!worldIn.isRemote) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java index 56dcd3e1..e73b2b97 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java @@ -40,6 +40,6 @@ public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState, @Override public Supplier getRenderType() { - return RenderType::cutoutMipped; + return RenderType::getCutoutMipped; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java index 5fe2aae7..718ae4e7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java @@ -19,20 +19,16 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.state.EnumProperty; -import net.minecraft.state.IProperty; +import net.minecraft.state.Property; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RailShape; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Hand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvents; +import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.util.ITeleporter; @@ -45,20 +41,20 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I public static final EnumProperty SHAPE = BlockStateProperties.RAIL_SHAPE; private final String name; - private final int goalDim; - private final DimensionType[] canUseDims; + private final RegistryKey goalDim; + private final RegistryKey[] canUseDims; - public BlockDimensionRail(String name, DimensionType goalDim, DimensionType... canUseDims) { + public BlockDimensionRail(String name, RegistryKey goalDim, RegistryKey... canUseDims) { super(false, ModBlocks.prop(Blocks.RAIL)); this.name = name; - this.goalDim = goalDim.getId(); + this.goalDim = goalDim; this.canUseDims = canUseDims; ModRegistry.add(this); } - private boolean canUseHere(DimensionType dimension) { - for (DimensionType dim : this.canUseDims) + private boolean canUseHere(RegistryKey dimension) { + for (RegistryKey dim : this.canUseDims) if (dim == dimension) return true; return false; @@ -70,7 +66,10 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I if (stack.getItem() == ModItems.RANGE_VISUALIZER) { if (!worldIn.isRemote) { BlockPos goalPos = this.getGoalCoords(worldIn, pos); + // TODO dimension rail visualization +/* PacketHandler.sendTo(player, new PacketClient(0, this.goalDim, goalPos.getX(), goalPos.getY(), goalPos.getZ())); +*/ } return ActionResultType.SUCCESS; } @@ -83,7 +82,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I return; if (cart.isBeingRidden()) return; - if (!this.canUseHere(world.getDimension().getType())) + if (!this.canUseHere(world.func_234923_W_())) return; AxisAlignedBB box = cart.getBoundingBox(); @@ -91,7 +90,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I world.playSound(null, pos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 1F, 1F); BlockPos goalCoords = this.getGoalCoords(world, pos); - cart.changeDimension(DimensionType.getById(this.goalDim), new ITeleporter() { + cart.changeDimension(world.getServer().getWorld(this.goalDim), new ITeleporter() { @Override public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function repositionEntity) { Entity result = repositionEntity.apply(false); @@ -106,22 +105,21 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I private BlockPos getGoalCoords(World world, BlockPos pos) { MinecraftServer server = world.getServer(); - DimensionType goalDimType = DimensionType.getById(this.goalDim); if (this == ModBlocks.DIMENSION_RAIL_NETHER) { // travel to the nether from the overworld return new BlockPos(pos.getX() / 8, pos.getY() / 2, pos.getZ() / 8); } else if (this == ModBlocks.DIMENSION_RAIL_END) { // travel to the end from the overworld - ServerWorld end = server.getWorld(goalDimType); - return end.getSpawnCoordinate().up(8); + ServerWorld end = server.getWorld(this.goalDim); + return end.func_241135_u_().up(8); } else { - if (world.getDimension().getType() == DimensionType.THE_NETHER) { + if (world.func_234923_W_() == World.field_234919_h_) { // travel to the overworld from the nether return new BlockPos(pos.getX() * 8, pos.getY() * 2, pos.getZ() * 8); } else { // travel to the overworld from the end - World overworld = server.getWorld(goalDimType); - BlockPos spawn = overworld.getSpawnPoint(); + ServerWorld overworld = server.getWorld(this.goalDim); + BlockPos spawn = overworld.func_241135_u_(); BlockPos ret = new BlockPos(spawn.getX(), 0, spawn.getZ()); return ret.up(overworld.getHeight(Heightmap.Type.WORLD_SURFACE, spawn.getX(), spawn.getZ())); } @@ -129,7 +127,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I } @Override - public IProperty getShapeProperty() { + public Property getShapeProperty() { return SHAPE; } @@ -155,7 +153,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I @Override public Supplier getRenderType() { - return RenderType::cutoutMipped; + return RenderType::getCutoutMipped; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java index 53e0034e..792605e2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java @@ -10,20 +10,20 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.boss.dragon.EnderDragonEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameters; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraft.world.gen.Heightmap; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.LootParameters; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -45,7 +45,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - Vec3d vec3d = state.getOffset(worldIn, pos); + Vector3d vec3d = state.getOffset(worldIn, pos); return SHAPE.withOffset(vec3d.x, vec3d.y, vec3d.z); } @@ -97,7 +97,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS } @Override - public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) { + public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) { return willHarvest || super.removedByPlayer(state, world, pos, player, willHarvest, fluid); } @@ -127,6 +127,6 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS @Override public Supplier getRenderType() { - return RenderType::cutout; + return RenderType::getCutout; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java index a3295587..f5e8ebbf 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java @@ -56,7 +56,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider private static final ThreadLocal> CACHED_WORLD = new ThreadLocal<>(); public BlockEnderCrate() { - super("ender_crate", TileEntityEnderCrate::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).lightValue(7).sound(SoundType.STONE)); + super("ender_crate", TileEntityEnderCrate::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).setLightLevel(s -> 7).sound(SoundType.STONE)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java index f2429f62..cea49b21 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java @@ -38,7 +38,7 @@ public class BlockFieldCreator extends BlockContainerImpl implements ICustomBloc if (!worldIn.isRemote) { String key = NaturesAura.MOD_ID + ":field_creator_pos"; CompoundNBT compound = player.getPersistentData(); - if (!player.isShiftKeyDown() && compound.contains(key)) { + if (!player.isSneaking() && compound.contains(key)) { BlockPos stored = BlockPos.fromLong(compound.getLong(key)); TileEntityFieldCreator creator = (TileEntityFieldCreator) tile; if (!pos.equals(stored)) { @@ -94,11 +94,6 @@ public class BlockFieldCreator extends BlockContainerImpl implements ICustomBloc } } - @Override - public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) { - return false; - } - @Override public void generateCustomBlockState(BlockStateGenerator generator) { generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName()))); @@ -106,6 +101,6 @@ public class BlockFieldCreator extends BlockContainerImpl implements ICustomBloc @Override public Supplier getRenderType() { - return RenderType::cutoutMipped; + return RenderType::getCutoutMipped; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerPot.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerPot.java index 8419d374..82d1d5b3 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerPot.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerPot.java @@ -18,16 +18,16 @@ public class BlockFlowerPot extends FlowerPotBlock implements ICustomBlockState, public void generateCustomBlockState(BlockStateGenerator generator) { generator.simpleBlock(this, generator.models() .withExistingParent(this.getBaseName(), "block/flower_pot_cross") - .texture("plant", "block/" + this.func_220276_d().getRegistryName().getPath())); + .texture("plant", "block/" + this.getFlower().getRegistryName().getPath())); } @Override public String getBaseName() { - return "potted_" + this.func_220276_d().getRegistryName().getPath(); + return "potted_" + this.getFlower().getRegistryName().getPath(); } @Override public Supplier getRenderType() { - return RenderType::cutout; + return RenderType::getCutout; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java index 87a06e4c..55714b10 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java @@ -84,11 +84,6 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo return SHAPES[state.get(FACING).getIndex()]; } - @Override - public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) { - return false; - } - @Override protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java index 2ad523fa..5fa06600 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java @@ -103,7 +103,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock, if (!blockstate1.isNormalCube(worldIn, blockpos1)) { boolean flag = blockstate.isSolidSide(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER; if (flag && this.canConnectTo(worldIn.getBlockState(blockpos.up()))) { - if (blockstate.isCollisionShapeOpaque(worldIn, blockpos)) { + if (blockstate.hasOpaqueCollisionShape(worldIn, blockpos)) { return RedstoneSide.UP; } @@ -187,26 +187,25 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock, } @Override - public void updateDiagonalNeighbors(BlockState state, IWorld worldIn, BlockPos pos, int flags) { - try (BlockPos.PooledMutable pool = BlockPos.PooledMutable.retain()) { - for (Direction direction : Direction.Plane.HORIZONTAL) { - RedstoneSide redstoneside = state.get(RedstoneWireBlock.FACING_PROPERTY_MAP.get(direction)); - if (redstoneside != RedstoneSide.NONE && worldIn.getBlockState(pool.setPos(pos).move(direction)).getBlock() != this) { - pool.move(Direction.DOWN); - BlockState blockstate = worldIn.getBlockState(pool); - if (blockstate.getBlock() != Blocks.OBSERVER) { - BlockPos blockpos = pool.offset(direction.getOpposite()); - BlockState blockstate1 = blockstate.updatePostPlacement(direction.getOpposite(), worldIn.getBlockState(blockpos), worldIn, pool, blockpos); - replaceBlock(blockstate, blockstate1, worldIn, pool, flags); - } + public void updateDiagonalNeighbors(BlockState state, IWorld worldIn, BlockPos pos, int flags, int recursionLeft) { + BlockPos.Mutable pool = new BlockPos.Mutable(); + for (Direction direction : Direction.Plane.HORIZONTAL) { + RedstoneSide redstoneside = state.get(RedstoneWireBlock.FACING_PROPERTY_MAP.get(direction)); + if (redstoneside != RedstoneSide.NONE && worldIn.getBlockState(pool.setPos(pos).move(direction)).getBlock() != this) { + pool.move(Direction.DOWN); + BlockState blockstate = worldIn.getBlockState(pool); + if (blockstate.getBlock() != Blocks.OBSERVER) { + BlockPos blockpos = pool.offset(direction.getOpposite()); + BlockState blockstate1 = blockstate.updatePostPlacement(direction.getOpposite(), worldIn.getBlockState(blockpos), worldIn, pool, blockpos); + replaceBlock(blockstate, blockstate1, worldIn, pool, flags); + } - pool.setPos(pos).move(direction).move(Direction.UP); - BlockState blockstate3 = worldIn.getBlockState(pool); - if (blockstate3.getBlock() != Blocks.OBSERVER) { - BlockPos blockpos1 = pool.offset(direction.getOpposite()); - BlockState blockstate2 = blockstate3.updatePostPlacement(direction.getOpposite(), worldIn.getBlockState(blockpos1), worldIn, pool, blockpos1); - replaceBlock(blockstate3, blockstate2, worldIn, pool, flags); - } + pool.setPos(pos).move(direction).move(Direction.UP); + BlockState blockstate3 = worldIn.getBlockState(pool); + if (blockstate3.getBlock() != Blocks.OBSERVER) { + BlockPos blockpos1 = pool.offset(direction.getOpposite()); + BlockState blockstate2 = blockstate3.updatePostPlacement(direction.getOpposite(), worldIn.getBlockState(blockpos1), worldIn, pool, blockpos1); + replaceBlock(blockstate3, blockstate2, worldIn, pool, flags); } } } @@ -235,6 +234,6 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock, @Override public Supplier getRenderType() { - return RenderType::cutoutMipped; + return RenderType::getCutoutMipped; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java index 06c13d41..905399e6 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java @@ -36,11 +36,11 @@ public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IColorPr public static boolean convert(World world, BlockPos pos) { BlockState state = world.getBlockState(pos); - if ((state.getBlock().isFoliage(state, world, pos) || state.getBlock() instanceof LeavesBlock) && !(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) { + if (state.getBlock() instanceof LeavesBlock && !(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) { if (!world.isRemote) { world.setBlockState(pos, ModBlocks.GOLDEN_LEAVES.getDefaultState() - .with(DISTANCE, state.has(DISTANCE) ? state.get(DISTANCE) : 1) - .with(PERSISTENT, state.has(PERSISTENT) ? state.get(PERSISTENT) : false)); + .with(DISTANCE, state.hasProperty(DISTANCE) ? state.get(DISTANCE) : 1) + .with(PERSISTENT, state.hasProperty(PERSISTENT) ? state.get(PERSISTENT) : false)); } return true; } @@ -76,7 +76,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IColorPr return (state, worldIn, pos, tintIndex) -> { int color = 0xF2FF00; if (state != null && worldIn != null && pos != null) { - int foliage = BiomeColors.func_228361_b_(worldIn, pos); + int foliage = BiomeColors.getFoliageColor(worldIn, pos); return Helper.blendColors(color, foliage, state.get(STAGE) / (float) HIGHEST_STAGE); } else { return color; @@ -100,7 +100,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IColorPr } if (stage > 1) { - BlockPos offset = pos.offset(Direction.random(random)); + BlockPos offset = pos.offset(Direction.func_239631_a_(random)); if (worldIn.isBlockLoaded(offset)) convert(worldIn, offset); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java index 46ce9c35..566dd886 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java @@ -95,7 +95,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock @Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { - if (!player.isShiftKeyDown()) + if (!player.isSneaking()) return ActionResultType.FAIL; TileEntity tile = worldIn.getTileEntity(pos); if (!(tile instanceof TileEntityGratedChute)) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockItemDistributor.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockItemDistributor.java index 33d0957b..639d9cfa 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockItemDistributor.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockItemDistributor.java @@ -21,7 +21,7 @@ public class BlockItemDistributor extends BlockContainerImpl implements ICustomB @Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { - if (!player.isShiftKeyDown()) + if (!player.isSneaking()) return ActionResultType.FAIL; TileEntity tile = worldIn.getTileEntity(pos); if (!(tile instanceof TileEntityItemDistributor)) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockLight.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockLight.java index ea1e1ebf..44a67964 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockLight.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockLight.java @@ -26,7 +26,7 @@ public class BlockLight extends BlockImpl implements ICustomBlockState, INoItemB private static final VoxelShape SHAPE = makeCuboidShape(4, 4, 4, 12, 12, 12); public BlockLight() { - super("light", Properties.create(Material.WOOL).doesNotBlockMovement().lightValue(15)); + super("light", Properties.create(Material.WOOL).doesNotBlockMovement().setLightLevel(s -> 15)); } @Override @@ -57,6 +57,6 @@ public class BlockLight extends BlockImpl implements ICustomBlockState, INoItemB @Override public Supplier getRenderType() { - return RenderType::cutout; + return RenderType::getCutoutMipped; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNetherGrass.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNetherGrass.java index e376892a..69fc8f86 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNetherGrass.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNetherGrass.java @@ -72,7 +72,7 @@ public class BlockNetherGrass extends BlockImpl implements ICustomBlockState, IG } blockpos1 = blockpos1.add(rand.nextInt(3) - 1, (rand.nextInt(3) - 1) * rand.nextInt(3) / 2, rand.nextInt(3) - 1); - if (world.getBlockState(blockpos1.down()).getBlock() != this || world.getBlockState(blockpos1).isCollisionShapeOpaque(world, blockpos1)) { + if (world.getBlockState(blockpos1.down()).getBlock() != this || world.getBlockState(blockpos1).hasOpaqueCollisionShape(world, blockpos1)) { break; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java index 872fe782..78c92a9a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java @@ -31,7 +31,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza @SubscribeEvent public void onPickup(EntityItemPickupEvent event) { PlayerEntity player = event.getPlayer(); - if (player != null && !player.isShiftKeyDown()) { + if (player != null && !player.isSneaking()) { ItemEntity item = event.getItem(); BlockPos pos = item.getPosition(); Helper.getTileEntitiesInArea(item.world, pos, 8, tile -> { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java index 9774b719..0bb7e975 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java @@ -18,13 +18,14 @@ import net.minecraft.entity.MobEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; @@ -39,7 +40,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable, private static final VoxelShape SHAPE = VoxelShapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F); public BlockSpawnLamp() { - super("spawn_lamp", TileEntitySpawnLamp::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3F).lightValue(15).sound(SoundType.METAL)); + super("spawn_lamp", TileEntitySpawnLamp::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3F).setLightLevel(s -> 15).sound(SoundType.METAL)); MinecraftForge.EVENT_BUS.register(this); } @@ -66,7 +67,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable, continue; BlockPos lampPos = lamp.getPos(); - if (!new AxisAlignedBB(lampPos).grow(range).contains(new Vec3d(pos))) + if (!new AxisAlignedBB(lampPos).grow(range).contains(new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5))) continue; MobEntity entity = (MobEntity) event.getEntityLiving(); @@ -74,7 +75,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable, BlockPos spot = IAuraChunk.getHighestSpot(world, lampPos, 32, lampPos); IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 200); - PacketHandler.sendToAllAround(world, lampPos, 32, + PacketHandler.sendToAllAround((ServerWorld) world, lampPos, 32, new PacketParticles(lampPos.getX(), lampPos.getY(), lampPos.getZ(), PacketParticles.Type.SPAWN_LAMP)); } @@ -113,6 +114,6 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable, @Override public Supplier getRenderType() { - return RenderType::cutoutMipped; + return RenderType::getCutoutMipped; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java index 146a918c..12b41d55 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java @@ -9,8 +9,8 @@ import de.ellpeck.naturesaura.blocks.BlockNatureAltar; import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.recipes.ModRecipes; import net.minecraft.block.Blocks; -import net.minecraft.block.LogBlock; import net.minecraft.block.SaplingBlock; +import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.tags.BlockTags; import net.minecraft.util.ResourceLocation; @@ -49,7 +49,7 @@ public final class Multiblocks { 'G', ModBlocks.GOLD_POWDER, '0', new Matcher(Blocks.OAK_SAPLING.getDefaultState(), (world, start, offset, pos, state, c) -> { - if (state.getBlock() instanceof SaplingBlock || state.getBlock() instanceof LogBlock) + if (state.getBlock() instanceof SaplingBlock || state.getMaterial() == Material.WOOD) return true; // try-catch to prevent blocks that need to have been placed crashing here try { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalContainer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalContainer.java index 1365497f..56e9c0f7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalContainer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalContainer.java @@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import java.util.HashSet; import java.util.List; @@ -38,13 +38,13 @@ public class TileEntityAnimalContainer extends TileEntityImpl implements ITickab for (AnimalEntity animal : animalsOutRange) { if (animalsInRange.contains(animal)) continue; - Vec3d pos = animal.getPositionVec(); - Vec3d distance = pos.subtract(this.pos.getX(), pos.getY(), this.pos.getZ()); + Vector3d pos = animal.getPositionVec(); + Vector3d distance = pos.subtract(this.pos.getX(), pos.getY(), this.pos.getZ()); distance = distance.normalize().scale(-0.15F); animal.setMotion(distance); if (this.world.rand.nextBoolean()) { - Vec3d eye = animal.getEyePosition(1).add(animal.getLookVec()); + Vector3d eye = animal.getEyePosition(1).add(animal.getLookVec()); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles((float) eye.getX(), (float) eye.getY(), (float) eye.getZ(), PacketParticles.Type.ANIMAL_CONTAINER)); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraTimer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraTimer.java index 2d681d66..7e3bfe77 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraTimer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraTimer.java @@ -73,7 +73,7 @@ public class TileEntityAuraTimer extends TileEntityImpl implements ITickableTile BlockState state = this.getBlockState(); this.world.setBlockState(this.pos, state.with(BlockStateProperties.POWERED, true), 1); - this.world.getPendingBlockTicks().scheduleTick(this.pos, state.getBlock(), state.getBlock().tickRate(this.world)); + this.world.getPendingBlockTicks().scheduleTick(this.pos, state.getBlock(), 4); int color = ItemAuraBottle.getType(this.itemHandler.getStackInSlot(0)).getColor(); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.TIMER_RESET, color)); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java index ddd53e39..2ef169e4 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java @@ -11,15 +11,15 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameters; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.LootParameters; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; @@ -95,15 +95,15 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickableT chunk.drainAura(spot, 100); ItemStack tool = this.getToolUsed(creator); - Vec3d dist = new Vec3d( + Vector3d dist = new Vector3d( this.pos.getX() - connectedPos.getX(), this.pos.getY() - connectedPos.getY(), this.pos.getZ() - connectedPos.getZ() ); double length = dist.length(); - Vec3d normal = new Vec3d(dist.x / length, dist.y / length, dist.z / length); + Vector3d normal = new Vector3d(dist.x / length, dist.y / length, dist.z / length); for (float i = MathHelper.floor(length); i > 0; i -= 0.5F) { - Vec3d scaled = normal.scale(i); + Vector3d scaled = normal.scale(i); BlockPos pos = connectedPos.add( MathHelper.floor(scaled.x + 0.5F), MathHelper.floor(scaled.y + 0.5F), @@ -118,7 +118,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickableT FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) this.world); if (!MinecraftForge.EVENT_BUS.post(new BlockEvent.BreakEvent(this.world, pos, state, fake))) { List drops = state.getDrops(new LootContext.Builder((ServerWorld) this.world) - .withParameter(LootParameters.POSITION, pos) + .withParameter(LootParameters.field_237457_g_, Vector3d.copyCentered(pos)) .withParameter(LootParameters.BLOCK_STATE, state) .withParameter(LootParameters.TOOL, tool == null ? new ItemStack(Items.DIAMOND_PICKAXE) : tool) .withNullableParameter(LootParameters.BLOCK_ENTITY, this.world.getTileEntity(pos))); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java index 10f2e845..8e4d070d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java @@ -4,8 +4,8 @@ import com.google.common.primitives.Ints; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.entity.item.FireworkRocketEntity; import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.projectile.FireworkRocketEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java index 97437209..7972c53a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java @@ -40,7 +40,7 @@ public class TileEntityImpl extends TileEntity { } @Override - public void read(CompoundNBT compound) { + public void read(BlockState state, CompoundNBT compound) { this.readNBT(compound, SaveType.TILE); } @@ -53,7 +53,7 @@ public class TileEntityImpl extends TileEntity { public void readNBT(CompoundNBT compound, SaveType type) { if (type != SaveType.BLOCK) { - super.read(compound); + super.read(this.getBlockState(), compound); this.redstonePower = compound.getInt("redstone"); } } @@ -77,8 +77,9 @@ public class TileEntityImpl extends TileEntity { } @Override - public void handleUpdateTag(CompoundNBT tag) { + public void handleUpdateTag(BlockState state, CompoundNBT tag) { this.readNBT(tag, SaveType.SYNC); + } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java index dcb5e329..e144b677 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.LogBlock; +import net.minecraft.tags.BlockTags; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; @@ -23,7 +23,7 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickableT if (!this.world.isRemote) while (!this.scheduledBigTrees.isEmpty()) { BlockPos pos = this.scheduledBigTrees.remove(); - if (this.world.getBlockState(pos).getBlock() instanceof LogBlock) { + if (this.world.getBlockState(pos).getBlock().getTags().contains(BlockTags.LOGS.getName())) { int toAdd = 100000; boolean canGen = this.canGenerateRightNow(25, toAdd); if (canGen) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java index 35e43583..7ee047af 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java @@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.recipes.OfferingRecipe; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; +import net.minecraft.entity.EntityType; import net.minecraft.entity.effect.LightningBoltEntity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; @@ -16,6 +17,7 @@ import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.items.IItemHandlerModifiable; @@ -84,7 +86,9 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable for (int i = 0; i < recipeCount; i++) this.itemsToSpawn.add(recipe.output.copy()); - ((ServerWorld) this.world).addLightningBolt(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true)); + LightningBoltEntity lightningboltentity = EntityType.LIGHTNING_BOLT.create(this.world); + lightningboltentity.moveForced(Vector3d.copyCenteredHorizontally(this.pos)); + this.world.addEntity(lightningboltentity); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( (float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.OFFERING_TABLE, this.pos.getX(), this.pos.getY(), this.pos.getZ())); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java index 2118f8f5..2d131bba 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java @@ -16,7 +16,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.FakePlayer; @@ -109,7 +109,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickableTileEnt return stack; FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) this.world); fake.inventory.mainInventory.set(fake.inventory.currentItem, stack); - BlockRayTraceResult ray = new BlockRayTraceResult(new Vec3d(pos).add(0.5F, 0.5F, 0.5F), Direction.UP, pos, false); + BlockRayTraceResult ray = new BlockRayTraceResult(Vector3d.copyCentered(pos), Direction.UP, pos, false); ForgeHooks.onPlaceItemIntoWorld(new ItemUseContext(fake, Hand.MAIN_HAND, ray)); return fake.getHeldItemMainhand().copy(); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySnowCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySnowCreator.java index b38da9cd..6063b6c0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySnowCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySnowCreator.java @@ -14,7 +14,6 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; import net.minecraft.world.gen.Heightmap; public class TileEntitySnowCreator extends TileEntityImpl implements ITickableTileEntity { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java index 7c0f312b..12182a99 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java @@ -19,6 +19,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.GameRules; import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.storage.ServerWorldInfo; import java.util.List; @@ -47,16 +48,16 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickableTi this.sendToClients(); return; } - this.world.setDayTime(current + toAdd); + ((ServerWorldInfo) this.world.getWorldInfo()).setDayTime(current + toAdd); BlockPos spot = IAuraChunk.getHighestSpot(this.world, this.pos, 35, this.pos); IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, (int) toAdd * 20); if (this.world instanceof ServerWorld) { PlayerList list = this.world.getServer().getPlayerList(); - list.sendPacketToAllPlayersInDimension(new SUpdateTimePacket( + list.sendPacketToAllPlayers(new SUpdateTimePacket( this.world.getGameTime(), this.world.getDayTime(), - this.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)), this.world.getDimension().getType()); + this.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); } return; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java index fb3aea6d..da8423dd 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java @@ -9,11 +9,11 @@ import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.LeavesBlock; -import net.minecraft.block.LogBlock; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tags.BlockTags; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; @@ -140,7 +140,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile for (int z = -1; z <= 1; z++) { BlockPos offset = pos.add(x, y, z); BlockState state = world.getBlockState(offset); - if (state.getBlock() instanceof LogBlock || includeLeaves && state.getBlock() instanceof LeavesBlock) { + if (state.getBlock().getTags().contains(BlockTags.LOGS.getName()) || includeLeaves && state.getBlock() instanceof LeavesBlock) { if (drop) { world.destroyBlock(offset, true); } else { @@ -161,7 +161,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile } for (int i = 0; i < 2; i++) { BlockState state = this.world.getBlockState(this.ritualPos.up(i)); - if (!(state.getBlock() instanceof LogBlock)) + if (!(state.getBlock().getTags().contains(BlockTags.LOGS.getName()))) return false; } if (this.timer < this.recipe.time / 2) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderAuraTimer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderAuraTimer.java index 9d4b6650..21a86d90 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderAuraTimer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderAuraTimer.java @@ -49,7 +49,7 @@ public class RenderAuraTimer extends TileEntityRenderer { private final ModelRenderer box; public AuraModel() { - super(RenderType::entityTranslucent); + super(RenderType::getEntityTranslucent); this.box = new ModelRenderer(this, 0, 0); this.box.setTextureSize(64, 64); this.box.addBox(0, 0, 0, 16, 16, 16); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java index a39bca58..4fc625da 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java @@ -5,10 +5,10 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.util.math.vector.Matrix4f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -19,7 +19,7 @@ import java.util.stream.IntStream; @OnlyIn(Dist.CLIENT) public class RenderEnderCrate extends TileEntityRenderer { private static final Random RANDOM = new Random(31100L); - private static final List RENDER_TYPES = IntStream.range(0, 16).mapToObj(i -> RenderType.endPortal(i + 1)).collect(ImmutableList.toImmutableList()); + private static final List RENDER_TYPES = IntStream.range(0, 16).mapToObj(i -> RenderType.getEndPortal(i + 1)).collect(ImmutableList.toImmutableList()); public RenderEnderCrate(TileEntityRendererDispatcher rendererDispatcherIn) { super(rendererDispatcherIn); @@ -31,7 +31,7 @@ public class RenderEnderCrate extends TileEntityRenderer { double d0 = tileEntityIn.getPos().distanceSq(this.renderDispatcher.renderInfo.getProjectedView(), true); int i = this.getPasses(d0); float f = this.getOffset(); - Matrix4f matrix4f = matrixStackIn.getLast().getPositionMatrix(); + Matrix4f matrix4f = matrixStackIn.getLast().getMatrix(); this.renderCube(f, 0.15F, matrix4f, bufferIn.getBuffer(RENDER_TYPES.get(0))); for (int j = 1; j < i; ++j) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java index ee424f3e..70d55702 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java @@ -7,13 +7,13 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover; import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.Model; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -51,7 +51,7 @@ public class RenderGeneratorLimitRemover extends TileEntityRenderer { public RenderNatureAltar(TileEntityRendererDispatcher rendererDispatcherIn) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java index d6272c3e..04298523 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java @@ -4,7 +4,6 @@ import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; @@ -12,6 +11,7 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.vector.Vector3f; import java.util.Random; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java index 4c8fdcd1..cee8168d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderProjectileGenerator.java @@ -6,13 +6,13 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.Model; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -50,7 +50,7 @@ public class RenderProjectileGenerator extends TileEntityRenderer { diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java index b52be297..71afcc0e 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java @@ -52,7 +52,7 @@ public class AnimalEffect implements IDrainSpotEffect { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return ActiveType.INACTIVE; - if (!this.bb.contains(player.getPositionVector())) + if (!this.bb.contains(player.getPositionVec())) return ActiveType.INACTIVE; if (!NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME)) return ActiveType.INHIBITED; diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java index ca851cfa..8ecdfef2 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java @@ -45,7 +45,7 @@ public class BreathlessEffect implements IDrainSpotEffect { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return ActiveType.INACTIVE; - if (!this.bb.contains(player.getPositionVector())) + if (!this.bb.contains(player.getPositionVec())) return ActiveType.INACTIVE; return ActiveType.ACTIVE; } diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java index e11af11f..9f600c8c 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java @@ -41,7 +41,7 @@ public class CacheRechargeEffect implements IDrainSpotEffect { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return ActiveType.INACTIVE; - if (!this.bb.contains(player.getPositionVector())) + if (!this.bb.contains(player.getPositionVec())) return ActiveType.INACTIVE; if (NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME)) return ActiveType.INHIBITED; diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java index 9b3ffb10..71ca749e 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.chunk.effect; +import com.sun.javafx.geom.Vec3d; import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; @@ -14,9 +15,11 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; +import net.minecraft.tags.ITag; import net.minecraft.tags.Tag; import net.minecraft.util.*; import net.minecraft.util.math.*; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.server.ServerWorld; @@ -82,13 +85,13 @@ public class OreSpawnEffect implements IDrainSpotEffect { } int totalWeight = WeightedRandom.getTotalWeight(ores); - List> powders = NaturesAuraAPI.instance().getActiveEffectPowders(world, + List> powders = NaturesAuraAPI.instance().getActiveEffectPowders(world, new AxisAlignedBB(pos).grow(this.dist), NAME); if (powders.isEmpty()) return; for (int i = 0; i < this.amount; i++) { - Tuple powder = powders.get(i % powders.size()); - Vec3d powderPos = powder.getA(); + Tuple powder = powders.get(i % powders.size()); + Vector3d powderPos = powder.getA(); int range = powder.getB(); int x = MathHelper.floor(powderPos.x + world.rand.nextGaussian() * range); int y = MathHelper.floor(powderPos.y + world.rand.nextGaussian() * range); @@ -103,7 +106,7 @@ public class OreSpawnEffect implements IDrainSpotEffect { outer: while (true) { WeightedOre ore = WeightedRandom.getRandomItem(world.rand, ores, totalWeight); - Tag tag = world.getTags().getBlocks().get(ore.tag); + ITag tag = world.getTags().func_241835_a().get(ore.tag); if (tag == null) continue; for (Block toPlace : tag.getAllElements()) { @@ -112,7 +115,7 @@ public class OreSpawnEffect implements IDrainSpotEffect { FakePlayer player = FakePlayerFactory.getMinecraft((ServerWorld) world); player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY); - BlockRayTraceResult ray = new BlockRayTraceResult(new Vec3d(pos).add(0.5F, 0.5F, 0.5F), Direction.UP, pos, false); + BlockRayTraceResult ray = new BlockRayTraceResult(Vector3d.copyCentered(pos), Direction.UP, pos, false); BlockItemUseContext context = new BlockItemUseContext(new ItemUseContext(player, Hand.MAIN_HAND, ray)); BlockState stateToPlace = toPlace.getStateForPlacement(context); if (SPAWN_EXCEPTIONS.contains(stateToPlace)) diff --git a/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java b/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java index acd4a8e0..12774c15 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java @@ -19,19 +19,30 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import top.theillusivec4.curios.api.CurioTags; -import top.theillusivec4.curios.api.CuriosAPI; -import top.theillusivec4.curios.api.capability.CuriosCapability; -import top.theillusivec4.curios.api.capability.ICurio; -import top.theillusivec4.curios.api.imc.CurioIMCMessage; +import top.theillusivec4.curios.api.CuriosCapability; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Map; +// TODO curios public class CuriosCompat implements ICompat { + @Override + public void setup() { - private static final Map> TYPES = ImmutableMap.>builder() + } + + @Override + public void setupClient() { + + } + + @Override + public void addItemTags(ItemTagProvider provider) { + + } + + /*private static final Map> TYPES = ImmutableMap.>builder() .put(ModItems.EYE, CurioTags.CHARM) .put(ModItems.EYE_IMPROVED, CurioTags.CHARM) .put(ModItems.AURA_CACHE, CurioTags.BELT) @@ -94,5 +105,5 @@ public class CuriosCompat implements ICompat { public void addItemTags(ItemTagProvider provider) { for (Map.Entry> entry : TYPES.entrySet()) provider.getBuilder(entry.getValue()).add(entry.getKey()); - } + }*/ } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/enchantibility/EnchantibilityAuraMending.java b/src/main/java/de/ellpeck/naturesaura/compat/enchantibility/EnchantibilityAuraMending.java index e53575fa..eb2c0e74 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/enchantibility/EnchantibilityAuraMending.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/enchantibility/EnchantibilityAuraMending.java @@ -22,7 +22,7 @@ public class EnchantibilityAuraMending extends AbstractEnchantEffect { return; if (event.player.world.isRemote || event.player.world.getGameTime() % 10 != 0) return; - if (!event.player.isShiftKeyDown() || event.player.getHealth() >= event.player.getMaxHealth()) + if (!event.player.isSneaking() || event.player.getHealth() >= event.player.getMaxHealth()) return; int usage = 5000; if (NaturesAuraAPI.instance().extractAuraFromPlayer(event.player, usage, false)) diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java index f0a79401..2f255961 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java @@ -14,8 +14,6 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Quaternion; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; @@ -25,6 +23,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.SpawnEggItem; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.Vector3f; import java.util.Arrays; import java.util.HashMap; @@ -122,7 +122,7 @@ public class AnimalSpawnerCategory implements IRecipeCategory= x && event.mouseY >= y && event.mouseX < x + 43 && event.mouseY < y + 42) - GuiUtils.drawHoveringText( - Collections.singletonList(TextFormatting.GOLD + "It's the author Ellpeck's birthday!"), + GuiUtils.drawHoveringText(event.matrixStack, + Collections.singletonList(new StringTextComponent("It's the author Ellpeck's birthday!").setStyle(Style.EMPTY.setFormatting(TextFormatting.GOLD))), event.mouseX, event.mouseY, event.gui.width, event.gui.height, 0, event.gui.getMinecraft().fontRenderer); } else if (now.getMonth() == Month.JUNE) { int x = event.gui.width / 2 + 272 / 2; @@ -108,15 +110,15 @@ public class PatchouliCompat implements ICompat { RenderHelper.disableStandardItemLighting(); GlStateManager.color4f(1, 1, 1, 1); event.gui.getMinecraft().getTextureManager().bindTexture(ClientEvents.BOOK_GUI); - AbstractGui.blit(x, y, 424, 0, 45, 26, 512, 256); + AbstractGui.blit(event.matrixStack, x, y, 424, 0, 45, 26, 512, 256); if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 45 && event.mouseY < y + 26) - GuiUtils.drawHoveringText( - Collections.singletonList("§6Happy §4P§6r§ei§2d§9e§5!"), + GuiUtils.drawHoveringText(event.matrixStack, + Collections.singletonList(new StringTextComponent("§6Happy §4P§6r§ei§2d§9e§5!")), event.mouseX, event.mouseY, event.gui.width, event.gui.height, 0, event.gui.getMinecraft().fontRenderer); } - String name = event.gui.getMinecraft().player.getName().getFormattedText(); + String name = event.gui.getMinecraft().player.getName().getString(); FancyInfo info = SupporterFancyHandler.FANCY_INFOS.get(name); if (info != null) { int x = event.gui.width / 2 - 272 / 2 + 20; @@ -126,20 +128,20 @@ public class PatchouliCompat implements ICompat { RenderSystem.color4f(1, 1, 1, 1); event.gui.getMinecraft().getTextureManager().bindTexture(ClientEvents.BOOK_GUI); - AbstractGui.blit(x, y, 496, 44, 16, 18, 512, 256); + AbstractGui.blit(event.matrixStack, x, y, 496, 44, 16, 18, 512, 256); if (info.tier == 1) { - AbstractGui.blit(x, y, 496 - 16, 44, 16, 18, 512, 256); + AbstractGui.blit(event.matrixStack, x, y, 496 - 16, 44, 16, 18, 512, 256); } else { float r = ((info.color >> 16) & 255) / 255F; float g = ((info.color >> 8) & 255) / 255F; float b = (info.color & 255) / 255F; RenderSystem.color3f(r, g, b); - AbstractGui.blit(x, y, 496 - 32, 44, 16, 18, 512, 256); + AbstractGui.blit(event.matrixStack, x, y, 496 - 32, 44, 16, 18, 512, 256); } if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 16 && event.mouseY < y + 18) - GuiUtils.drawHoveringText( - Collections.singletonList(TextFormatting.YELLOW + "Thanks for your support, " + name + "!"), + GuiUtils.drawHoveringText(event.matrixStack, + Collections.singletonList(new StringTextComponent("Thanks for your support, " + name + "!").setStyle(Style.EMPTY.setFormatting(TextFormatting.YELLOW))), event.mouseX, event.mouseY, event.gui.width, event.gui.height, 0, event.gui.getMinecraft().fontRenderer); } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java index 5bf9affd..bca6b898 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAltar.java @@ -1,12 +1,12 @@ package de.ellpeck.naturesaura.compat.patchouli; -import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.recipes.AltarRecipe; import de.ellpeck.naturesaura.items.ItemAuraBottle; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import vazkii.patchouli.api.IComponentProcessor; +import vazkii.patchouli.api.IVariable; import vazkii.patchouli.api.IVariableProvider; import vazkii.patchouli.api.PatchouliAPI; @@ -15,33 +15,33 @@ public class ProcessorAltar implements IComponentProcessor { private AltarRecipe recipe; @Override - public void setup(IVariableProvider provider) { - this.recipe = PatchouliCompat.getRecipe("altar", provider.get("recipe")); + public void setup(IVariableProvider provider) { + this.recipe = PatchouliCompat.getRecipe("altar", provider.get("recipe").asString()); } @Override - public String process(String key) { + public IVariable process(String key) { if (this.recipe == null) - return null; + return IVariable.empty(); switch (key) { case "input": - return PatchouliAPI.instance.serializeIngredient(this.recipe.input); + return IVariable.from(this.recipe.input); case "output": - return PatchouliAPI.instance.serializeItemStack(this.recipe.output); + return IVariable.from(this.recipe.output); case "catalyst": if (this.recipe.catalyst != Ingredient.EMPTY) - return PatchouliAPI.instance.serializeIngredient(this.recipe.catalyst); + return IVariable.from(this.recipe.catalyst); else - return null; + return IVariable.empty(); case "type": if (this.recipe.requiredType != null) - return PatchouliAPI.instance.serializeItemStack(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), this.recipe.requiredType)); + return IVariable.from(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), this.recipe.requiredType)); else - return null; + return IVariable.empty(); case "name": - return this.recipe.output.getDisplayName().getFormattedText(); + return IVariable.wrap(this.recipe.output.getDisplayName().getString()); default: - return null; + return IVariable.empty(); } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java index 81a738dc..11d51f74 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java @@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe; import net.minecraft.item.ItemStack; import net.minecraft.item.SpawnEggItem; import vazkii.patchouli.api.IComponentProcessor; +import vazkii.patchouli.api.IVariable; import vazkii.patchouli.api.IVariableProvider; import vazkii.patchouli.api.PatchouliAPI; @@ -13,31 +14,31 @@ public class ProcessorAnimalSpawner implements IComponentProcessor { private AnimalSpawnerRecipe recipe; @Override - public void setup(IVariableProvider provider) { - this.recipe = PatchouliCompat.getRecipe("animal_spawner", provider.get("recipe")); + public void setup(IVariableProvider provider) { + this.recipe = PatchouliCompat.getRecipe("animal_spawner", provider.get("recipe").asString()); } @Override - public String process(String key) { + public IVariable process(String key) { if (this.recipe == null) - return null; + return IVariable.empty(); if (key.startsWith("input")) { int id = Integer.parseInt(key.substring(5)) - 1; if (this.recipe.ingredients.length > id) - return PatchouliAPI.instance.serializeIngredient(this.recipe.ingredients[id]); + return IVariable.from(this.recipe.ingredients[id]); else - return null; + return IVariable.empty(); } else { switch (key) { case "name": - return this.recipe.entity.getName().getFormattedText(); + return IVariable.wrap(this.recipe.entity.getName().getString()); case "entity": - return this.recipe.entity.getRegistryName().toString(); + return IVariable.wrap(this.recipe.entity.getRegistryName().toString()); case "egg": ItemStack egg = new ItemStack(SpawnEggItem.getEgg(this.recipe.entity)); - return PatchouliAPI.instance.serializeItemStack(egg); + return IVariable.from(egg); default: - return null; + return IVariable.empty(); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorOffering.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorOffering.java index 45ee9fe8..7668ffe6 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorOffering.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorOffering.java @@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.compat.patchouli; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.recipes.OfferingRecipe; import vazkii.patchouli.api.IComponentProcessor; +import vazkii.patchouli.api.IVariable; import vazkii.patchouli.api.IVariableProvider; import vazkii.patchouli.api.PatchouliAPI; @@ -11,25 +12,25 @@ public class ProcessorOffering implements IComponentProcessor { private OfferingRecipe recipe; @Override - public void setup(IVariableProvider provider) { - this.recipe = PatchouliCompat.getRecipe("offering", provider.get("recipe")); + public void setup(IVariableProvider provider) { + this.recipe = PatchouliCompat.getRecipe("offering", provider.get("recipe").asString()); } @Override - public String process(String key) { + public IVariable process(String key) { if (this.recipe == null) - return null; + return IVariable.empty(); switch (key) { case "input": - return PatchouliAPI.instance.serializeIngredient(this.recipe.input); + return IVariable.from(this.recipe.input); case "output": - return PatchouliAPI.instance.serializeItemStack(this.recipe.output); + return IVariable.from(this.recipe.output); case "start": - return PatchouliAPI.instance.serializeIngredient(this.recipe.startItem); + return IVariable.from(this.recipe.startItem); case "name": - return this.recipe.output.getDisplayName().getFormattedText(); + return IVariable.wrap(this.recipe.output.getDisplayName().getString()); default: - return null; + return IVariable.empty(); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorTreeRitual.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorTreeRitual.java index a658f273..d1f9d973 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorTreeRitual.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorTreeRitual.java @@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.compat.patchouli; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.recipes.TreeRitualRecipe; import vazkii.patchouli.api.IComponentProcessor; +import vazkii.patchouli.api.IVariable; import vazkii.patchouli.api.IVariableProvider; import vazkii.patchouli.api.PatchouliAPI; @@ -11,30 +12,30 @@ public class ProcessorTreeRitual implements IComponentProcessor { private TreeRitualRecipe recipe; @Override - public void setup(IVariableProvider provider) { - this.recipe = PatchouliCompat.getRecipe("tree_ritual", provider.get("recipe")); + public void setup(IVariableProvider provider) { + this.recipe = PatchouliCompat.getRecipe("tree_ritual", provider.get("recipe").asString()); } @Override - public String process(String key) { + public IVariable process(String key) { if (this.recipe == null) - return null; + return IVariable.empty(); if (key.startsWith("input")) { int id = Integer.parseInt(key.substring(5)) - 1; if (this.recipe.ingredients.length > id) - return PatchouliAPI.instance.serializeIngredient(this.recipe.ingredients[id]); + return IVariable.from(this.recipe.ingredients[id]); else - return null; + return IVariable.empty(); } else { switch (key) { case "output": - return PatchouliAPI.instance.serializeItemStack(this.recipe.result); + return IVariable.from(this.recipe.result); case "sapling": - return PatchouliAPI.instance.serializeIngredient(this.recipe.saplingType); + return IVariable.from(this.recipe.saplingType); case "name": - return this.recipe.result.getDisplayName().getFormattedText(); + return IVariable.wrap(this.recipe.result.getDisplayName().getString()); default: - return null; + return IVariable.empty(); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/data/BlockLootProvider.java b/src/main/java/de/ellpeck/naturesaura/data/BlockLootProvider.java index 18687688..4a51e60a 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/BlockLootProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/data/BlockLootProvider.java @@ -18,11 +18,11 @@ import net.minecraft.data.DirectoryCache; import net.minecraft.data.IDataProvider; import net.minecraft.data.loot.BlockLootTables; import net.minecraft.item.Items; +import net.minecraft.loot.*; +import net.minecraft.loot.conditions.BlockStateProperty; +import net.minecraft.loot.conditions.RandomChance; +import net.minecraft.loot.functions.SetCount; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.loot.*; -import net.minecraft.world.storage.loot.conditions.BlockStateProperty; -import net.minecraft.world.storage.loot.conditions.RandomChance; -import net.minecraft.world.storage.loot.functions.SetCount; import javax.annotation.Nonnull; import java.io.IOException; @@ -103,7 +103,7 @@ public class BlockLootProvider implements IDataProvider { } public static LootTable.Builder genFlowerPot(Block block) { - return droppingAndFlowerPot(((FlowerPotBlock) block).func_220276_d()); + return droppingAndFlowerPot(((FlowerPotBlock) block).getFlower()); } public static T survivesExplosion(Block block, ILootConditionConsumer then) { diff --git a/src/main/java/de/ellpeck/naturesaura/data/BlockStateGenerator.java b/src/main/java/de/ellpeck/naturesaura/data/BlockStateGenerator.java index ddbb48a5..856f1605 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/BlockStateGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/data/BlockStateGenerator.java @@ -7,7 +7,7 @@ import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.Block; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.BlockStateProvider; -import net.minecraftforge.client.model.generators.ExistingFileHelper; +import net.minecraftforge.common.data.ExistingFileHelper; public class BlockStateGenerator extends BlockStateProvider { public BlockStateGenerator(DataGenerator gen, ExistingFileHelper exFileHelper) { diff --git a/src/main/java/de/ellpeck/naturesaura/data/BlockTagProvider.java b/src/main/java/de/ellpeck/naturesaura/data/BlockTagProvider.java index 07408eac..83d66408 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/BlockTagProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/data/BlockTagProvider.java @@ -13,13 +13,13 @@ public class BlockTagProvider extends BlockTagsProvider { @Override protected void registerTags() { - this.getBuilder(BlockTags.LOGS).add(ModBlocks.ANCIENT_LOG, ModBlocks.ANCIENT_BARK); - this.getBuilder(BlockTags.PLANKS).add(ModBlocks.ANCIENT_PLANKS); - this.getBuilder(BlockTags.STAIRS).add(ModBlocks.ANCIENT_STAIRS, ModBlocks.INFUSED_BRICK_STAIRS, ModBlocks.INFUSED_STAIRS); - this.getBuilder(BlockTags.LEAVES).add(ModBlocks.GOLDEN_LEAVES, ModBlocks.ANCIENT_LEAVES, ModBlocks.DECAYED_LEAVES); - this.getBuilder(BlockTags.RAILS).add(ModBlocks.DIMENSION_RAIL_END, ModBlocks.DIMENSION_RAIL_NETHER, ModBlocks.DIMENSION_RAIL_OVERWORLD); - this.getBuilder(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB); - this.getBuilder(Tags.Blocks.DIRT).add(ModBlocks.NETHER_GRASS); - this.getBuilder(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM); + this.getOrCreateBuilder(BlockTags.LOGS).add(ModBlocks.ANCIENT_LOG, ModBlocks.ANCIENT_BARK); + this.getOrCreateBuilder(BlockTags.PLANKS).add(ModBlocks.ANCIENT_PLANKS); + this.getOrCreateBuilder(BlockTags.STAIRS).add(ModBlocks.ANCIENT_STAIRS, ModBlocks.INFUSED_BRICK_STAIRS, ModBlocks.INFUSED_STAIRS); + this.getOrCreateBuilder(BlockTags.LEAVES).add(ModBlocks.GOLDEN_LEAVES, ModBlocks.ANCIENT_LEAVES, ModBlocks.DECAYED_LEAVES); + this.getOrCreateBuilder(BlockTags.RAILS).add(ModBlocks.DIMENSION_RAIL_END, ModBlocks.DIMENSION_RAIL_NETHER, ModBlocks.DIMENSION_RAIL_OVERWORLD); + this.getOrCreateBuilder(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB); + this.getOrCreateBuilder(Tags.Blocks.DIRT).add(ModBlocks.NETHER_GRASS); + this.getOrCreateBuilder(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM); } } diff --git a/src/main/java/de/ellpeck/naturesaura/data/ItemModelGenerator.java b/src/main/java/de/ellpeck/naturesaura/data/ItemModelGenerator.java index 43317cd6..3c65606b 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/ItemModelGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/data/ItemModelGenerator.java @@ -8,8 +8,8 @@ import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.Block; import net.minecraft.data.DataGenerator; import net.minecraft.item.Item; -import net.minecraftforge.client.model.generators.ExistingFileHelper; import net.minecraftforge.client.model.generators.ItemModelProvider; +import net.minecraftforge.common.data.ExistingFileHelper; public class ItemModelGenerator extends ItemModelProvider { public ItemModelGenerator(DataGenerator generator, ExistingFileHelper existingFileHelper) { diff --git a/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java b/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java index 653d2f92..94ec633b 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.data; +import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.data.DataGenerator; @@ -9,10 +10,11 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.Tag; import net.minecraftforge.common.Tags; +import net.minecraftforge.common.data.ExistingFileHelper; public class ItemTagProvider extends ItemTagsProvider { - public ItemTagProvider(DataGenerator generatorIn) { - super(generatorIn); + public ItemTagProvider(DataGenerator generatorIn, BlockTagProvider blockTagProvider, ExistingFileHelper helper) { + super(generatorIn, blockTagProvider, NaturesAura.MOD_ID, helper); } @Override @@ -24,13 +26,8 @@ public class ItemTagProvider extends ItemTagsProvider { this.copy(BlockTags.RAILS, ItemTags.RAILS); this.copy(BlockTags.SLABS, ItemTags.SLABS); - this.getBuilder(Tags.Items.RODS_WOODEN).add(ModItems.ANCIENT_STICK); + this.getOrCreateBuilder(Tags.Items.RODS_WOODEN).add(ModItems.ANCIENT_STICK); Compat.addItemTags(this); } - - @Override - public Tag.Builder getBuilder(Tag tagIn) { - return super.getBuilder(tagIn); - } } diff --git a/src/main/java/de/ellpeck/naturesaura/data/ModData.java b/src/main/java/de/ellpeck/naturesaura/data/ModData.java index 3ecf6b03..83b2cac8 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/ModData.java +++ b/src/main/java/de/ellpeck/naturesaura/data/ModData.java @@ -1,7 +1,7 @@ package de.ellpeck.naturesaura.data; import net.minecraft.data.DataGenerator; -import net.minecraftforge.client.model.generators.ExistingFileHelper; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.GatherDataEvent; @@ -13,9 +13,10 @@ public final class ModData { public static void gatherData(GatherDataEvent event) { DataGenerator generator = event.getGenerator(); ExistingFileHelper ex = event.getExistingFileHelper(); + BlockTagProvider blockTags = new BlockTagProvider(generator); + generator.addProvider(blockTags); + generator.addProvider(new ItemTagProvider(generator, blockTags, ex)); generator.addProvider(new BlockLootProvider(generator)); - generator.addProvider(new BlockTagProvider(generator)); - generator.addProvider(new ItemTagProvider(generator)); generator.addProvider(new BlockStateGenerator(generator, ex)); generator.addProvider(new ItemModelGenerator(generator, ex)); } diff --git a/src/main/java/de/ellpeck/naturesaura/enchant/AuraMendingEnchantment.java b/src/main/java/de/ellpeck/naturesaura/enchant/AuraMendingEnchantment.java index c7964991..77fab023 100644 --- a/src/main/java/de/ellpeck/naturesaura/enchant/AuraMendingEnchantment.java +++ b/src/main/java/de/ellpeck/naturesaura/enchant/AuraMendingEnchantment.java @@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack; public class AuraMendingEnchantment extends ModEnchantment { public AuraMendingEnchantment() { - super("aura_mending", Rarity.RARE, EnchantmentType.ALL, EquipmentSlotType.values()); + super("aura_mending", Rarity.RARE, EnchantmentType.BREAKABLE, EquipmentSlotType.values()); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java index 29840a51..d9a0a7f6 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java @@ -22,7 +22,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -85,15 +85,15 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { private void addToPowderList() { if (!this.isAddedToWorld() || this.getInhibitedEffect() == null) return; - List> powders = this.getPowderList(); - powders.add(new Tuple<>(this.getPositionVector(), this.getAmount())); + List> powders = this.getPowderList(); + powders.add(new Tuple<>(this.getPositionVec(), this.getAmount())); } private void removeFromPowderList() { if (!this.isAddedToWorld() || this.getInhibitedEffect() == null) return; - List> powders = this.getPowderList(); - Vec3d pos = this.getPositionVector(); + List> powders = this.getPowderList(); + Vector3d pos = this.getPositionVec(); for (int i = 0; i < powders.size(); i++) if (pos.equals(powders.get(i).getA())) { powders.remove(i); @@ -101,8 +101,8 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { } } - private List> getPowderList() { - ListMultimap> powders = ((WorldData) IWorldData.getWorldData(this.world)).effectPowders; + private List> getPowderList() { + ListMultimap> powders = ((WorldData) IWorldData.getWorldData(this.world)).effectPowders; return powders.get(this.getInhibitedEffect()); } @@ -196,7 +196,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { @Override @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { - return Helper.aabb(this.getPositionVector()).grow(this.getAmount()); + return Helper.aabb(this.getPositionVec()).grow(this.getAmount()); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java index 9cfb81fe..7dc25ffe 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java @@ -16,13 +16,14 @@ import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.LongNBT; import net.minecraft.network.IPacket; import net.minecraft.util.DamageSource; +import net.minecraft.util.RegistryKey; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.GameRules; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ITeleporter; import net.minecraftforge.fml.network.NetworkHooks; @@ -133,9 +134,10 @@ public class EntityMoverMinecart extends AbstractMinecartEntity { this.spotOffsets.add(BlockPos.fromLong(((LongNBT) base).getLong())); } + @Nullable @Override - public Entity changeDimension(DimensionType destination, ITeleporter teleporter) { + public Entity changeDimension(ServerWorld destination, ITeleporter teleporter) { Entity entity = super.changeDimension(destination, teleporter); if (entity instanceof EntityMoverMinecart) { BlockPos pos = entity.getPosition(); @@ -172,7 +174,7 @@ public class EntityMoverMinecart extends AbstractMinecartEntity { @Override protected void applyDrag() { - Vec3d motion = this.getMotion(); + Vector3d motion = this.getMotion(); this.setMotion(motion.x * 0.99F, 0, motion.z * 0.99F); } diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityStructureFinder.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityStructureFinder.java index ef2c0588..3a5c3082 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityStructureFinder.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityStructureFinder.java @@ -4,8 +4,8 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.entity.EntityType; -import net.minecraft.entity.item.EyeOfEnderEntity; import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.projectile.EyeOfEnderEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.IPacket; import net.minecraft.network.datasync.DataParameter; @@ -15,7 +15,7 @@ import net.minecraft.particles.ParticleTypes; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.fml.network.NetworkHooks; @@ -78,7 +78,7 @@ public class EntityStructureFinder extends EyeOfEnderEntity { public void tick() { this.baseTick(); - Vec3d vec3d = this.getMotion(); + Vector3d vec3d = this.getMotion(); double d0 = this.getPosX() + vec3d.x; double d1 = this.getPosY() + vec3d.y; double d2 = this.getPosZ() + vec3d.z; @@ -108,7 +108,7 @@ public class EntityStructureFinder extends EyeOfEnderEntity { } int j = this.getPosY() < this.targetY ? 1 : -1; - vec3d = new Vec3d(Math.cos(f2) * d5, d6 + ((double) j - d6) * (double) 0.015F, Math.sin(f2) * d5); + vec3d = new Vector3d(Math.cos(f2) * d5, d6 + ((double) j - d6) * (double) 0.015F, Math.sin(f2) * d5); this.setMotion(vec3d); } diff --git a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java index cbe5052a..5644cc49 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java @@ -6,7 +6,6 @@ import de.ellpeck.naturesaura.items.ItemEffectPowder; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.model.ItemCameraTransforms; @@ -14,6 +13,8 @@ import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -44,7 +45,7 @@ public class RenderEffectInhibitor extends EntityRenderer ResourceLocation effect = entity.getInhibitedEffect(); ItemStack stack = this.items.computeIfAbsent(effect, res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect)); - Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLightIn, OverlayTexture.DEFAULT_LIGHT, matrixStackIn, bufferIn); + Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLightIn, OverlayTexture.NO_OVERLAY, matrixStackIn, bufferIn); matrixStackIn.pop(); } } diff --git a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java index 873f024c..98907775 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java @@ -7,13 +7,13 @@ import de.ellpeck.naturesaura.entities.EntityMoverMinecart; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.MinecartRenderer; import net.minecraft.client.renderer.model.Model; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Vector3f; public class RenderMoverMinecart extends MinecartRenderer { @@ -35,7 +35,7 @@ public class RenderMoverMinecart extends MinecartRenderer { matrixStackIn.translate(0, 22 / 16F, 0); matrixStackIn.translate(0, 0, 1); matrixStackIn.rotate(Vector3f.XP.rotationDegrees(180)); - this.model.render(matrixStackIn, bufferIn.getBuffer(this.model.getRenderType(RES)), packedLightIn, OverlayTexture.DEFAULT_LIGHT, 1, 1, 1, 1); + this.model.render(matrixStackIn, bufferIn.getBuffer(this.model.getRenderType(RES)), packedLightIn, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1); matrixStackIn.pop(); } @@ -44,7 +44,7 @@ public class RenderMoverMinecart extends MinecartRenderer { private final ModelRenderer box; public ModelMoverMinecart() { - super(RenderType::entityCutout); + super(RenderType::getEntityCutout); this.box = new ModelRenderer(this, 0, 0); this.box.setTextureSize(64, 64); this.box.addBox(0, 0, 0, 16, 24, 16); diff --git a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderStub.java b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderStub.java index 394d8bdb..617036b2 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderStub.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderStub.java @@ -1,6 +1,6 @@ package de.ellpeck.naturesaura.entities.render; -import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.ClippingHelper; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.texture.AtlasTexture; @@ -13,7 +13,7 @@ public class RenderStub extends EntityRenderer { } @Override - public boolean shouldRender(Entity livingEntityIn, ClippingHelperImpl camera, double camX, double camY, double camZ) { + public boolean shouldRender(Entity livingEntityIn, ClippingHelper camera, double camX, double camY, double camZ) { return false; } diff --git a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java index e9e1aa09..2db9ad10 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.events; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.naturesaura.Helper; @@ -31,15 +32,18 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IReorderingProcessor; +import net.minecraft.util.RegistryKey; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.*; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeColors; -import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.Heightmap; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -71,25 +75,6 @@ public class ClientEvents { private static ItemStack heldEye = ItemStack.EMPTY; private static ItemStack heldOcular = ItemStack.EMPTY; - @SubscribeEvent - public void onTooltip(ItemTooltipEvent event) { - if (ModList.get().isLoaded("enchdesc")) - return; - ItemStack stack = event.getItemStack(); - List tooltip = event.getToolTip(); - for (Map.Entry entry : EnchantmentHelper.getEnchantments(stack).entrySet()) { - Enchantment enchantment = entry.getKey(); - if (!(enchantment instanceof ModEnchantment)) - continue; - String info = I18n.format(enchantment.getName() + ".desc"); - List split = Minecraft.getInstance().fontRenderer.listFormattedStringToWidth(info, 250); - ITextComponent name = enchantment.getDisplayName(entry.getValue()); - int addIndex = tooltip.indexOf(name) + 1; - for (int i = split.size() - 1; i >= 0; i--) - tooltip.add(addIndex, new StringTextComponent(TextFormatting.DARK_GRAY + split.get(i))); - } - } - @SubscribeEvent public void onDebugRender(RenderGameOverlayEvent.Text event) { Minecraft mc = Minecraft.getInstance(); @@ -152,7 +137,7 @@ public class ClientEvents { mc.world.rand.nextGaussian() * 0.01F, mc.world.rand.nextFloat() * 0.025F, mc.world.rand.nextGaussian() * 0.01F, - BiomeColors.func_228361_b_(mc.world, pos), + BiomeColors.getGrassColor(mc.world, pos), Math.min(2F, 1F + mc.world.rand.nextFloat() * (excess / 30000F)), Math.min(300, 100 + mc.world.rand.nextInt(excess / 3000 + 1)), 0F, false, true); @@ -165,7 +150,7 @@ public class ClientEvents { NaturesAuraAPI.IInternalHooks inst = NaturesAuraAPI.instance(); inst.setParticleSpawnRange(512); inst.setParticleDepth(false); - for (BlockPos pos : ItemRangeVisualizer.VISUALIZED_RAILS.get(mc.world.getDimension().getType())) { + for (BlockPos pos : ItemRangeVisualizer.VISUALIZED_RAILS.get(mc.world.func_234923_W_())) { NaturesAuraAPI.instance().spawnMagicParticle( pos.getX() + mc.world.rand.nextFloat(), pos.getY() + mc.world.rand.nextFloat(), @@ -195,13 +180,14 @@ public class ClientEvents { @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { Minecraft mc = Minecraft.getInstance(); + MatrixStack stack = event.getMatrixStack(); ParticleHandler.renderParticles(event.getMatrixStack(), mc.getRenderPartialTicks()); RenderSystem.pushMatrix(); - RenderSystem.multMatrix(event.getMatrixStack().getLast().getPositionMatrix()); + RenderSystem.multMatrix(event.getMatrixStack().getLast().getMatrix()); ActiveRenderInfo info = mc.gameRenderer.getActiveRenderInfo(); - Vec3d view = info.getProjectedView(); + Vector3d view = info.getProjectedView(); GL11.glTranslated(-view.getX(), -view.getY(), -view.getZ()); if (mc.gameSettings.showDebugInfo && mc.player.isCreative() && ModConfig.instance.debugWorld.get()) { @@ -230,7 +216,7 @@ public class ClientEvents { RenderSystem.translated((pos.getX() + 0.1) / scale, (pos.getY() + 1.001) / scale, (pos.getZ() + 0.1) / scale); RenderSystem.rotatef(90F, 1F, 0F, 0F); RenderSystem.scalef(0.65F, 0.65F, 0.65F); - mc.fontRenderer.drawString(format.format(spot.getValue()), 0, 0, 0); + mc.fontRenderer.drawString(stack,format.format(spot.getValue()), 0, 0, 0); RenderSystem.popMatrix(); } @@ -239,7 +225,7 @@ public class ClientEvents { } if (Helper.isHoldingItem(mc.player, ModItems.RANGE_VISUALIZER)) { - DimensionType dim = mc.world.getDimension().getType(); + RegistryKey dim = mc.world.func_234923_W_(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); @@ -283,6 +269,7 @@ public class ClientEvents { @SubscribeEvent public void onOverlayRender(RenderGameOverlayEvent.Post event) { Minecraft mc = Minecraft.getInstance(); + MatrixStack stack = event.getMatrixStack(); if (event.getType() == ElementType.ALL) { MainWindow res = event.getWindow(); if (mc.player != null) { @@ -300,14 +287,14 @@ public class ClientEvents { RenderSystem.color4f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1); mc.getTextureManager().bindTexture(OVERLAYS); if (width < 80) - AbstractGui.blit(x + width, y, width, 0, 80 - width, 6, 256, 256); + AbstractGui.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256); if (width > 0) - AbstractGui.blit(x, y, 0, 6, width, 6, 256, 256); + AbstractGui.blit(stack, x, y, 0, 6, width, 6, 256, 256); float scale = 0.75F; RenderSystem.scalef(scale, scale, scale); - String s = heldCache.getDisplayName().getFormattedText(); - mc.fontRenderer.drawStringWithShadow(s, conf == 1 ? x / scale : (x + 80) / scale - mc.fontRenderer.getStringWidth(s), (y - 7) / scale, color); + String s = heldCache.getDisplayName().getString(); + mc.fontRenderer.drawStringWithShadow(stack, s, conf == 1 ? x / scale : (x + 80) / scale - mc.fontRenderer.getStringWidth(s), (y - 7) / scale, color); RenderSystem.color4f(1F, 1F, 1F, 1); RenderSystem.popMatrix(); @@ -336,33 +323,33 @@ public class ClientEvents { int tHeight = MathHelper.ceil(MathHelper.clamp(totalPercentage, 0F, 1F) * 50); int y = !heldOcular.isEmpty() && totalPercentage > 1F ? startY + 26 : startY; if (tHeight < 50) - AbstractGui.blit(startX, y, 6, 12, 6, 50 - tHeight, 256, 256); + AbstractGui.blit(stack, startX, y, 6, 12, 6, 50 - tHeight, 256, 256); if (tHeight > 0) - AbstractGui.blit(startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256); + AbstractGui.blit(stack, startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256); if (!heldOcular.isEmpty()) { int topHeight = MathHelper.ceil(MathHelper.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25); if (topHeight > 0) { if (topHeight < 25) - AbstractGui.blit(startX, startY, 18, 12, 6, 25 - topHeight, 256, 256); - AbstractGui.blit(startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256); + AbstractGui.blit(stack, startX, startY, 18, 12, 6, 25 - topHeight, 256, 256); + AbstractGui.blit(stack, startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256); } int bottomHeight = MathHelper.floor(MathHelper.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25); if (bottomHeight < 25) { - AbstractGui.blit(startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256); + AbstractGui.blit(stack, startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256); if (bottomHeight > 0) - AbstractGui.blit(startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256); + AbstractGui.blit(stack, startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256); } } if (totalPercentage > (heldOcular.isEmpty() ? 1F : 1.5F)) - mc.fontRenderer.drawStringWithShadow("+", startX + plusOffX, startY - 0.5F, color); + mc.fontRenderer.drawStringWithShadow(stack, "+", startX + plusOffX, startY - 0.5F, color); if (totalPercentage < (heldOcular.isEmpty() ? 0F : -0.5F)) - mc.fontRenderer.drawStringWithShadow("-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color); + mc.fontRenderer.drawStringWithShadow(stack, "-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color); RenderSystem.pushMatrix(); RenderSystem.scalef(textScale, textScale, textScale); - mc.fontRenderer.drawStringWithShadow(text, textX / textScale, textY / textScale, color); + mc.fontRenderer.drawStringWithShadow(stack, text, textX / textScale, textY / textScale, color); RenderSystem.popMatrix(); if (!heldOcular.isEmpty()) { @@ -374,12 +361,12 @@ public class ClientEvents { for (Tuple effect : SHOWING_EFFECTS.values()) { int theX = (int) (stackX / scale); int theY = (int) (stackY / scale); - ItemStack stack = effect.getA(); - Helper.renderItemInGui(stack, theX, theY, 1F); + ItemStack itemStack = effect.getA(); + Helper.renderItemInGui(itemStack, theX, theY, 1F); if (effect.getB()) { GlStateManager.disableDepthTest(); mc.getTextureManager().bindTexture(OVERLAYS); - AbstractGui.blit(theX, theY, 240, 0, 16, 16, 256, 256); + AbstractGui.blit(stack, theX, theY, 240, 0, 16, 16, 256, 256); GlStateManager.enableDepthTest(); } stackY += 8; @@ -398,40 +385,40 @@ public class ClientEvents { if (tile != null && (container = tile.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null)) != null) { BlockState state = mc.world.getBlockState(pos); ItemStack blockStack = state.getBlock().getPickBlock(state, mc.objectMouseOver, mc.world, pos, mc.player); - this.drawContainerInfo(container.getStoredAura(), container.getMaxAura(), container.getAuraColor(), - mc, res, 35, blockStack.getDisplayName().getFormattedText(), null); + this.drawContainerInfo(stack,container.getStoredAura(), container.getMaxAura(), container.getAuraColor(), + mc, res, 35, blockStack.getDisplayName().getString(), null); if (tile instanceof TileEntityNatureAltar) { ItemStack tileStack = ((TileEntityNatureAltar) tile).getItemHandler(null).getStackInSlot(0); if (!tileStack.isEmpty()) { IAuraContainer stackCont = tileStack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null); if (stackCont != null) { - this.drawContainerInfo(stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(), - mc, res, 55, tileStack.getDisplayName().getFormattedText(), null); + this.drawContainerInfo(stack,stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(), + mc, res, 55, tileStack.getDisplayName().getString(), null); } } } } else if (tile instanceof TileEntityRFConverter) { EnergyStorage storage = ((TileEntityRFConverter) tile).storage; - this.drawContainerInfo(storage.getEnergyStored(), storage.getMaxEnergyStored(), 0xcc4916, + this.drawContainerInfo(stack,storage.getEnergyStored(), storage.getMaxEnergyStored(), 0xcc4916, mc, res, 35, I18n.format("tile.naturesaura.rf_converter.name"), storage.getEnergyStored() + " / " + storage.getMaxEnergyStored() + " RF"); } else if (tile instanceof TileEntityGratedChute) { TileEntityGratedChute chute = (TileEntityGratedChute) tile; - ItemStack stack = chute.getItemHandler(null).getStackInSlot(0); + ItemStack itemStack = chute.getItemHandler(null).getStackInSlot(0); - if (stack.isEmpty()) - mc.fontRenderer.drawStringWithShadow( + if (itemStack.isEmpty()) + mc.fontRenderer.drawStringWithShadow(stack, TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.format("info.naturesaura.empty"), x + 5, y - 11, 0xFFFFFF); else - Helper.renderItemInGui(stack, x + 2, y - 18, 1F); + Helper.renderItemInGui(itemStack, x + 2, y - 18, 1F); Helper.renderItemInGui(ITEM_FRAME, x - 24, y - 24, 1F); mc.getTextureManager().bindTexture(OVERLAYS); int u = chute.isBlacklist ? 240 : 224; GlStateManager.disableDepthTest(); - AbstractGui.blit(x - 18, y - 18, u, 0, 16, 16, 256, 256); + AbstractGui.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256); GlStateManager.enableDepthTest(); } else if (tile instanceof TileEntityItemDistributor) { TileEntityItemDistributor distributor = (TileEntityItemDistributor) tile; @@ -439,15 +426,15 @@ public class ClientEvents { mc.getTextureManager().bindTexture(OVERLAYS); int u = !distributor.isRandomMode ? 240 : 224; GlStateManager.disableDepthTest(); - AbstractGui.blit(x - 18, y - 18, u, 0, 16, 16, 256, 256); + AbstractGui.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256); GlStateManager.enableDepthTest(); } else if (tile instanceof TileEntityAuraTimer) { TileEntityAuraTimer timer = (TileEntityAuraTimer) tile; - ItemStack stack = timer.getItemHandler(null).getStackInSlot(0); - if (!stack.isEmpty()) { - Helper.renderItemInGui(stack, x - 20, y - 20, 1); - mc.fontRenderer.drawStringWithShadow(TextFormatting.GRAY + this.createTimeString(timer.getTotalTime()), x + 5, y - 11, 0xFFFFFF); - mc.fontRenderer.drawStringWithShadow(TextFormatting.GRAY + I18n.format("info.naturesaura.remaining", this.createTimeString(timer.getTimeLeft())), x + 5, y + 3, 0xFFFFFF); + ItemStack itemStack = timer.getItemHandler(null).getStackInSlot(0); + if (!itemStack.isEmpty()) { + Helper.renderItemInGui(itemStack, x - 20, y - 20, 1); + mc.fontRenderer.drawStringWithShadow(stack,TextFormatting.GRAY + this.createTimeString(timer.getTotalTime()), x + 5, y - 11, 0xFFFFFF); + mc.fontRenderer.drawStringWithShadow(stack,TextFormatting.GRAY + I18n.format("info.naturesaura.remaining", this.createTimeString(timer.getTimeLeft())), x + 5, y + 3, 0xFFFFFF); } } } @@ -468,7 +455,7 @@ public class ClientEvents { return String.format("%02d:%02d:%02d.%02d", hours, minutes, seconds, ticks); } - private void drawContainerInfo(int stored, int max, int color, Minecraft mc, MainWindow res, int yOffset, String name, String textBelow) { + private void drawContainerInfo(MatrixStack stack, int stored, int max, int color, Minecraft mc, MainWindow res, int yOffset, String name, String textBelow) { RenderSystem.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F); int x = res.getScaledWidth() / 2 - 40; @@ -477,13 +464,13 @@ public class ClientEvents { mc.getTextureManager().bindTexture(OVERLAYS); if (width < 80) - AbstractGui.blit(x + width, y, width, 0, 80 - width, 6, 256, 256); + AbstractGui.blit(stack,x + width, y, width, 0, 80 - width, 6, 256, 256); if (width > 0) - AbstractGui.blit(x, y, 0, 6, width, 6, 256, 256); + AbstractGui.blit(stack,x, y, 0, 6, width, 6, 256, 256); - mc.fontRenderer.drawStringWithShadow(name, x + 40 - mc.fontRenderer.getStringWidth(name) / 2F, y - 9, color); + mc.fontRenderer.drawStringWithShadow(stack,name, x + 40 - mc.fontRenderer.getStringWidth(name) / 2F, y - 9, color); if (textBelow != null) - mc.fontRenderer.drawStringWithShadow(textBelow, x + 40 - mc.fontRenderer.getStringWidth(textBelow) / 2F, y + 7, color); + mc.fontRenderer.drawStringWithShadow(stack,textBelow, x + 40 - mc.fontRenderer.getStringWidth(textBelow) / 2F, y + 7, color); } } diff --git a/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java b/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java index 9931b957..e89116ce 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java @@ -134,6 +134,6 @@ public class CommonEvents { @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { - CommandAura.register(event.getCommandDispatcher()); + CommandAura.register(event.getServer().getCommandManager().getDispatcher()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/gen/ModFeatures.java b/src/main/java/de/ellpeck/naturesaura/gen/ModFeatures.java index ce2fd77b..fb9a1049 100644 --- a/src/main/java/de/ellpeck/naturesaura/gen/ModFeatures.java +++ b/src/main/java/de/ellpeck/naturesaura/gen/ModFeatures.java @@ -1,13 +1,14 @@ package de.ellpeck.naturesaura.gen; +import net.minecraft.world.gen.feature.BaseTreeFeatureConfig; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.NoFeatureConfig; -import net.minecraft.world.gen.feature.TreeFeatureConfig; +import net.minecraft.world.gen.feature.TreeFeature; @SuppressWarnings("FieldNamingConvention") public final class ModFeatures { - public static Feature ANCIENT_TREE; + public static Feature ANCIENT_TREE; public static Feature NETHER_WART_MUSHROOM; public static Feature AURA_BLOOM; public static Feature AURA_CACTUS; diff --git a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java index daccb074..37d17d88 100644 --- a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java +++ b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java @@ -1,36 +1,42 @@ package de.ellpeck.naturesaura.gen; +import com.mojang.serialization.Codec; import de.ellpeck.naturesaura.blocks.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.block.LogBlock; +import net.minecraft.block.RotatedPillarBlock; +import net.minecraft.block.material.Material; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MutableBoundingBox; +import net.minecraft.world.ISeedReader; +import net.minecraft.world.IWorldWriter; +import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.gen.IWorldGenerationReader; -import net.minecraft.world.gen.feature.AbstractTreeFeature; -import net.minecraft.world.gen.feature.TreeFeatureConfig; +import net.minecraft.world.gen.feature.BaseTreeFeatureConfig; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.TreeFeature; import java.util.Random; import java.util.Set; -public class WorldGenAncientTree extends AbstractTreeFeature { +public class WorldGenAncientTree extends Feature { // what the heck even is this - public static final TreeFeatureConfig CONFIG = new TreeFeatureConfig.Builder(null, null, null).build(); + public static final BaseTreeFeatureConfig CONFIG = new BaseTreeFeatureConfig.Builder(null, null, null, null, null).build(); public WorldGenAncientTree() { - super(d -> CONFIG); + super(Codec.unit(CONFIG)); } @Override - protected boolean func_225557_a_(IWorldGenerationReader world, Random rand, BlockPos pos, Set cb1, Set cb2, MutableBoundingBox box, TreeFeatureConfig config) { + public boolean func_241855_a(ISeedReader world, ChunkGenerator generator, Random rand, BlockPos pos, BaseTreeFeatureConfig p_241855_5_) { int height = rand.nextInt(3) + 5; BlockPos trunkTop = pos.up(height); - this.setBlockState(world, pos, Blocks.AIR.getDefaultState()); + this.func_230367_a_(world, pos, Blocks.AIR.getDefaultState()); //Roots int rootsAmount = rand.nextInt(4) + 5; for (int i = 0; i < rootsAmount; i++) { @@ -45,7 +51,7 @@ public class WorldGenAncientTree extends AbstractTreeFeature if (goal.distanceSq(pos) >= 10 * 10) break; } - this.makeBranch(cb1, world, pos.up(rand.nextInt(1)), goal, ModBlocks.ANCIENT_BARK.getDefaultState(), false); + this.makeBranch(world, pos.up(rand.nextInt(1)), goal, ModBlocks.ANCIENT_BARK.getDefaultState(), false); } //Trunk @@ -53,14 +59,13 @@ public class WorldGenAncientTree extends AbstractTreeFeature for (int z = 0; z <= 1; z++) { for (int i = height - (x + z) * (rand.nextInt(2) + 2); i >= 0; i--) { BlockPos goal = pos.add(x, i, z); - if (func_214587_a(world, goal)) { - this.setBlockState(world, goal, ModBlocks.ANCIENT_LOG.getDefaultState().with(LogBlock.AXIS, Axis.Y)); - cb1.add(goal); + if (!world.hasBlockState(goal, s -> !s.canBeReplacedByLogs(world, goal))) { + this.func_230367_a_(world, goal, ModBlocks.ANCIENT_LOG.getDefaultState().with(RotatedPillarBlock.AXIS, Axis.Y)); } } } } - this.makeLeaves(cb2, world, trunkTop.up(rand.nextInt(2) - 1), ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 3, rand); + this.makeLeaves(world, trunkTop.up(rand.nextInt(2) - 1), ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 3, rand); //Branches int branchAmount = rand.nextInt(3) + 4; @@ -71,14 +76,14 @@ public class WorldGenAncientTree extends AbstractTreeFeature float z = (float) Math.cos(angle) * length; BlockPos goal = trunkTop.add(x, rand.nextInt(3) + 1, z); - this.makeBranch(cb1, world, trunkTop, goal, ModBlocks.ANCIENT_LOG.getDefaultState(), true); - this.makeLeaves(cb2, world, goal, ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 2, rand); + this.makeBranch(world, trunkTop, goal, ModBlocks.ANCIENT_LOG.getDefaultState(), true); + this.makeLeaves(world, goal, ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 2, rand); } return true; } - private void makeBranch(Set changedBlocks, IWorldGenerationReader world, BlockPos first, BlockPos second, BlockState state, boolean hasAxis) { + private void makeBranch(ISeedReader world, BlockPos first, BlockPos second, BlockState state, boolean hasAxis) { BlockPos pos = second.add(-first.getX(), -first.getY(), -first.getZ()); int length = this.getHighestCoord(pos); float stepX = (float) pos.getX() / (float) length; @@ -87,31 +92,29 @@ public class WorldGenAncientTree extends AbstractTreeFeature for (int i = 0; i <= length; i++) { BlockPos goal = first.add(0.5F + i * stepX, 0.5F + i * stepY, 0.5F + i * stepZ); - if (func_214587_a(world, goal)) { + if (!world.hasBlockState(goal, s -> !s.canBeReplacedByLogs(world, goal))) { if (hasAxis) { Axis axis = this.getLogAxis(first, goal); - this.setBlockState(world, goal, state.with(LogBlock.AXIS, axis)); + this.func_230367_a_(world, goal, state.with(RotatedPillarBlock.AXIS, axis)); } else { - this.setBlockState(world, goal, state); + this.func_230367_a_(world, goal, state); } - changedBlocks.add(goal); } } } - private void makeLeaves(Set changedBlocks, IWorldGenerationReader world, BlockPos pos, BlockState state, int radius, Random rand) { + private void makeLeaves(IWorldGenerationReader world, BlockPos pos, BlockState state, int radius, Random rand) { for (int x = -radius; x <= radius; x++) { for (int y = -radius; y <= radius; y++) { for (int z = -radius; z <= radius; z++) { BlockPos goal = pos.add(x, y, z); if (pos.distanceSq(goal) <= radius * radius + rand.nextInt(3) - 1) { - if (isAirOrLeaves(world, goal)) { + if (!world.hasBlockState(goal, s -> s.getMaterial() == Material.LEAVES)) { if (world.hasBlockState(goal, st -> { Block block = st.getBlock(); - return !(block instanceof LogBlock) && block != Blocks.DIRT && block != Blocks.GRASS; + return st.getMaterial() != Material.WOOD && block != Blocks.DIRT && block != Blocks.GRASS; })) { - this.setBlockState(world, goal, state); - changedBlocks.add(goal); + this.func_230367_a_(world, goal, state); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAuraBloom.java b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAuraBloom.java index 2ddc4aa1..1d862ee1 100644 --- a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAuraBloom.java +++ b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAuraBloom.java @@ -1,14 +1,15 @@ package de.ellpeck.naturesaura.gen; +import com.mojang.serialization.Codec; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.world.ISeedReader; import net.minecraft.world.IWorld; import net.minecraft.world.gen.ChunkGenerator; -import net.minecraft.world.gen.GenerationSettings; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.IFeatureConfig; @@ -21,12 +22,12 @@ public class WorldGenAuraBloom extends Feature { private final Block block; public WorldGenAuraBloom(Block block) { - super(d -> IFeatureConfig.NO_FEATURE_CONFIG); + super(Codec.unit(IFeatureConfig.NO_FEATURE_CONFIG)); this.block = block; } @Override - public boolean place(IWorld worldIn, ChunkGenerator generator, Random rand, BlockPos pos, NoFeatureConfig config) { + public boolean func_241855_a(ISeedReader worldIn, ChunkGenerator gen, Random rand, BlockPos pos, NoFeatureConfig p_241855_5_) { if (rand.nextInt(60) != 0) return false; diff --git a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenNetherWartMushroom.java b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenNetherWartMushroom.java index dd82498a..0a40de61 100644 --- a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenNetherWartMushroom.java +++ b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenNetherWartMushroom.java @@ -1,13 +1,15 @@ package de.ellpeck.naturesaura.gen; +import com.mojang.serialization.Codec; import de.ellpeck.naturesaura.blocks.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ISeedReader; import net.minecraft.world.IWorld; import net.minecraft.world.gen.ChunkGenerator; -import net.minecraft.world.gen.GenerationSettings; import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.NoFeatureConfig; import java.util.Random; @@ -15,11 +17,11 @@ import java.util.Random; public class WorldGenNetherWartMushroom extends Feature { public WorldGenNetherWartMushroom() { - super(d -> NoFeatureConfig.NO_FEATURE_CONFIG); + super(Codec.unit(IFeatureConfig.NO_FEATURE_CONFIG)); } @Override - public boolean place(IWorld worldIn, ChunkGenerator generator, Random rand, BlockPos pos, NoFeatureConfig config) { + public boolean func_241855_a(ISeedReader worldIn, ChunkGenerator gen, Random rand, BlockPos pos, NoFeatureConfig p_241855_5_) { int height = rand.nextInt(5) + 4; if (rand.nextInt(10) == 0) height += 5; @@ -32,7 +34,7 @@ public class WorldGenNetherWartMushroom extends Feature { } // Place stem - this.setBlockState(worldIn, pos, Blocks.AIR.getDefaultState()); + this.func_230367_a_(worldIn, pos, Blocks.AIR.getDefaultState()); for (int i = 0; i < height; i++) this.placeIfPossible(worldIn, pos.up(i), Blocks.NETHER_WART_BLOCK); diff --git a/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java index 7c32d8b7..c90edd5c 100644 --- a/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java @@ -1,5 +1,6 @@ package de.ellpeck.naturesaura.gui; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.entity.player.PlayerEntity; @@ -21,25 +22,25 @@ public class GuiEnderCrate extends ContainerScreen { } @Override - public void render(int mouseX, int mouseY, float partialTicks) { - this.renderBackground(); - super.render(mouseX, mouseY, partialTicks); - this.renderHoveredToolTip(mouseX, mouseY); + public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(matrixStack); + super.render(matrixStack, mouseX, mouseY, partialTicks); + this.func_230459_a_(matrixStack, mouseX, mouseY); } @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - this.font.drawString(this.title.getFormattedText(), 8, 6, 4210752); - this.font.drawString(this.player.inventory.getDisplayName().getFormattedText(), 8, this.ySize - 96 + 2, 4210752); + protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int mouseX, int mouseY) { + this.font.drawString(matrixStack, this.title.getString(), 8, 6, 4210752); + this.font.drawString(matrixStack, this.player.inventory.getDisplayName().getString(), 8, this.ySize - 96 + 2, 4210752); } @Override - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { + protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.getMinecraft().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; - this.blit(i, j, 0, 0, this.xSize, 3 * 18 + 17); - this.blit(i, j + 3 * 18 + 17, 0, 126, this.xSize, 96); + this.blit(matrixStack, i, j, 0, 0, this.xSize, 3 * 18 + 17); + this.blit(matrixStack, i, j + 3 * 18 + 17, 0, 126, this.xSize, 96); } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java index d7146d3a..10fbe3e0 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java @@ -11,7 +11,6 @@ import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.enchant.ModEnchantments; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.enchantment.EnchantmentHelper; @@ -23,6 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.Direction; import net.minecraft.util.NonNullList; +import net.minecraft.util.math.vector.Vector3f; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -46,7 +46,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem { public void inventoryTick(ItemStack stackIn, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (!worldIn.isRemote && entityIn instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) entityIn; - if (player.isShiftKeyDown() && stackIn.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) { + if (player.isSneaking() && stackIn.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) { IAuraContainer container = stackIn.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null); if (container.getStoredAura() <= 0) { return; @@ -122,7 +122,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem { matrices.translate(-0.15F, 0.65F, chest ? -0.195F : legs ? -0.165F : -0.1475F); matrices.scale(0.5F, 0.5F, 0.5F); matrices.rotate(Vector3f.XP.rotationDegrees(180F)); - Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.DEFAULT_LIGHT, matrices, buffer); + Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrices, buffer); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java b/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java index 5de5dd4d..20ff0ac4 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java @@ -7,10 +7,7 @@ import net.minecraft.item.ElytraItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.util.text.*; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -65,12 +62,14 @@ public class ItemBreakPrevention extends ItemImpl { if (!stack.hasTag() || !stack.getTag().getBoolean(NaturesAura.MOD_ID + ":break_prevention")) return; List tooltip = event.getToolTip(); - tooltip.add(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".break_prevention").setStyle(new Style().setColor(TextFormatting.GRAY))); + tooltip.add(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".break_prevention").setStyle(Style.EMPTY.setFormatting(TextFormatting.GRAY))); if (ElytraItem.isUsable(stack)) return; if (tooltip.size() < 1) return; - tooltip.get(0).appendSibling(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".broken").setStyle(new Style().setColor(TextFormatting.GRAY))); + ITextComponent head = tooltip.get(0); + if (head instanceof TextComponent) + ((TextComponent) head).append(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".broken").setStyle(Style.EMPTY.setFormatting(TextFormatting.GRAY))); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java index 1b42fefa..47b5e9d1 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java @@ -25,10 +25,11 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I public ItemColorChanger() { super("color_changer", new Properties().maxStackSize(1)); - this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "fill_mode"), + // TODO move to using ItemModelsProperties.func_239418_a_ it seems like + /*this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "fill_mode"), (stack, worldIn, entityIn) -> isFillMode(stack) ? 1F : 0F); this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "has_color"), - (stack, worldIn, entityIn) -> getStoredColor(stack) != null ? 1F : 0F); + (stack, worldIn, entityIn) -> getStoredColor(stack) != null ? 1F : 0F);*/ } private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) { @@ -39,7 +40,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I DyeColor color = DyeColor.byId(blocks.indexOf(block)); if (firstColor == null || color == firstColor) { DyeColor stored = getStoredColor(stack); - if (player.isShiftKeyDown()) { + if (player.isSneaking()) { if (stored != color) { world.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.PLAYERS, 0.65F, 1F); @@ -109,7 +110,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I @Override public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); - if (playerIn.isShiftKeyDown() && getStoredColor(stack) != null) { + if (playerIn.isSneaking() && getStoredColor(stack) != null) { worldIn.playSound(playerIn, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F); if (!worldIn.isRemote) { setFillMode(stack, !isFillMode(stack)); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemCrimsonMeal.java b/src/main/java/de/ellpeck/naturesaura/items/ItemCrimsonMeal.java index 74b6ccb3..5fc195db 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemCrimsonMeal.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemCrimsonMeal.java @@ -27,7 +27,7 @@ public class ItemCrimsonMeal extends ItemImpl { if (world.rand.nextInt(5) == 0) { int age = state.get(NetherWartBlock.AGE); if (age >= 3) { - ModFeatures.NETHER_WART_MUSHROOM.place(world, ((ServerWorld) world).getChunkProvider().getChunkGenerator(), world.rand, pos, IFeatureConfig.NO_FEATURE_CONFIG); + ModFeatures.NETHER_WART_MUSHROOM.func_241855_a((ServerWorld) world, ((ServerWorld) world).getChunkProvider().getChunkGenerator(), world.rand, pos, IFeatureConfig.NO_FEATURE_CONFIG); } else { world.setBlockState(pos, state.with(NetherWartBlock.AGE, age + 1)); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java b/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java index a6859765..31ca19ab 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java @@ -11,7 +11,7 @@ import net.minecraft.item.ItemUseContext; import net.minecraft.util.ActionResultType; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; @@ -42,7 +42,7 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem { public ActionResultType onItemUse(ItemUseContext context) { World world = context.getWorld(); if (!world.isRemote) { - Vec3d hit = context.getHitVec(); + Vector3d hit = context.getHitVec(); ItemStack stack = context.getPlayer().getHeldItem(context.getHand()); EntityEffectInhibitor.place(world, stack, hit.x, hit.y + 1, hit.z); stack.setCount(0); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java b/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java index 9ecc27b1..acd6557e 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java @@ -5,12 +5,12 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.render.ITrinketItem; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -28,7 +28,7 @@ public class ItemEye extends ItemImpl implements ITrinketItem { matrices.translate(0.1F, 0.225F, armor ? -0.195F : -0.1475F); matrices.scale(0.3F, 0.3F, 0.3F); matrices.rotate(Vector3f.XP.rotationDegrees(180)); - Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.DEFAULT_LIGHT, matrices, buffer); + Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrices, buffer); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemLightStaff.java b/src/main/java/de/ellpeck/naturesaura/items/ItemLightStaff.java index 170cc366..714778e2 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemLightStaff.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemLightStaff.java @@ -20,7 +20,7 @@ public class ItemLightStaff extends ItemImpl { ItemStack stack = playerIn.getHeldItem(handIn); if (!worldIn.isRemote && NaturesAuraAPI.instance().extractAuraFromPlayer(playerIn, 1000, false)) { EntityLightProjectile projectile = new EntityLightProjectile(ModEntities.LIGHT_PROJECTILE, playerIn, worldIn); - projectile.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0, 1.5F, 0); + projectile.func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0, 1.5F, 0); worldIn.addEntity(projectile); } return new ActionResult<>(ActionResultType.SUCCESS, stack); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java b/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java index b60783b0..6b93050c 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java @@ -10,6 +10,7 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponent; import net.minecraft.world.World; import java.util.ArrayList; @@ -72,11 +73,11 @@ public class ItemMultiblockMaker extends ItemImpl { @Override public ITextComponent getDisplayName(ItemStack stack) { - ITextComponent name = super.getDisplayName(stack); + TextComponent name = (TextComponent) super.getDisplayName(stack); int id = getMultiblock(stack); if (id < 0) return name; IMultiblock multi = multiblocks().get(id); - return multi == null ? name : name.appendText(" (" + multi.getName() + ")"); + return multi == null ? name : name.appendString(" (" + multi.getName() + ")"); } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java b/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java index 9ab5c541..f6cbe6a4 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java @@ -13,19 +13,19 @@ import net.minecraft.item.ItemUseContext; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; +import net.minecraft.util.RegistryKey; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class ItemRangeVisualizer extends ItemImpl { - public static final ListMultimap VISUALIZED_BLOCKS = ArrayListMultimap.create(); - public static final ListMultimap VISUALIZED_ENTITIES = ArrayListMultimap.create(); - public static final ListMultimap VISUALIZED_RAILS = ArrayListMultimap.create(); + public static final ListMultimap, BlockPos> VISUALIZED_BLOCKS = ArrayListMultimap.create(); + public static final ListMultimap, Entity> VISUALIZED_ENTITIES = ArrayListMultimap.create(); + public static final ListMultimap, BlockPos> VISUALIZED_RAILS = ArrayListMultimap.create(); public ItemRangeVisualizer() { super("range_visualizer", new Properties().maxStackSize(1)); @@ -41,7 +41,7 @@ public class ItemRangeVisualizer extends ItemImpl { VISUALIZED_RAILS.clear(); } - public static void visualize(PlayerEntity player, ListMultimap map, DimensionType dim, T value) { + public static void visualize(PlayerEntity player, ListMultimap, T> map, RegistryKey dim, T value) { if (map.containsEntry(dim, value)) { map.remove(dim, value); player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end"), true); @@ -54,7 +54,7 @@ public class ItemRangeVisualizer extends ItemImpl { @Override public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); - if (playerIn.isShiftKeyDown()) { + if (playerIn.isSneaking()) { clear(); playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end_all"), true); return new ActionResult<>(ActionResultType.SUCCESS, stack); @@ -70,7 +70,7 @@ public class ItemRangeVisualizer extends ItemImpl { Block block = state.getBlock(); if (block instanceof IVisualizable) { if (world.isRemote) - visualize(context.getPlayer(), VISUALIZED_BLOCKS, world.getDimension().getType(), pos); + visualize(context.getPlayer(), VISUALIZED_BLOCKS, world.func_234923_W_(), pos); return ActionResultType.SUCCESS; } return ActionResultType.PASS; @@ -86,7 +86,7 @@ public class ItemRangeVisualizer extends ItemImpl { Entity entity = event.getTarget(); if (entity instanceof IVisualizable) { if (entity.world.isRemote) { - DimensionType dim = entity.world.getDimension().getType(); + RegistryKey dim = entity.world.func_234923_W_(); visualize(event.getPlayer(), VISUALIZED_ENTITIES, dim, entity); } event.getPlayer().swingArm(event.getHand()); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java index eec6014c..86292216 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java @@ -13,7 +13,6 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.entity.Entity; @@ -28,6 +27,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.vector.Vector3f; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -45,7 +45,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { if (worldIn.isRemote || !(entityIn instanceof LivingEntity)) return; LivingEntity living = (LivingEntity) entityIn; - if (!living.onGround) { + if (!living.isOnGround()) { CompoundNBT compound = stack.getOrCreateTag(); if (compound.getBoolean("air")) return; @@ -63,7 +63,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { compound.putBoolean("air", false); - if (!living.isShiftKeyDown()) + if (!living.isSneaking()) return; if (living.getDistanceSq(compound.getDouble("x"), compound.getDouble("y"), compound.getDouble("z")) > 0.75F) return; @@ -115,7 +115,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { matrices.translate(0, 0.125F, armor ? -0.195F : -0.1475F); matrices.scale(0.3F, 0.3F, 0.3F); matrices.rotate(Vector3f.XP.rotationDegrees(180)); - Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.DEFAULT_LIGHT, matrices, buffer); + Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrices, buffer); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java b/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java index 95ecde7b..a17934cd 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemStructureFinder.java @@ -9,13 +9,14 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.server.ServerWorld; public class ItemStructureFinder extends ItemImpl { - private final String structureName; + private final Structure structureName; private final int color; - public ItemStructureFinder(String baseName, String structureName, int color) { + public ItemStructureFinder(String baseName, Structure structureName, int color) { super(baseName); this.structureName = structureName; this.color = color; @@ -25,7 +26,7 @@ public class ItemStructureFinder extends ItemImpl { public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); if (!worldIn.isRemote) { - BlockPos pos = ((ServerWorld) worldIn).getChunkProvider().getChunkGenerator().findNearestStructure(worldIn, this.structureName, playerIn.getPosition(), 1024, false); + BlockPos pos = ((ServerWorld) worldIn).getChunkProvider().getChunkGenerator().func_235956_a_((ServerWorld) worldIn, this.structureName, playerIn.getPosition(), 1024, false); if (pos != null) { EntityStructureFinder entity = new EntityStructureFinder(ModEntities.STRUCTURE_FINDER, worldIn); entity.setPosition(playerIn.getPosX(), playerIn.getPosYHeight(0.5D), playerIn.getPosZ()); diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java index 9e4d5bd2..cb2f072d 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java @@ -7,9 +7,9 @@ import de.ellpeck.naturesaura.reg.ModArmorMaterial; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.Attributes; +import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.*; @@ -81,7 +81,7 @@ public class ItemArmor extends ArmorItem implements IModItem { @SubscribeEvent public void update(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; - IAttributeInstance speed = player.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); + ModifiableAttributeInstance speed = player.getAttribute(Attributes.MOVEMENT_SPEED); String key = NaturesAura.MOD_ID + ":sky_equipped"; CompoundNBT nbt = player.getPersistentData(); boolean equipped = isFullSetEquipped(player, ModArmorMaterial.SKY); @@ -90,7 +90,7 @@ public class ItemArmor extends ArmorItem implements IModItem { nbt.putBoolean(key, true); player.stepHeight = 1.1F; if (!speed.hasModifier(SKY_MOVEMENT_MODIFIER)) - speed.applyModifier(SKY_MOVEMENT_MODIFIER); + speed.applyNonPersistentModifier(SKY_MOVEMENT_MODIFIER); } else if (!equipped && nbt.getBoolean(key)) { // we just unequipped it nbt.putBoolean(key, false); diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java index d7da5934..4bb5a021 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java @@ -9,13 +9,13 @@ import de.ellpeck.naturesaura.reg.ICustomItemModel; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.BlockState; -import net.minecraft.block.LogBlock; import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.AxeItem; import net.minecraft.item.IItemTier; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tags.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.ICapabilityProvider; @@ -47,7 +47,7 @@ public class ItemAxe extends AxeItem implements IModItem, ICustomItemModel { @Override public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, PlayerEntity player) { if (itemstack.getItem() == ModItems.SKY_AXE) { - if (player.world.getBlockState(pos).getBlock() instanceof LogBlock) { + if (player.world.getBlockState(pos).getBlock().getTags().contains(BlockTags.LOGS.getName())) { TileEntityWoodStand.recurseTreeDestruction(player.world, pos, pos, false, true); return true; } diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java index dbdf82aa..dffeba88 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java @@ -32,8 +32,8 @@ public class ItemHoe extends HoeItem implements IModItem, ICustomItemModel { private final String baseName; - public ItemHoe(String baseName, IItemTier material, float speed) { - super(material, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); + public ItemHoe(String baseName, IItemTier material, int speed) { + super(material, speed, 0, new Properties().group(NaturesAura.CREATIVE_TAB)); this.baseName = baseName; ModRegistry.add(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java index 3af13198..e7cd12ad 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java @@ -47,7 +47,7 @@ public class ItemShovel extends ShovelItem implements IModItem, ICustomItemModel damage = 5; } } else { - int range = player.isShiftKeyDown() ? 0 : 1; + int range = player.isSneaking() ? 0 : 1; for (int x = -range; x <= range; x++) { for (int y = -range; y <= range; y++) { BlockPos actualPos = pos.add(x, 0, y); diff --git a/src/main/java/de/ellpeck/naturesaura/misc/ColoredBlockHelper.java b/src/main/java/de/ellpeck/naturesaura/misc/ColoredBlockHelper.java index d0746927..3885dbdc 100644 --- a/src/main/java/de/ellpeck/naturesaura/misc/ColoredBlockHelper.java +++ b/src/main/java/de/ellpeck/naturesaura/misc/ColoredBlockHelper.java @@ -24,7 +24,7 @@ public final class ColoredBlockHelper { private static List collectBlocks(String name) { List blocks = new ArrayList<>(); for (DyeColor color : DyeColor.values()) - blocks.add(ForgeRegistries.BLOCKS.getValue(new ResourceLocation(color.getName() + '_' + name))); + blocks.add(ForgeRegistries.BLOCKS.getValue(new ResourceLocation(color.getString() + '_' + name))); return Collections.unmodifiableList(blocks); } diff --git a/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java b/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java index e29effc0..b32dedfa 100644 --- a/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java +++ b/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java @@ -17,7 +17,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.LazyOptional; @@ -27,7 +27,7 @@ import javax.annotation.Nullable; import java.util.*; public class WorldData implements IWorldData { - public final ListMultimap> effectPowders = ArrayListMultimap.create(); + public final ListMultimap> effectPowders = ArrayListMultimap.create(); public final List recentlyConvertedMossStones = new ArrayList<>(); private final Map enderStorages = new HashMap<>(); public final Set spawnLamps = new HashSet<>(); diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java index d66b5be8..1cc59c09 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java @@ -9,7 +9,6 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.particles.ParticleTypes; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.fml.network.NetworkEvent; import java.util.function.Supplier; @@ -54,9 +53,9 @@ public class PacketClient { if (mc.world != null) { switch (message.type) { case 0: // dimension rail visualization - int goalDim = message.data[0]; + /* int goalDim = message.data[0]; BlockPos goalPos = new BlockPos(message.data[1], message.data[2], message.data[3]); - ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, DimensionType.getById(goalDim), goalPos); + ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, DimensionType.getById(goalDim), goalPos);*/ case 1: Entity entity = mc.world.getEntityByID(message.data[0]); mc.particles.emitParticleAtEntity(entity, ParticleTypes.TOTEM_OF_UNDYING, 30); diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java index 5eea5655..a99a9786 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java @@ -28,8 +28,8 @@ public final class PacketHandler { network.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), message); } - public static void sendToAllAround(IWorld world, BlockPos pos, int range, Object message) { - network.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(pos.getX(), pos.getY(), pos.getZ(), range, world.getDimension().getType())), message); + public static void sendToAllAround(World world, BlockPos pos, int range, Object message) { + network.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(pos.getX(), pos.getY(), pos.getZ(), range, world.func_234923_W_())), message); } public static void sendTo(PlayerEntity player, Object message) { diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index 6092d2d3..35160d76 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -236,7 +236,7 @@ public class PacketParticles { message.posX + 0.5F, message.posY + 0.5F, message.posZ + 0.5F, - 0.6F, BiomeColors.func_228361_b_(world, new BlockPos(sapX, sapY, sapZ)), 1.5F); + 0.6F, BiomeColors.getGrassColor(world, new BlockPos(sapX, sapY, sapZ)), 1.5F); if (releaseAura) for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) NaturesAuraAPI.instance().spawnMagicParticle( diff --git a/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java b/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java index c6022c48..c9a39053 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java @@ -80,7 +80,7 @@ public final class ParticleHandler { LightTexture lightmap = mc.gameRenderer.getLightTexture(); RenderSystem.pushMatrix(); - RenderSystem.multMatrix(stack.getLast().getPositionMatrix()); + RenderSystem.multMatrix(stack.getLast().getMatrix()); lightmap.enableLightmap(); RenderSystem.enableAlphaTest(); diff --git a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java index 24e7de6d..7ed5302a 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java @@ -5,11 +5,12 @@ import de.ellpeck.naturesaura.NaturesAura; import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.Quaternion; -import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.world.ClientWorld; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3f; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -23,7 +24,7 @@ public class ParticleMagic extends Particle { private final boolean fade; private float particleScale; - public ParticleMagic(World world, double posX, double posY, double posZ, double motionX, double motionY, double motionZ, int color, float scale, int maxAge, float gravity, boolean collision, boolean fade) { + public ParticleMagic(ClientWorld world, double posX, double posY, double posZ, double motionX, double motionY, double motionZ, int color, float scale, int maxAge, float gravity, boolean collision, boolean fade) { super(world, posX, posY, posZ); this.desiredScale = scale; this.maxAge = maxAge; @@ -73,7 +74,7 @@ public class ParticleMagic extends Particle { @Override public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { - Vec3d vec3d = renderInfo.getProjectedView(); + Vector3d vec3d = renderInfo.getProjectedView(); float f = (float) (MathHelper.lerp(partialTicks, this.prevPosX, this.posX) - vec3d.getX()); float f1 = (float) (MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY()); float f2 = (float) (MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ()); diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/AnimalSpawnerRecipe.java b/src/main/java/de/ellpeck/naturesaura/recipes/AnimalSpawnerRecipe.java index e8b35d3e..4bc8b45a 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/AnimalSpawnerRecipe.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/AnimalSpawnerRecipe.java @@ -15,6 +15,8 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.storage.ServerWorldInfo; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistryEntry; @@ -46,7 +48,7 @@ public class AnimalSpawnerRecipe extends ModRecipe { MobEntity living = (MobEntity) entity; living.rotationYawHead = entity.rotationYaw; living.renderYawOffset = entity.rotationYaw; - living.onInitialSpawn(world, world.getDifficultyForLocation(living.getPosition()), SpawnReason.SPAWNER, null, null); + living.onInitialSpawn((ServerWorld) world, world.getDifficultyForLocation(living.getPosition()), SpawnReason.SPAWNER, null, null); } return entity; } diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index 240a7083..d1f38196 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -1,8 +1,8 @@ package de.ellpeck.naturesaura.recipes; import com.google.gson.JsonObject; -import com.mojang.datafixers.Dynamic; -import com.mojang.datafixers.types.JsonOps; +import com.mojang.serialization.Dynamic; +import com.mojang.serialization.JsonOps; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.misc.WeightedOre; diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java b/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java index dee35779..09cd26b9 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java @@ -72,4 +72,9 @@ public enum ModArmorMaterial implements IArmorMaterial { public float getToughness() { return this.toughness; } + + @Override + public float getKnockbackResistance() { + return 0; + } } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index a26855ae..36c5e023 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -46,11 +46,12 @@ import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.potion.Effect; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; +import net.minecraft.world.World; import net.minecraft.world.biome.Biome; -import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.GenerationStage; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.gen.placement.IPlacementConfig; import net.minecraft.world.gen.placement.Placement; import net.minecraftforge.common.extensions.IForgeContainerType; @@ -124,9 +125,9 @@ public final class ModRegistry { new BlockPowderPlacer(), new BlockFireworkGenerator(), new BlockProjectileGenerator(), - new BlockDimensionRail("overworld", DimensionType.OVERWORLD, DimensionType.THE_NETHER, DimensionType.THE_END), - new BlockDimensionRail("nether", DimensionType.THE_NETHER, DimensionType.OVERWORLD), - new BlockDimensionRail("end", DimensionType.THE_END, DimensionType.OVERWORLD), + new BlockDimensionRail("overworld", World.field_234918_g_, World.field_234919_h_, World.field_234920_i_), + new BlockDimensionRail("nether", World.field_234919_h_, World.field_234918_g_), + new BlockDimensionRail("end", World.field_234920_i_, World.field_234918_g_), new BlockBlastFurnaceBooster(), new BlockImpl("nether_wart_mushroom", ModBlocks.prop(Blocks.RED_MUSHROOM_BLOCK)), new BlockAnimalContainer(), @@ -166,7 +167,7 @@ public final class ModRegistry { new ItemPickaxe("infused_iron_pickaxe", ModItemTier.INFUSED, 1, -2.8F), new ItemAxe("infused_iron_axe", ModItemTier.INFUSED, 6.0F, -3.1F), new ItemShovel("infused_iron_shovel", ModItemTier.INFUSED, 1.5F, -3.0F), - new ItemHoe("infused_iron_hoe", ModItemTier.INFUSED, -1.0F), + new ItemHoe("infused_iron_hoe", ModItemTier.INFUSED, -1), new ItemSword("infused_iron_sword", ModItemTier.INFUSED, 3, -2.4F), new ItemArmor("infused_iron_helmet", ModArmorMaterial.INFUSED, EquipmentSlotType.HEAD), new ItemArmor("infused_iron_chest", ModArmorMaterial.INFUSED, EquipmentSlotType.CHEST), @@ -211,14 +212,14 @@ public final class ModRegistry { new ItemPickaxe("sky_pickaxe", ModItemTier.SKY, 1, -2.8F), new ItemAxe("sky_axe", ModItemTier.SKY, 5.0F, -3.0F), new ItemShovel("sky_shovel", ModItemTier.SKY, 1.5F, -3.0F), - new ItemHoe("sky_hoe", ModItemTier.SKY, -1.0F), + new ItemHoe("sky_hoe", ModItemTier.SKY, -1), new ItemSword("sky_sword", ModItemTier.SKY, 3, -2.4F), new ItemArmor("sky_helmet", ModArmorMaterial.SKY, EquipmentSlotType.HEAD), new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlotType.CHEST), new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlotType.LEGS), new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlotType.FEET), - new ItemStructureFinder("fortress_finder", "Fortress", 0xba2800), - new ItemStructureFinder("end_city_finder", "EndCity", 0xca5cd6), + new ItemStructureFinder("fortress_finder", Structure.field_236378_n_, 0xba2800), + new ItemStructureFinder("end_city_finder", Structure.field_236379_o_, 0xca5cd6), new ItemBreakPrevention() ); Helper.populateObjectHolders(ModItems.class, event.getRegistry()); @@ -327,13 +328,15 @@ public final class ModRegistry { NaturesAura.proxy.registerTESR((ITESRProvider) item); } - for (Biome biome : ForgeRegistries.BIOMES) { + // TODO generate flower stuff naturally + /*for (Biome biome : ForgeRegistries.BIOMES) { if (ModConfig.instance.auraBlooms.get()) { - biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).func_227228_a_(Placement.NOPE.func_227446_a_(IPlacementConfig.NO_PLACEMENT_CONFIG))); + biome.func_242440_e().func_242496_b().add() + biome.func_242427_a(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG))); if (biome.getCategory() == Biome.Category.DESERT) - biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_CACTUS.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).func_227228_a_(Placement.NOPE.func_227446_a_(IPlacementConfig.NO_PLACEMENT_CONFIG))); + biome.func_242427_a(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_CACTUS.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG))); } - } + }*/ } public static Block createFlowerPot(Block block) { diff --git a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java index 875259b3..53b9c225 100644 --- a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java +++ b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java @@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType; import de.ellpeck.naturesaura.compat.Compat; import net.minecraft.client.entity.player.AbstractClientPlayerEntity; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.entity.IEntityRenderer; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.client.renderer.entity.model.PlayerModel; @@ -16,11 +15,10 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Effects; +import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; -import top.theillusivec4.curios.api.CuriosAPI; -import top.theillusivec4.curios.api.capability.ICurioItemHandler; import java.util.HashSet; import java.util.Set; @@ -62,14 +60,15 @@ public class PlayerLayerTrinkets extends LayerRenderer