IT COMPILES

I'll test it tomorrow :^)
This commit is contained in:
Ell 2020-09-22 03:17:02 +02:00
parent 418920ffdf
commit cb1b37c96e
107 changed files with 526 additions and 511 deletions

View file

@ -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..

View file

@ -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 <T extends Comparable<T>> BlockState findProperty(BlockState state, IProperty<T> prop, String key, String newValue) {
private static <T extends Comparable<T>> BlockState findProperty(BlockState state, Property<T> 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<ItemStack> predicate, PlayerEntity player) {
if (Compat.hasCompat("curios")) {
Optional<ItemStack> stack = CuriosAPI.getCurioEquipped(predicate, player).map(ImmutableTriple::getRight);
// TODO curios
/* Optional<ItemStack> 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);

View file

@ -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<Tuple<Vec3d, Integer>> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name) {
List<Tuple<Vec3d, Integer>> found = new ArrayList<>();
for (Tuple<Vec3d, Integer> powder : ((WorldData) IWorldData.getWorldData(world)).effectPowders.get(name))
public List<Tuple<Vector3d, Integer>> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name) {
List<Tuple<Vector3d, Integer>> found = new ArrayList<>();
for (Tuple<Vector3d, Integer> 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<Tuple<Vec3d, Integer>> powders = this.getActiveEffectPowders(world, new AxisAlignedBB(pos).grow(64), name);
for (Tuple<Vec3d, Integer> powder : powders) {
Vector3d posVec = new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
List<Tuple<Vector3d, Integer>> powders = this.getActiveEffectPowders(world, new AxisAlignedBB(pos).grow(64), name);
for (Tuple<Vector3d, Integer> powder : powders) {
AxisAlignedBB bounds = Helper.aabb(powder.getA()).grow(powder.getB());
if (bounds.contains(posVec))
return true;

View file

@ -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);
}

View file

@ -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<ResourceLocation, IAuraType> 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<Tuple<Vec3d, Integer>> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name);
List<Tuple<Vector3d, Integer>> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name);
/**
* Returns true if there is an effect powder entity active anywhere

View file

@ -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<ResourceLocation> dimensions = new HashSet<>();
private final Set<RegistryKey<World>> dimensions = new HashSet<>();
public BasicAuraType(ResourceLocation name, DimensionType dimension, int color, int priority) {
public BasicAuraType(ResourceLocation name, RegistryKey<World> 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<World> type) {
this.dimensions.add(type);
}
}

View file

@ -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<Compou
static IWorldData getOverworldData(World world) {
if (!world.isRemote)
return getWorldData(world.getServer().getWorld(DimensionType.OVERWORLD));
return getWorldData(world.getServer().getWorld(World.field_234918_g_));
return getWorldData(world);
}

View file

@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.api.multiblock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
@ -22,8 +23,8 @@ public class Matcher {
return new Matcher(Blocks.AIR.getDefaultState(), null);
}
public static Matcher tag(Block defaultBlock, Tag tag) {
return new Matcher(defaultBlock.getDefaultState(), (world, start, offset, pos, state, c) -> 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() {

View file

@ -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);
}

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutoutMipped;
return RenderType::getCutoutMipped;
}
}

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutout;
return RenderType::getCutout;
}
@Override

View file

@ -65,7 +65,7 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
@Override
public Supplier<RenderType> 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);

View file

@ -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) {

View file

@ -40,6 +40,6 @@ public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState,
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
return RenderType::getCutoutMipped;
}
}

View file

@ -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<RailShape> SHAPE = BlockStateProperties.RAIL_SHAPE;
private final String name;
private final int goalDim;
private final DimensionType[] canUseDims;
private final RegistryKey<World> goalDim;
private final RegistryKey<World>[] canUseDims;
public BlockDimensionRail(String name, DimensionType goalDim, DimensionType... canUseDims) {
public BlockDimensionRail(String name, RegistryKey<World> goalDim, RegistryKey<World>... 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<World> dimension) {
for (RegistryKey<World> 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<Boolean, Entity> 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<RailShape> getShapeProperty() {
public Property<RailShape> getShapeProperty() {
return SHAPE;
}
@ -155,7 +153,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
return RenderType::getCutoutMipped;
}
@Override

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutout;
return RenderType::getCutout;
}
}

View file

@ -56,7 +56,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
private static final ThreadLocal<WeakReference<World>> 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);
}

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutoutMipped;
return RenderType::getCutoutMipped;
}
}

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutout;
return RenderType::getCutout;
}
}

View file

@ -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<Block, BlockState> builder) {
super.fillStateContainer(builder);

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutoutMipped;
return RenderType::getCutoutMipped;
}
}

View file

@ -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);
}

View file

@ -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))

View file

@ -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))

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutout;
return RenderType::getCutoutMipped;
}
}

View file

@ -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;
}

View file

@ -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 -> {

View file

@ -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<RenderType> getRenderType() {
return RenderType::cutoutMipped;
return RenderType::getCutoutMipped;
}
}

View file

@ -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 {

View file

@ -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));
}

View file

@ -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));

View file

@ -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<ItemStack> 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)));

View file

@ -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;

View file

@ -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

View file

@ -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)

View file

@ -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()));

View file

@ -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();
}

View file

@ -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 {

View file

@ -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;
}

View file

@ -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) {

View file

@ -49,7 +49,7 @@ public class RenderAuraTimer extends TileEntityRenderer<TileEntityAuraTimer> {
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);

View file

@ -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<TileEntityEnderCrate> {
private static final Random RANDOM = new Random(31100L);
private static final List<RenderType> RENDER_TYPES = IntStream.range(0, 16).mapToObj(i -> RenderType.endPortal(i + 1)).collect(ImmutableList.toImmutableList());
private static final List<RenderType> 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<TileEntityEnderCrate> {
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) {

View file

@ -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<TileEntityGe
private final ModelRenderer box;
public ModelLimitRemoverGlint() {
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);

View file

@ -4,11 +4,11 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
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;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.vector.Vector3f;
public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> {
public RenderNatureAltar(TileEntityRendererDispatcher rendererDispatcherIn) {

View file

@ -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;

View file

@ -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<TileEntityProj
private final ModelRenderer box;
public ModelOverlay() {
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);

View file

@ -5,13 +5,13 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderTypeLookup;
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;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.vector.Vector3f;
public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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<Tuple<Vec3d, Integer>> powders = NaturesAuraAPI.instance().getActiveEffectPowders(world,
List<Tuple<Vector3d, Integer>> 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<Vec3d, Integer> powder = powders.get(i % powders.size());
Vec3d powderPos = powder.getA();
Tuple<Vector3d, Integer> 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<Block> tag = world.getTags().getBlocks().get(ore.tag);
ITag<Block> 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))

View file

@ -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<Item, Tag<Item>> TYPES = ImmutableMap.<Item, Tag<Item>>builder()
}
@Override
public void setupClient() {
}
@Override
public void addItemTags(ItemTagProvider provider) {
}
/*private static final Map<Item, Tag<Item>> TYPES = ImmutableMap.<Item, Tag<Item>>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<Item, Tag<Item>> entry : TYPES.entrySet())
provider.getBuilder(entry.getValue()).add(entry.getKey());
}
}*/
}

View file

@ -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))

View file

@ -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<AnimalSpawnerRecip
}
@Override
public void draw(AnimalSpawnerRecipe recipe, double mouseX, double mouseY) {
public void draw(AnimalSpawnerRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
Minecraft minecraft = Minecraft.getInstance();
Entity entity = this.entityCache.get(recipe.entity);
if (entity == null) {
@ -133,7 +133,8 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
float size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
renderEntity(35, 55, 100F / size * 0.4F, 40, size * 0.5F, (LivingEntity) entity);
String name = recipe.entity.getName().getFormattedText();
minecraft.fontRenderer.drawStringWithShadow(name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
String name = recipe.entity.getName().getString();
minecraft.fontRenderer.drawStringWithShadow(matrixStack, name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
}
}

View file

@ -20,6 +20,8 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@ -95,11 +97,11 @@ 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, 469, 0, 43, 42, 512, 256);
AbstractGui.blit(event.matrixStack, x, y, 469, 0, 43, 42, 512, 256);
if (event.mouseX >= 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);
}

View file

@ -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<String> 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();
}
}

View file

@ -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<String> 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();
}
}
}

View file

@ -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<String> 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();
}
}
}

View file

@ -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<String> 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();
}
}
}

View file

@ -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> T survivesExplosion(Block block, ILootConditionConsumer<T> then) {

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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) {

View file

@ -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<Item> getBuilder(Tag<Item> tagIn) {
return super.getBuilder(tagIn);
}
}

View file

@ -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));
}

View file

@ -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

View file

@ -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<Tuple<Vec3d, Integer>> powders = this.getPowderList();
powders.add(new Tuple<>(this.getPositionVector(), this.getAmount()));
List<Tuple<Vector3d, Integer>> powders = this.getPowderList();
powders.add(new Tuple<>(this.getPositionVec(), this.getAmount()));
}
private void removeFromPowderList() {
if (!this.isAddedToWorld() || this.getInhibitedEffect() == null)
return;
List<Tuple<Vec3d, Integer>> powders = this.getPowderList();
Vec3d pos = this.getPositionVector();
List<Tuple<Vector3d, Integer>> 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<Tuple<Vec3d, Integer>> getPowderList() {
ListMultimap<ResourceLocation, Tuple<Vec3d, Integer>> powders = ((WorldData) IWorldData.getWorldData(this.world)).effectPowders;
private List<Tuple<Vector3d, Integer>> getPowderList() {
ListMultimap<ResourceLocation, Tuple<Vector3d, Integer>> 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

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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<EntityEffectInhibitor>
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();
}
}

View file

@ -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<EntityMoverMinecart> {
@ -35,7 +35,7 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
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<EntityMoverMinecart> {
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);

View file

@ -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<Entity> {
}
@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;
}

View file

@ -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<ITextComponent> tooltip = event.getToolTip();
for (Map.Entry<Enchantment, Integer> entry : EnchantmentHelper.getEnchantments(stack).entrySet()) {
Enchantment enchantment = entry.getKey();
if (!(enchantment instanceof ModEnchantment))
continue;
String info = I18n.format(enchantment.getName() + ".desc");
List<String> 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<World> 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<ItemStack, Boolean> 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);
}
}

View file

@ -134,6 +134,6 @@ public class CommonEvents {
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
CommandAura.register(event.getCommandDispatcher());
CommandAura.register(event.getServer().getCommandManager().getDispatcher());
}
}

View file

@ -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<TreeFeatureConfig> ANCIENT_TREE;
public static Feature<BaseTreeFeatureConfig> ANCIENT_TREE;
public static Feature<NoFeatureConfig> NETHER_WART_MUSHROOM;
public static Feature<NoFeatureConfig> AURA_BLOOM;
public static Feature<NoFeatureConfig> AURA_CACTUS;

View file

@ -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<TreeFeatureConfig> {
public class WorldGenAncientTree extends Feature<BaseTreeFeatureConfig> {
// 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<BlockPos> cb1, Set<BlockPos> 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<TreeFeatureConfig>
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<TreeFeatureConfig>
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<TreeFeatureConfig>
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<TreeFeatureConfig>
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);
}
}
}

View file

@ -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<NoFeatureConfig> {
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<? extends GenerationSettings> 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;

View file

@ -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<NoFeatureConfig> {
public WorldGenNetherWartMushroom() {
super(d -> NoFeatureConfig.NO_FEATURE_CONFIG);
super(Codec.unit(IFeatureConfig.NO_FEATURE_CONFIG));
}
@Override
public boolean place(IWorld worldIn, ChunkGenerator<? extends GenerationSettings> 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<NoFeatureConfig> {
}
// 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);

View file

@ -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<ContainerEnderCrate> {
}
@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);
}
}

View file

@ -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);
}
}
}

View file

@ -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<ITextComponent> 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)));
}
}
}

View file

@ -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<ItemStack> 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));

View file

@ -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));
}

View file

@ -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);

View file

@ -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);
}
}
}

View file

@ -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);

View file

@ -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() + ")");
}
}

View file

@ -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<DimensionType, BlockPos> VISUALIZED_BLOCKS = ArrayListMultimap.create();
public static final ListMultimap<DimensionType, Entity> VISUALIZED_ENTITIES = ArrayListMultimap.create();
public static final ListMultimap<DimensionType, BlockPos> VISUALIZED_RAILS = ArrayListMultimap.create();
public static final ListMultimap<RegistryKey<World>, BlockPos> VISUALIZED_BLOCKS = ArrayListMultimap.create();
public static final ListMultimap<RegistryKey<World>, Entity> VISUALIZED_ENTITIES = ArrayListMultimap.create();
public static final ListMultimap<RegistryKey<World>, 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 <T> void visualize(PlayerEntity player, ListMultimap<DimensionType, T> map, DimensionType dim, T value) {
public static <T> void visualize(PlayerEntity player, ListMultimap<RegistryKey<World>, T> map, RegistryKey<World> 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<ItemStack> 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<World> dim = entity.world.func_234923_W_();
visualize(event.getPlayer(), VISUALIZED_ENTITIES, dim, entity);
}
event.getPlayer().swingArm(event.getHand());

View file

@ -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);
}
}
}

View file

@ -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<ItemStack> 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());

View file

@ -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);

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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);

View file

@ -24,7 +24,7 @@ public final class ColoredBlockHelper {
private static List<Block> collectBlocks(String name) {
List<Block> 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);
}

View file

@ -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<ResourceLocation, Tuple<Vec3d, Integer>> effectPowders = ArrayListMultimap.create();
public final ListMultimap<ResourceLocation, Tuple<Vector3d, Integer>> effectPowders = ArrayListMultimap.create();
public final List<BlockPos> recentlyConvertedMossStones = new ArrayList<>();
private final Map<String, ItemStackHandlerNA> enderStorages = new HashMap<>();
public final Set<TileEntitySpawnLamp> spawnLamps = new HashSet<>();

View file

@ -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);

View file

@ -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) {

View file

@ -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(

View file

@ -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();

Some files were not shown because too many files have changed in this diff Show more