Compare commits

..

10 commits

Author SHA1 Message Date
Ell
29b067d294 fixed particle rendering 2021-12-19 19:33:44 +01:00
Ell
8f62c01cc3 fixed ender crate model offset 2021-12-19 18:49:05 +01:00
Ell
5c04244e00 bring back model rendering 2021-12-19 18:47:50 +01:00
Ell
1469e4ca5f added back overlay rendering 2021-12-19 18:24:54 +01:00
Ell
5b7df8bd45 re-added JEI compat 2021-12-19 17:14:56 +01:00
Ell
5db697abb1 register features more 2021-12-19 16:51:20 +01:00
Ell
c0bf5f0d93 bring back curios compat 2021-12-19 16:35:03 +01:00
Ell
f8d3d022fd fixed effect powders being weird 2021-12-19 16:26:31 +01:00
Ell
2b6b42e091 matches is areItemStacksEqual, isSame is areItemsEqual
obviously
2021-12-19 15:40:53 +01:00
Ell
198a4d359a made stuff tick 2021-12-19 15:32:45 +01:00
103 changed files with 596 additions and 578 deletions

View file

@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'official', version: '1.18'
mappings channel: 'official', version: '1.18.1'
runs {
client {
@ -102,18 +102,16 @@ repositories {
}
dependencies {
minecraft 'net.minecraftforge:forge:1.18-38.0.14'
minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
// TODO JEI
/* compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.1.75:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.1.75")*/
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47")
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-61:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-61")
// TODO Curios
/* runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.0")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.0:api")*/
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0:api")
// TODO Enchantability
/* compile fg.deobf("quarris.enchantability:Enchantability:11.0.48")*/

View file

@ -1,12 +1,15 @@
package de.ellpeck.naturesaura;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
import de.ellpeck.naturesaura.api.misc.ILevelData;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
import de.ellpeck.naturesaura.chunk.AuraChunk;
import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.misc.LevelData;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
@ -39,7 +42,8 @@ import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
import org.lwjgl.opengl.GL11;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import top.theillusivec4.curios.api.CuriosApi;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -113,6 +117,19 @@ public final class Helper {
return !nbt || ItemStack.tagMatches(first, second);
}
@OnlyIn(Dist.CLIENT)
public static void renderItemInGui(ItemStack stack, int x, int y, float scale) {
var poseStack = RenderSystem.getModelViewStack();
poseStack.pushPose();
poseStack.translate(x, y, 0);
poseStack.scale(scale, scale, scale);
RenderSystem.applyModelViewMatrix();
Minecraft.getInstance().getItemRenderer().renderGuiItem(stack, 0, 0);
Minecraft.getInstance().getItemRenderer().renderGuiItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null);
poseStack.popPose();
RenderSystem.applyModelViewMatrix();
}
public static InteractionResult putStackOnTile(Player player, InteractionHand hand, BlockPos pos, int slot, boolean sound) {
var tile = player.level.getBlockEntity(pos);
if (tile instanceof BlockEntityImpl) {
@ -121,7 +138,7 @@ public final class Helper {
var handStack = player.getItemInHand(hand);
if (!handStack.isEmpty()) {
var remain = handler.insertItem(slot, handStack, player.level.isClientSide);
if (!ItemStack.isSame(remain, handStack)) {
if (!ItemStack.matches(remain, handStack)) {
if (sound)
player.level.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
@ -223,34 +240,6 @@ public final class Helper {
return highestAmount;
}
@OnlyIn(Dist.CLIENT)
public static void renderWeirdBox(double x, double y, double z, double width, double height, double depth) {
GL11.glVertex3d(x, y + height, z);
GL11.glVertex3d(x + width, y + height, z);
GL11.glVertex3d(x + width, y, z);
GL11.glVertex3d(x, y, z);
GL11.glVertex3d(x + width, y, z + depth);
GL11.glVertex3d(x + width, y, z);
GL11.glVertex3d(x + width, y + height, z);
GL11.glVertex3d(x + width, y + height, z + depth);
GL11.glVertex3d(x + width, y + height, z + depth);
GL11.glVertex3d(x, y + height, z + depth);
GL11.glVertex3d(x, y, z + depth);
GL11.glVertex3d(x + width, y, z + depth);
GL11.glVertex3d(x, y + height, z + depth);
GL11.glVertex3d(x, y + height, z);
GL11.glVertex3d(x, y, z);
GL11.glVertex3d(x, y, z + depth);
GL11.glVertex3d(x, y + height, z);
GL11.glVertex3d(x, y + height, z + depth);
GL11.glVertex3d(x + width, y + height, z + depth);
GL11.glVertex3d(x + width, y + height, z);
GL11.glVertex3d(x + width, y, z);
GL11.glVertex3d(x + width, y, z + depth);
GL11.glVertex3d(x, y, z + depth);
GL11.glVertex3d(x, y, z);
}
public static boolean isHoldingItem(Player player, Item item) {
for (var hand : InteractionHand.values()) {
var stack = player.getItemInHand(hand);
@ -290,12 +279,11 @@ public final class Helper {
}
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
// TODO Curios
/* if (Compat.hasCompat("curios")) {
Optional<ItemStack> stack = CuriosApi.getCuriosHelper().findEquippedCurio(predicate, player).map(ImmutableTriple::getRight);
if (Compat.hasCompat("curios")) {
var stack = CuriosApi.getCuriosHelper().findEquippedCurio(predicate, player).map(ImmutableTriple::getRight);
if (stack.isPresent())
return stack.get();
}*/
}
for (var i = 0; i < player.getInventory().getContainerSize(); i++) {
var slot = player.getInventory().getItem(i);
if (!slot.isEmpty() && predicate.test(slot))

View file

@ -20,7 +20,7 @@ public class BlockAnimalContainer extends BlockContainerImpl implements IVisuali
private static final VoxelShape SHAPE = box(5, 0, 5, 11, 13, 11);
public BlockAnimalContainer() {
super("animal_container", BlockEntityAnimalContainer::new, Properties.copy(Blocks.STONE));
super("animal_container", BlockEntityAnimalContainer.class, Properties.copy(Blocks.STONE));
}
@Override

View file

@ -9,9 +9,7 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.npc.Npc;
@ -31,7 +29,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockAnimalGenerator() {
super("animal_generator", BlockEntityAnimalGenerator::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
super("animal_generator", BlockEntityAnimalGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -7,6 +7,6 @@ import net.minecraft.world.level.material.Material;
public class BlockAnimalSpawner extends BlockContainerImpl {
public BlockAnimalSpawner() {
super("animal_spawner", BlockEntityAnimalSpawner::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("animal_spawner", BlockEntityAnimalSpawner.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
}
}

View file

@ -1,6 +1,8 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraBloom;
import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.*;
@ -16,11 +18,13 @@ import net.minecraft.world.level.block.BushBlock;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.function.Supplier;
@ -86,4 +90,10 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new BlockEntityAuraBloom(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ITickableBlockEntity.createTickerHelper(type, ModBlockEntities.AURA_BLOOM);
}
}

View file

@ -4,14 +4,13 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraDetector;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
public class BlockAuraDetector extends BlockContainerImpl {
public BlockAuraDetector() {
super("aura_detector", BlockEntityAuraDetector::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("aura_detector", BlockEntityAuraDetector.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
}
@Override

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraTimer;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderAuraTimer;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -35,7 +35,7 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
private static final VoxelShape SHAPE = box(1, 0, 1, 15, 15, 15);
public BlockAuraTimer() {
super("aura_timer", BlockEntityAuraTimer::new, Properties.copy(Blocks.SMOOTH_STONE));
super("aura_timer", BlockEntityAuraTimer.class, Properties.copy(Blocks.SMOOTH_STONE));
this.registerDefaultState(this.defaultBlockState().setValue(BlockStateProperties.POWERED, false));
}
@ -83,6 +83,6 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.AURA_TIMER, RenderAuraTimer::new);
BlockEntityRenderers.register(ModBlockEntities.AURA_TIMER, RenderAuraTimer::new);
}
}

View file

@ -17,7 +17,7 @@ public class BlockAutoCrafter extends BlockContainerImpl implements ICustomBlock
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public BlockAutoCrafter() {
super("auto_crafter", BlockEntityAutoCrafter::new, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
super("auto_crafter", BlockEntityAutoCrafter.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
}
@Override

View file

@ -22,7 +22,7 @@ public class BlockBlastFurnaceBooster extends BlockContainerImpl implements ICus
private static final VoxelShape SHAPE = Shapes.create(1 / 16F, 0, 1 / 16F, 15 / 16F, 1, 15 / 16F);
public BlockBlastFurnaceBooster() {
super("blast_furnace_booster", BlockEntityBlastFurnaceBooster::new, Block.Properties.copy(Blocks.BLAST_FURNACE).lightLevel(s -> 0));
super("blast_furnace_booster", BlockEntityBlastFurnaceBooster.class, Block.Properties.copy(Blocks.BLAST_FURNACE).lightLevel(s -> 0));
}
@Override

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Blocks;
public class BlockChorusGenerator extends BlockContainerImpl implements ICustomBlockState {
public BlockChorusGenerator() {
super("chorus_generator", BlockEntityChorusGenerator::new, Properties.copy(Blocks.END_STONE));
super("chorus_generator", BlockEntityChorusGenerator.class, Properties.copy(Blocks.END_STONE));
}
@Override

View file

@ -12,7 +12,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
@ -28,7 +27,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
private static final VoxelShape SHAPE = box(4, 4, 4, 12, 12, 12);
public BlockChunkLoader() {
super("chunk_loader", BlockEntityChunkLoader::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
super("chunk_loader", BlockEntityChunkLoader.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
}
@Override

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.ModRegistry;
import de.ellpeck.naturesaura.reg.ModTileType;
@ -19,6 +20,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
@ -29,19 +31,22 @@ import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import javax.annotation.Nullable;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Random;
public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
private final String baseName;
private final ModTileType<BlockEntity> tileType;
private final Class<? extends BlockEntity> tileClass;
private final ModTileType<? extends BlockEntity> tileType;
public BlockContainerImpl(String baseName, BlockEntityType.BlockEntitySupplier<BlockEntity> tileSupplier, Block.Properties properties) {
public BlockContainerImpl(String baseName, Class<? extends BlockEntity> tileClass, Block.Properties properties) {
super(properties);
this.baseName = baseName;
this.tileType = new ModTileType<>(tileSupplier, this);
this.tileClass = tileClass;
this.tileType = new ModTileType<>(this::createBlockEntity, this);
ModRegistry.add(this);
ModRegistry.add(this.tileType);
@ -85,7 +90,14 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
@org.jetbrains.annotations.Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return this.tileType.type.create(pos, state);
return this.createBlockEntity(pos, state);
}
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
if (ITickableBlockEntity.class.isAssignableFrom(this.tileClass))
return ITickableBlockEntity.createTickerHelper(type, this.tileType.type);
return null;
}
@Override
@ -164,4 +176,12 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
}
}
}
private BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
try {
return this.tileClass.getConstructor(BlockPos.class, BlockState.class).newInstance(pos, state);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new IllegalStateException("Cannot construct block entity from class " + this.tileClass, e);
}
}
}

View file

@ -1,13 +1,14 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEndFlower;
import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.*;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@ -19,13 +20,14 @@ import net.minecraft.world.level.block.BushBlock;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.MinecraftForge;
@ -89,6 +91,12 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
return new BlockEntityEndFlower(pos, state);
}
@org.jetbrains.annotations.Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ITickableBlockEntity.createTickerHelper(type, ModBlockEntities.END_FLOWER);
}
@Override
public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest, FluidState fluid) {
return willHarvest || super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid);

View file

@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.misc.ILevelData;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.items.ModItems;
@ -43,7 +43,7 @@ import java.util.Random;
public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider<BlockEntityEnderCrate>, ICustomBlockState {
public BlockEnderCrate() {
super("ender_crate", BlockEntityEnderCrate::new, Properties.of(Material.STONE).strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
super("ender_crate", BlockEntityEnderCrate.class, Properties.of(Material.STONE).strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
}
@ -131,6 +131,6 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.ENDER_CRATE, RenderEnderCrate::new);
BlockEntityRenderers.register(ModBlockEntities.ENDER_CRATE, RenderEnderCrate::new);
}
}

View file

@ -8,14 +8,12 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ICustomRenderType;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
@ -28,7 +26,7 @@ import java.util.function.Supplier;
public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState, ICustomRenderType {
public BlockFieldCreator() {
super("field_creator", BlockEntityFieldCreator::new, Properties.of(Material.STONE).strength(2F).noCollission().sound(SoundType.STONE));
super("field_creator", BlockEntityFieldCreator.class, Properties.of(Material.STONE).strength(2F).noCollission().sound(SoundType.STONE));
}
@Override

View file

@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockFireworkGenerator() {
super("firework_generator", BlockEntityFireworkGenerator::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
super("firework_generator", BlockEntityFireworkGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
}
@Override

View file

@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockFlowerGenerator() {
super("flower_generator", BlockEntityFlowerGenerator::new, Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F));
super("flower_generator", BlockEntityFlowerGenerator.class, Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F));
}
@Override

View file

@ -37,7 +37,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
};
public BlockFurnaceHeater() {
super("furnace_heater", BlockEntityFurnaceHeater::new, Properties.of(Material.STONE).strength(3F));
super("furnace_heater", BlockEntityFurnaceHeater.class, Properties.of(Material.STONE).strength(3F));
}
@Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -13,7 +13,7 @@ import net.minecraft.world.level.material.Material;
public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider<BlockEntityGeneratorLimitRemover>, ICustomBlockState {
public BlockGeneratorLimitRemover() {
super("generator_limit_remover", BlockEntityGeneratorLimitRemover::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("generator_limit_remover", BlockEntityGeneratorLimitRemover.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
}
@Override
@ -26,6 +26,6 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
BlockEntityRenderers.register(ModBlockEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
}
}

View file

@ -11,7 +11,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
@ -19,7 +18,6 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HopperBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.Hopper;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
@ -53,7 +51,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
private static final VoxelShape WEST_RAYTRACE_SHAPE = Shapes.or(Hopper.INSIDE, box(0.0D, 8.0D, 6.0D, 4.0D, 10.0D, 10.0D));
public BlockGratedChute() {
super("grated_chute", BlockEntityGratedChute::new, Properties.of(Material.METAL).strength(3.0F, 8.0F).sound(SoundType.METAL));
super("grated_chute", BlockEntityGratedChute.class, Properties.of(Material.METAL).strength(3.0F, 8.0F).sound(SoundType.METAL));
}
@Override

View file

@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
public BlockHopperUpgrade() {
super("hopper_upgrade", BlockEntityHopperUpgrade::new, Properties.of(Material.METAL).strength(2.5F).sound(SoundType.METAL));
super("hopper_upgrade", BlockEntityHopperUpgrade.class, Properties.of(Material.METAL).strength(2.5F).sound(SoundType.METAL));
}
@Override

View file

@ -9,14 +9,13 @@ import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
public class BlockItemDistributor extends BlockContainerImpl implements ICustomBlockState {
public BlockItemDistributor() {
super("item_distributor", BlockEntityItemDistributor::new, Properties.copy(Blocks.STONE_BRICKS));
super("item_distributor", BlockEntityItemDistributor.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
public BlockMossGenerator() {
super("moss_generator", BlockEntityMossGenerator::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("moss_generator", BlockEntityMossGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
}
@Override

View file

@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -35,7 +35,7 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
public static final BooleanProperty NETHER = BooleanProperty.create("nether");
public BlockNatureAltar() {
super("nature_altar", BlockEntityNatureAltar::new, Block.Properties.of(Material.STONE).strength(4F));
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of(Material.STONE).strength(4F));
this.registerDefaultState(this.defaultBlockState().setValue(NETHER, false));
}
@ -75,6 +75,6 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.NATURE_ALTAR, RenderNatureAltar::new);
BlockEntityRenderers.register(ModBlockEntities.NATURE_ALTAR, RenderNatureAltar::new);
}
}

View file

@ -19,12 +19,10 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.Random;
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockOakGenerator() {
super("oak_generator", BlockEntityOakGenerator::new, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
super("oak_generator", BlockEntityOakGenerator.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityOfferingTable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -27,7 +27,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
private static final VoxelShape SHAPE = Shapes.create(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
public BlockOfferingTable() {
super("offering_table", BlockEntityOfferingTable::new, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
super("offering_table", BlockEntityOfferingTable.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
}
@Override
@ -52,6 +52,6 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.OFFERING_TABLE, RenderOfferingTable::new);
BlockEntityRenderers.register(ModBlockEntities.OFFERING_TABLE, RenderOfferingTable::new);
}
}

View file

@ -8,11 +8,8 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
@ -24,7 +21,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockPickupStopper() {
super("pickup_stopper", BlockEntityPickupStopper::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("pickup_stopper", BlockEntityPickupStopper.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockPlacer extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockPlacer() {
super("placer", BlockEntityPlacer::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("placer", BlockEntityPlacer.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
}
@Override

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.material.Material;
public class BlockPotionGenerator extends BlockContainerImpl implements ICustomBlockState {
public BlockPotionGenerator() {
super("potion_generator", BlockEntityPotionGenerator::new, Properties.of(Material.STONE).strength(5F));
super("potion_generator", BlockEntityPotionGenerator.class, Properties.of(Material.STONE).strength(5F));
}
@Override

View file

@ -17,7 +17,7 @@ public class BlockPowderPlacer extends BlockContainerImpl implements ICustomBloc
private static final VoxelShape SHAPE = Shapes.create(0F, 0F, 0F, 1F, 4 / 16F, 1F);
public BlockPowderPlacer() {
super("powder_placer", BlockEntityPowderPlacer::new, Properties.of(Material.STONE).strength(2, 5F).sound(SoundType.STONE));
super("powder_placer", BlockEntityPowderPlacer.class, Properties.of(Material.STONE).strength(2, 5F).sound(SoundType.STONE));
}
@Override

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler;
@ -10,12 +10,10 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Position;
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Projectile;
@ -26,10 +24,8 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.ProjectileImpactEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -38,7 +34,7 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<BlockEntityProjectileGenerator>, ICustomBlockState {
public BlockProjectileGenerator() {
super("projectile_generator", BlockEntityProjectileGenerator::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("projectile_generator", BlockEntityProjectileGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
DispenserBlock.registerBehavior(Items.ENDER_PEARL, new AbstractProjectileDispenseBehavior() {
@ -55,7 +51,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
protected Projectile getProjectile(Level levelIn, Position position, ItemStack stackIn) {
var ret = new ThrownTrident(EntityType.TRIDENT, levelIn);
ret.setPos(position.x(), position.y(), position.z());
ObfuscationReflectionHelper.setPrivateValue(ThrownTrident.class, ret, stackIn.copy(), "tridentItem");
ObfuscationReflectionHelper.setPrivateValue(ThrownTrident.class, ret, stackIn.copy(), "f_37555_");
ret.pickup = AbstractArrow.Pickup.ALLOWED;
return ret;
}
@ -106,6 +102,6 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
BlockEntityRenderers.register(ModBlockEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
}
}

View file

@ -9,7 +9,7 @@ import net.minecraft.world.level.material.Material;
public class BlockRFConverter extends BlockContainerImpl {
public BlockRFConverter() {
super("rf_converter", BlockEntityRFConverter::new, Properties.of(Material.STONE).sound(SoundType.STONE).strength(3));
super("rf_converter", BlockEntityRFConverter.class, Properties.of(Material.STONE).sound(SoundType.STONE).strength(3));
}
@Override

View file

@ -6,7 +6,6 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntitySlimeSplitGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.monster.Slime;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
@ -20,7 +19,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockSlimeSplitGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockSlimeSplitGenerator() {
super("slime_split_generator", BlockEntitySlimeSplitGenerator::new, Properties.copy(Blocks.SLIME_BLOCK).strength(2));
super("slime_split_generator", BlockEntitySlimeSplitGenerator.class, Properties.copy(Blocks.SLIME_BLOCK).strength(2));
MinecraftForge.EVENT_BUS.register(new Events());
}

View file

@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -15,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockSnowCreator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockSnowCreator() {
super("snow_creator", BlockEntitySnowCreator::new, Properties.copy(Blocks.STONE_BRICKS));
super("snow_creator", BlockEntitySnowCreator.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -16,9 +16,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
@ -40,7 +38,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
private static final VoxelShape SHAPE = Shapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
public BlockSpawnLamp() {
super("spawn_lamp", BlockEntitySpawnLamp::new, Properties.of(Material.METAL).strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
super("spawn_lamp", BlockEntitySpawnLamp.class, Properties.of(Material.METAL).strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -19,7 +19,6 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BucketPickup;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.api.distmarker.Dist;
@ -31,7 +30,7 @@ import java.util.function.Supplier;
public class BlockSpring extends BlockContainerImpl implements ICustomBlockState, IColorProvidingBlock, IColorProvidingItem, BucketPickup, ICustomRenderType {
public BlockSpring() {
super("spring", BlockEntitySpring::new, Properties.copy(Blocks.STONE_BRICKS));
super("spring", BlockEntitySpring.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -9,7 +9,7 @@ import net.minecraft.world.level.material.Material;
public class BlockTimeChanger extends BlockContainerImpl implements ICustomBlockState {
public BlockTimeChanger() {
super("time_changer", BlockEntityTimeChanger::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("time_changer", BlockEntityTimeChanger.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
}
@Override

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Blocks;
public class BlockWeatherChanger extends BlockContainerImpl implements ICustomBlockState {
public BlockWeatherChanger() {
super("weather_changer", BlockEntityWeatherChanger::new, Properties.copy(Blocks.STONE_BRICKS));
super("weather_changer", BlockEntityWeatherChanger.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -3,11 +3,10 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityWoodStand;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
@ -15,13 +14,10 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
@ -42,7 +38,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
private static final VoxelShape SHAPE = Shapes.create(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F);
public BlockWoodStand() {
super("wood_stand", BlockEntityWoodStand::new, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
super("wood_stand", BlockEntityWoodStand.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
MinecraftForge.EVENT_BUS.register(this);
}
@ -115,6 +111,6 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.WOOD_STAND, RenderWoodStand::new);
BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new);
}
}

View file

@ -26,7 +26,7 @@ public class BlockEntityAncientLeaves extends BlockEntityImpl {
};
public BlockEntityAncientLeaves(BlockPos pos, BlockState state) {
super(ModTileEntities.ANCIENT_LEAVES, pos, state);
super(ModBlockEntities.ANCIENT_LEAVES, pos, state);
}
@Override

View file

@ -13,7 +13,7 @@ import java.util.Set;
public class BlockEntityAnimalContainer extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityAnimalContainer(BlockPos pos, BlockState state) {
super(ModTileEntities.ANIMAL_CONTAINER, pos, state);
super(ModBlockEntities.ANIMAL_CONTAINER, pos, state);
}
public int getRadius() {

View file

@ -11,7 +11,7 @@ public class BlockEntityAnimalGenerator extends BlockEntityImpl implements ITick
private int amountToRelease;
public BlockEntityAnimalGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.ANIMAL_GENERATOR, pos, state);
super(ModBlockEntities.ANIMAL_GENERATOR, pos, state);
}
@Override

View file

@ -15,7 +15,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
@ -33,7 +32,7 @@ public class BlockEntityAnimalSpawner extends BlockEntityImpl implements ITickab
private Entity entityClient;
public BlockEntityAnimalSpawner(BlockPos pos, BlockState state) {
super(ModTileEntities.ANIMAL_SPAWNER, pos, state);
super(ModBlockEntities.ANIMAL_SPAWNER, pos, state);
}
@Override

View file

@ -10,7 +10,7 @@ public class BlockEntityAuraBloom extends BlockEntityImpl implements ITickableBl
public boolean justGenerated;
public BlockEntityAuraBloom(BlockPos pos, BlockState state) {
this(ModTileEntities.AURA_BLOOM, pos, state);
this(ModBlockEntities.AURA_BLOOM, pos, state);
}
protected BlockEntityAuraBloom(BlockEntityType<BlockEntityAuraBloom> type, BlockPos pos, BlockState state) {

View file

@ -10,7 +10,7 @@ public class BlockEntityAuraDetector extends BlockEntityImpl implements ITickabl
public int redstonePower;
public BlockEntityAuraDetector(BlockPos pos, BlockState state) {
super(ModTileEntities.AURA_DETECTOR, pos, state);
super(ModBlockEntities.AURA_DETECTOR, pos, state);
}
@Override

View file

@ -31,7 +31,7 @@ public class BlockEntityAuraTimer extends BlockEntityImpl implements ITickableBl
private int timer;
public BlockEntityAuraTimer(BlockPos pos, BlockState state) {
super(ModTileEntities.AURA_TIMER, pos, state);
super(ModBlockEntities.AURA_TIMER, pos, state);
}
@Override

View file

@ -5,7 +5,6 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.EntitySelector;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
@ -25,7 +24,7 @@ public class BlockEntityAutoCrafter extends BlockEntityImpl implements ITickable
}, 3, 3);
public BlockEntityAutoCrafter(BlockPos pos, BlockState state) {
super(ModTileEntities.AUTO_CRAFTER, pos, state);
super(ModBlockEntities.AUTO_CRAFTER, pos, state);
}
@Override

View file

@ -5,15 +5,12 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
@ -22,7 +19,7 @@ import java.util.List;
public class BlockEntityBlastFurnaceBooster extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityBlastFurnaceBooster(BlockPos pos, BlockState state) {
super(ModTileEntities.BLAST_FURNACE_BOOSTER, pos, state);
super(ModBlockEntities.BLAST_FURNACE_BOOSTER, pos, state);
}
@Override

View file

@ -23,7 +23,7 @@ public class BlockEntityChorusGenerator extends BlockEntityImpl implements ITick
private int auraPerBlock;
public BlockEntityChorusGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.CHORUS_GENERATOR, pos, state);
super(ModBlockEntities.CHORUS_GENERATOR, pos, state);
}
@Override

View file

@ -20,7 +20,7 @@ public class BlockEntityChunkLoader extends BlockEntityImpl implements ITickable
private boolean firstTick = true;
public BlockEntityChunkLoader(BlockPos pos, BlockState state) {
super(ModTileEntities.CHUNK_LOADER, pos, state);
super(ModBlockEntities.CHUNK_LOADER, pos, state);
}
@Override

View file

@ -9,14 +9,11 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import java.util.List;
public class BlockEntityEndFlower extends BlockEntityImpl implements ITickableBlockEntity {
private final BasicAuraContainer container = new BasicAuraContainer(null, 500000) {
@ -46,7 +43,7 @@ public class BlockEntityEndFlower extends BlockEntityImpl implements ITickableBl
public boolean isDrainMode;
public BlockEntityEndFlower(BlockPos pos, BlockState state) {
super(ModTileEntities.END_FLOWER, pos, state);
super(ModBlockEntities.END_FLOWER, pos, state);
}
@Override

View file

@ -76,7 +76,7 @@ public class BlockEntityEnderCrate extends BlockEntityImpl implements MenuProvid
};
public BlockEntityEnderCrate(BlockPos pos, BlockState state) {
super(ModTileEntities.ENDER_CRATE, pos, state);
super(ModBlockEntities.ENDER_CRATE, pos, state);
}
@Override

View file

@ -10,22 +10,17 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.event.world.BlockEvent;
import java.util.List;
public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickableBlockEntity {
public BlockPos connectionOffset;
@ -34,7 +29,7 @@ public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickabl
private int chargeTimer;
public BlockEntityFieldCreator(BlockPos pos, BlockState state) {
super(ModTileEntities.FIELD_CREATOR, pos, state);
super(ModBlockEntities.FIELD_CREATOR, pos, state);
}
@Override

View file

@ -5,8 +5,6 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
@ -29,7 +27,7 @@ public class BlockEntityFireworkGenerator extends BlockEntityImpl implements ITi
private int releaseTimer;
public BlockEntityFireworkGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.FIREWORK_GENERATOR, pos, state);
super(ModBlockEntities.FIREWORK_GENERATOR, pos, state);
}
@Override

View file

@ -9,10 +9,8 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.commons.lang3.mutable.MutableInt;
@ -27,7 +25,7 @@ public class BlockEntityFlowerGenerator extends BlockEntityImpl implements ITick
private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>();
public BlockEntityFlowerGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.FLOWER_GENERATOR, pos, state);
super(ModBlockEntities.FLOWER_GENERATOR, pos, state);
}
@Override

View file

@ -8,17 +8,14 @@ import de.ellpeck.naturesaura.blocks.BlockFurnaceHeater;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticleStream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.AbstractFurnaceBlock;
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.SmokerBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
@ -27,11 +24,11 @@ import java.lang.reflect.Field;
public class BlockEntityFurnaceHeater extends BlockEntityImpl implements ITickableBlockEntity {
private static final Field FURNACE_DATA_FIELD = ObfuscationReflectionHelper.findField(AbstractFurnaceBlockEntity.class, "dataAccess");
private static final Field FURNACE_DATA_FIELD = ObfuscationReflectionHelper.findField(AbstractFurnaceBlockEntity.class, "f_58311_");
public boolean isActive;
public BlockEntityFurnaceHeater(BlockPos pos, BlockState state) {
super(ModTileEntities.FURNACE_HEATER, pos, state);
super(ModBlockEntities.FURNACE_HEATER, pos, state);
}
public static ContainerData getFurnaceData(AbstractFurnaceBlockEntity tile) {

View file

@ -9,7 +9,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockEntityGeneratorLimitRemover extends BlockEntityImpl {
public BlockEntityGeneratorLimitRemover(BlockPos pos, BlockState state) {
super(ModTileEntities.GENERATOR_LIMIT_REMOVER, pos, state);
super(ModBlockEntities.GENERATOR_LIMIT_REMOVER, pos, state);
}
@Override

View file

@ -5,18 +5,13 @@ import de.ellpeck.naturesaura.blocks.BlockGratedChute;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import java.util.List;
public class BlockEntityGratedChute extends BlockEntityImpl implements ITickableBlockEntity {
public boolean isBlacklist;
@ -34,7 +29,7 @@ public class BlockEntityGratedChute extends BlockEntityImpl implements ITickable
private int cooldown;
public BlockEntityGratedChute(BlockPos pos, BlockState state) {
super(ModTileEntities.GRATED_CHUTE, pos, state);
super(ModBlockEntities.GRATED_CHUTE, pos, state);
}
@Override
@ -80,7 +75,7 @@ public class BlockEntityGratedChute extends BlockEntityImpl implements ITickable
if (stack.isEmpty())
continue;
var left = this.items.insertItem(0, stack, false);
if (!ItemStack.isSame(stack, left)) {
if (!ItemStack.matches(stack, left)) {
if (left.isEmpty()) {
item.kill();
} else {

View file

@ -13,14 +13,11 @@ import net.minecraft.world.level.block.entity.HopperBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.List;
public class BlockEntityHopperUpgrade extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityHopperUpgrade(BlockPos pos, BlockState state) {
super(ModTileEntities.HOPPER_UPGRADE, pos, state);
super(ModBlockEntities.HOPPER_UPGRADE, pos, state);
}
private static boolean isValidHopper(BlockEntity tile) {
@ -62,7 +59,7 @@ public class BlockEntityHopperUpgrade extends BlockEntityImpl implements ITickab
}
}
if (!ItemStack.isSame(stack, copy)) {
if (!ItemStack.matches(stack, copy)) {
item.setItem(copy);
if (copy.isEmpty())
item.kill();

View file

@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@ -19,7 +18,7 @@ public class BlockEntityItemDistributor extends BlockEntityImpl implements ITick
public boolean isRandomMode;
public BlockEntityItemDistributor(BlockPos pos, BlockState state) {
super(ModTileEntities.ITEM_DISTRIBUTOR, pos, state);
super(ModBlockEntities.ITEM_DISTRIBUTOR, pos, state);
}
@Override
@ -44,7 +43,7 @@ public class BlockEntityItemDistributor extends BlockEntityImpl implements ITick
continue;
for (var j = 0; j < dest.getSlots(); j++) {
var remain = dest.insertItem(j, stack, false);
if (!ItemStack.isSame(remain, stack)) {
if (!ItemStack.matches(remain, stack)) {
above.extractItem(i, 1, false);
this.cooldown = 3;
return;

View file

@ -15,7 +15,7 @@ import java.util.List;
public class BlockEntityMossGenerator extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityMossGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.MOSS_GENERATOR, pos, state);
super(ModBlockEntities.MOSS_GENERATOR, pos, state);
}
@Override

View file

@ -65,7 +65,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
private boolean firstTick = true;
public BlockEntityNatureAltar(BlockPos pos, BlockState state) {
super(ModTileEntities.NATURE_ALTAR, pos, state);
super(ModBlockEntities.NATURE_ALTAR, pos, state);
}
@Override

View file

@ -14,7 +14,7 @@ public class BlockEntityOakGenerator extends BlockEntityImpl implements ITickabl
public Queue<BlockPos> scheduledBigTrees = new ArrayDeque<>();
public BlockEntityOakGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.OAK_GENERATOR, pos, state);
super(ModBlockEntities.OAK_GENERATOR, pos, state);
}
@Override

View file

@ -9,9 +9,7 @@ import de.ellpeck.naturesaura.recipes.OfferingRecipe;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -23,7 +21,6 @@ import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Queue;
public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickableBlockEntity {
@ -37,7 +34,7 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab
private final Queue<ItemStack> itemsToSpawn = new ArrayDeque<>();
public BlockEntityOfferingTable(BlockPos pos, BlockState state) {
super(ModTileEntities.OFFERING_TABLE, pos, state);
super(ModBlockEntities.OFFERING_TABLE, pos, state);
}
private OfferingRecipe getRecipe(ItemStack input) {

View file

@ -6,7 +6,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class BlockEntityPickupStopper extends BlockEntityImpl {
public BlockEntityPickupStopper(BlockPos pos, BlockState state) {
super(ModTileEntities.PICKUP_STOPPER, pos, state);
super(ModBlockEntities.PICKUP_STOPPER, pos, state);
}
public float getRadius() {

View file

@ -13,15 +13,12 @@ import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.ArrayList;
import java.util.List;
@ -29,7 +26,7 @@ import java.util.List;
public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityPlacer(BlockPos pos, BlockState state) {
super(ModTileEntities.PLACER, pos, state);
super(ModBlockEntities.PLACER, pos, state);
}
@Override
@ -71,7 +68,7 @@ public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlock
var pos = validPositions.get(this.level.random.nextInt(validPositions.size()));
var left = this.tryPlace(stack.copy(), pos);
if (ItemStack.isSame(stack, left))
if (ItemStack.matches(stack, left))
continue;
handler.extractItem(i, 1, false);

View file

@ -4,20 +4,15 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import java.util.List;
public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityPotionGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.POTION_GENERATOR, pos, state);
super(ModBlockEntities.POTION_GENERATOR, pos, state);
}
@Override

View file

@ -5,19 +5,14 @@ import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.List;
public class BlockEntityPowderPlacer extends BlockEntityImpl {
public BlockEntityPowderPlacer(BlockPos pos, BlockState state) {
super(ModTileEntities.POWDER_PLACER, pos, state);
super(ModBlockEntities.POWDER_PLACER, pos, state);
}
@Override

View file

@ -10,7 +10,7 @@ public class BlockEntityProjectileGenerator extends BlockEntityImpl {
public Direction nextSide = Direction.NORTH;
public BlockEntityProjectileGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.PROJECTILE_GENERATOR, pos, state);
super(ModBlockEntities.PROJECTILE_GENERATOR, pos, state);
}
@Override

View file

@ -9,7 +9,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
@ -26,7 +25,7 @@ public class BlockEntityRFConverter extends BlockEntityImpl implements ITickable
private int lastEnergy;
public BlockEntityRFConverter(BlockPos pos, BlockState state) {
super(ModTileEntities.RF_CONVERTER, pos, state);
super(ModBlockEntities.RF_CONVERTER, pos, state);
}
@Override

View file

@ -15,7 +15,7 @@ public class BlockEntitySlimeSplitGenerator extends BlockEntityImpl implements I
private int color;
public BlockEntitySlimeSplitGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.SLIME_SPLIT_GENERATOR, pos, state);
super(ModBlockEntities.SLIME_SPLIT_GENERATOR, pos, state);
}
@Override

View file

@ -13,7 +13,6 @@ import net.minecraft.world.entity.animal.SnowGolem;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Fluids;
public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickableBlockEntity {
@ -21,7 +20,7 @@ public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickable
private int snowmanCount;
public BlockEntitySnowCreator(BlockPos pos, BlockState state) {
super(ModTileEntities.SNOW_CREATOR, pos, state);
super(ModBlockEntities.SNOW_CREATOR, pos, state);
}
public int getRange() {

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class BlockEntitySpawnLamp extends BlockEntityImpl {
public BlockEntitySpawnLamp(BlockPos pos, BlockState state) {
super(ModTileEntities.SPAWN_LAMP, pos, state);
super(ModBlockEntities.SPAWN_LAMP, pos, state);
}
public int getRadius() {

View file

@ -11,7 +11,6 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.common.FarmlandWaterManager;
@ -30,7 +29,7 @@ public class BlockEntitySpring extends BlockEntityImpl implements ITickableBlock
private AABBTicket waterTicket;
public BlockEntitySpring(BlockPos pos, BlockState state) {
super(ModTileEntities.SPRING, pos, state);
super(ModBlockEntities.SPRING, pos, state);
}
@Override

View file

@ -9,26 +9,21 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.game.ClientboundSetTimePacket;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.players.PlayerList;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.phys.AABB;
import java.util.List;
public class BlockEntityTimeChanger extends BlockEntityImpl implements ITickableBlockEntity {
private long goalTime;
public BlockEntityTimeChanger(BlockPos pos, BlockState state) {
super(ModTileEntities.TIME_CHANGER, pos, state);
super(ModBlockEntities.TIME_CHANGER, pos, state);
}
@Override

View file

@ -14,9 +14,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
import java.util.Map;
public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITickableBlockEntity {
private int processTime;
@ -24,7 +21,7 @@ public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITicka
private int itemAmount;
public BlockEntityWeatherChanger(BlockPos pos, BlockState state) {
super(ModTileEntities.WEATHER_CHANGER, pos, state);
super(ModBlockEntities.WEATHER_CHANGER, pos, state);
}
@Override

View file

@ -17,7 +17,6 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
@ -40,7 +39,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
private int timer;
public BlockEntityWoodStand(BlockPos pos, BlockState state) {
super(ModTileEntities.WOOD_STAND, pos, state);
super(ModBlockEntities.WOOD_STAND, pos, state);
}
public void setRitual(BlockPos pos, TreeRitualRecipe recipe) {

View file

@ -1,8 +1,14 @@
package de.ellpeck.naturesaura.blocks.tiles;
// TODO actually call this from the base entity block thing, and possibly others if not all use the base one!
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
public interface ITickableBlockEntity {
void tick();
static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> actual, BlockEntityType<E> expected) {
return expected == actual ? (l, p, s, e) -> ((ITickableBlockEntity) e).tick() : null;
}
}

View file

@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks.tiles;
import net.minecraft.world.level.block.entity.BlockEntityType;
@SuppressWarnings("FieldNamingConvention")
public final class ModTileEntities {
public final class ModBlockEntities {
public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES;
public static BlockEntityType<BlockEntityAnimalGenerator> ANIMAL_GENERATOR;

View file

@ -1,23 +1,31 @@
package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraTimer;
import de.ellpeck.naturesaura.items.ItemAuraBottle;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import java.util.List;
public class RenderAuraTimer implements BlockEntityRenderer<BlockEntityAuraTimer> {
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/aura_timer_aura.png");
// private final AuraModel model = new AuraModel();
private final AuraModel model = new AuraModel();
public RenderAuraTimer(BlockEntityRendererProvider.Context context) {
}
@Override
@ -35,26 +43,26 @@ public class RenderAuraTimer implements BlockEntityRenderer<BlockEntityAuraTimer
var r = (type.getColor() >> 16 & 255) / 255F;
var g = (type.getColor() >> 8 & 255) / 255F;
var b = (type.getColor() & 255) / 255F;
//this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), combinedLightIn, combinedOverlayIn, r, g, b, 0.75F);
this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(RES)), combinedLightIn, combinedOverlayIn, r, g, b, 0.75F);
stack.popPose();
}
// TODO model rendering
/* private static class AuraModel extends Model {
private static class AuraModel extends Model {
private final ModelRenderer box;
private final ModelPart model;
public AuraModel() {
super(RenderType::getEntityTranslucent);
this.box = new ModelRenderer(this, 0, 0);
this.box.setTextureSize(64, 64);
this.box.addBox(0, 0, 0, 16, 16, 16);
super(RenderType::entityTranslucent);
var mesh = new MeshDefinition();
var part = mesh.getRoot();
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 16, 16), PartPose.ZERO);
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
}
@Override
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
}
}*/
}
}

View file

@ -11,7 +11,6 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
// TODO get the 1-pixel border around the ender overlay back
@OnlyIn(Dist.CLIENT)
public class RenderEnderCrate implements BlockEntityRenderer<BlockEntityEnderCrate> {
@ -27,10 +26,10 @@ public class RenderEnderCrate implements BlockEntityRenderer<BlockEntityEnderCra
}
private static void renderFace(Matrix4f p_173696_, VertexConsumer p_173697_, float p_173700_, float p_173701_) {
p_173697_.vertex(p_173696_, (float) 0.0, p_173700_, (float) 1.0).endVertex();
p_173697_.vertex(p_173696_, (float) 1.0, p_173700_, (float) 1.0).endVertex();
p_173697_.vertex(p_173696_, (float) 1.0, p_173701_, (float) 0.0).endVertex();
p_173697_.vertex(p_173696_, (float) 0.0, p_173701_, (float) 0.0).endVertex();
p_173697_.vertex(p_173696_, (float) 1 / 16F, p_173700_, (float) 15 / 16F).endVertex();
p_173697_.vertex(p_173696_, (float) 15 / 16F, p_173700_, (float) 15 / 16F).endVertex();
p_173697_.vertex(p_173696_, (float) 15 / 16F, p_173701_, (float) 1 / 16F).endVertex();
p_173697_.vertex(p_173696_, (float) 1 / 16F, p_173701_, (float) 1 / 16F).endVertex();
}
private static float getOffsetUp() {

View file

@ -1,11 +1,19 @@
package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
@ -17,7 +25,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class RenderGeneratorLimitRemover implements BlockEntityRenderer<BlockEntityGeneratorLimitRemover> {
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/generator_limit_remover_glint.png");
//private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint();
private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint();
public RenderGeneratorLimitRemover(BlockEntityRendererProvider.Context context) {
@ -39,25 +47,25 @@ public class RenderGeneratorLimitRemover implements BlockEntityRenderer<BlockEnt
stack.translate(-0.001F, yOff + 1 + 0.001F, 1 + 0.001F);
stack.mulPose(Vector3f.XP.rotationDegrees(180F));
stack.scale(1.002F, 1.002F, 1.002F);
//this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, alpha);
this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, alpha);
stack.popPose();
}
// TODO model rendering
/* private static class ModelLimitRemoverGlint extends Model {
private static class ModelLimitRemoverGlint extends Model {
private final ModelRenderer box;
private final ModelPart model;
public ModelLimitRemoverGlint() {
super(RenderType::getEntityTranslucent);
this.box = new ModelRenderer(this, 0, 0);
this.box.setTextureSize(64, 64);
this.box.addBox(0, 0, 0, 16, 16, 16);
super(RenderType::entityTranslucent);
var mesh = new MeshDefinition();
var part = mesh.getRoot();
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 16, 16), PartPose.ZERO);
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
}
@Override
public void render(MatrixStack matrixStack, IVertexBuilder iVertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.box.render(matrixStack, iVertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, alpha);
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
}
}*/
}
}

View file

@ -1,10 +1,18 @@
package de.ellpeck.naturesaura.blocks.tiles.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.Direction;
@ -16,7 +24,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class RenderProjectileGenerator implements BlockEntityRenderer<BlockEntityProjectileGenerator> {
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png");
//private final ModelOverlay model = new ModelOverlay();
private final ModelOverlay model = new ModelOverlay();
public RenderProjectileGenerator(BlockEntityRendererProvider.Context context) {
@ -38,25 +46,25 @@ public class RenderProjectileGenerator implements BlockEntityRenderer<BlockEntit
stack.translate(-0.002F, 0, 0);
}
var brightness = 15 << 20 | 15 << 4;
//this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, 1);
this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, 1);
stack.popPose();
}
// TODO model rendering
/* private static class ModelOverlay extends Model {
private static class ModelOverlay extends Model {
private final ModelPart box;
private final ModelPart model;
public ModelOverlay() {
super(RenderType::entityTranslucent);
this.box = new ModelPart(this, 0, 0);
this.box.setTextureSize(64, 64);
this.box.(0, 0, 0, 16, 16, 16);
var mesh = new MeshDefinition();
var part = mesh.getRoot();
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 16, 16), PartPose.ZERO);
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
}
@Override
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
}
}*/
}
}

View file

@ -16,8 +16,8 @@ public final class Compat {
private static final Map<String, Supplier<ICompat>> MODULE_TYPES = ImmutableMap.<String, Supplier<ICompat>>builder()
.put("patchouli", PatchouliCompat::new)
/* .put("curios", CuriosCompat::new)
.put("enchantability", EnchantibilityCompat::new)*/
.put("curios", CuriosCompat::new)
//.put("enchantability", EnchantibilityCompat::new)
.build();
private static final Map<String, ICompat> MODULES = new HashMap<>();

View file

@ -1,18 +1,14 @@
// TODO Curios
/*
package de.ellpeck.naturesaura.compat;
import com.google.common.collect.ImmutableMap;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.data.ItemTagProvider;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.ITag;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
@ -58,14 +54,18 @@ public class CuriosCompat implements ICompat {
}
private void onCapabilitiesAttach(AttachCapabilitiesEvent<ItemStack> event) {
ItemStack stack = event.getObject();
var stack = event.getObject();
if (TYPES.containsKey(stack.getItem())) {
event.addCapability(new ResourceLocation(NaturesAura.MOD_ID, "curios"), new ICapabilityProvider() {
private final LazyOptional<ICurio> curio = LazyOptional.of(() -> new ICurio() {
@Override
public void curioTick(String identifier, int index, LivingEntity livingEntity) {
stack.getItem().inventoryTick(stack, livingEntity.level, livingEntity, -1, false);
public void curioTick(SlotContext slotContext) {
stack.getItem().inventoryTick(stack, slotContext.entity().level, slotContext.entity(), -1, false);
}
@Override
public ItemStack getStack() {
return stack;
}
@Override
@ -74,7 +74,7 @@ public class CuriosCompat implements ICompat {
}
@Override
public boolean canSync(String identifier, int index, LivingEntity livingEntity) {
public boolean canSync(SlotContext slotContext) {
return true;
}
});
@ -92,10 +92,9 @@ public class CuriosCompat implements ICompat {
@Override
public void addItemTags(ItemTagProvider provider) {
for (Map.Entry<Item, String> entry : TYPES.entrySet()) {
ITag.INamedTag<Item> tag = ItemTags.createOptional(new ResourceLocation("curios", entry.getValue()));
provider.getOrCreateBuilder(tag).add(entry.getKey());
for (var entry : TYPES.entrySet()) {
var tag = ItemTags.createOptional(new ResourceLocation("curios", entry.getValue()));
provider.tag(tag).add(entry.getKey());
}
}
}
*/

View file

@ -1,4 +1,3 @@
// TODO Enchantability
/*
package de.ellpeck.naturesaura.compat.enchantibility;

View file

@ -1,4 +1,3 @@
// TODO Enchantability
/*
package de.ellpeck.naturesaura.compat.enchantibility;

View file

@ -1,4 +1,3 @@
/*
package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList;
@ -8,14 +7,14 @@ import de.ellpeck.naturesaura.recipes.AltarRecipe;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import java.util.Arrays;
import java.util.Collections;
@ -40,8 +39,8 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
}
@Override
public String getTitle() {
return I18n.format("container." + JEINaturesAuraPlugin.ALTAR + ".name");
public Component getTitle() {
return new TranslatableComponent("container." + JEINaturesAuraPlugin.ALTAR + ".name");
}
@Override
@ -57,9 +56,9 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
@Override
public void setIngredients(AltarRecipe altarRecipe, IIngredients iIngredients) {
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
builder.add(altarRecipe.input.getMatchingStacks());
builder.add(altarRecipe.input.getItems());
if (altarRecipe.catalyst != Ingredient.EMPTY)
builder.add(altarRecipe.catalyst.getMatchingStacks());
builder.add(altarRecipe.catalyst.getItems());
if (altarRecipe.requiredType != null)
builder.add(altarRecipe.getDimensionBottle());
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
@ -68,17 +67,16 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
@Override
public void setRecipe(IRecipeLayout iRecipeLayout, AltarRecipe recipe, IIngredients iIngredients) {
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
var group = iRecipeLayout.getItemStacks();
group.init(0, true, 0, 18);
group.set(0, Arrays.asList(recipe.input.getMatchingStacks()));
group.set(0, Arrays.asList(recipe.input.getItems()));
group.init(1, false, 80, 18);
group.set(1, recipe.output);
group.init(2, true, 26, 18);
group.set(2, recipe.catalyst == Ingredient.EMPTY ?
Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getMatchingStacks()));
Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getItems()));
group.init(3, true, 51, 18);
if (recipe.requiredType != null)
group.set(3, recipe.getDimensionBottle());
}
}
*/

View file

@ -1,32 +1,28 @@
/*
package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.Lighting;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
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.entity.EntityRendererManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
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.BlockPos;
import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.ForgeSpawnEggItem;
import java.util.Arrays;
import java.util.HashMap;
@ -35,48 +31,53 @@ import java.util.Map;
public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecipe> {
private final IDrawable background;
private final Map<EntityType, Entity> entityCache = new HashMap<>();
private final Map<EntityType<?>, Entity> entityCache = new HashMap<>();
public AnimalSpawnerCategory(IGuiHelper helper) {
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/animal_spawner.png"), 0, 0, 72, 86);
}
private static void renderEntity(MatrixStack matrixstack, int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
float f = (float) Math.atan(yaw / 40.0F);
float f1 = (float) Math.atan(pitch / 40.0F);
RenderSystem.pushMatrix();
RenderSystem.translatef((float) x, (float) y, 1050.0F);
RenderSystem.scalef(1.0F, 1.0F, -1.0F);
private static void renderEntity(PoseStack matrixstack, int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
var f = (float) Math.atan(yaw / 40.0F);
var f1 = (float) Math.atan(pitch / 40.0F);
var posestack = RenderSystem.getModelViewStack();
posestack.pushPose();
posestack.translate(x, y, 1050.0D);
posestack.scale(1.0F, 1.0F, -1.0F);
RenderSystem.applyModelViewMatrix();
matrixstack.translate(0.0D, 0.0D, 1000.0D);
matrixstack.scale(scale, scale, scale);
Quaternion quaternion = Vector3f.ZP.rotationDegrees(180.0F);
Quaternion quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
quaternion.multiply(quaternion1);
matrixstack.rotate(quaternion);
float f2 = entity.renderYawOffset;
float f3 = entity.rotationYaw;
float f4 = entity.rotationPitch;
float f5 = entity.prevRotationYawHead;
float f6 = entity.rotationYawHead;
entity.renderYawOffset = 180.0F + f * 20.0F;
entity.rotationYaw = 180.0F + f * 40.0F;
entity.rotationPitch = -f1 * 20.0F;
entity.rotationYawHead = entity.rotationYaw;
entity.prevRotationYawHead = entity.rotationYaw;
EntityRendererManager entityrenderermanager = Minecraft.getInstance().getRenderManager();
quaternion1.conjugate();
entityrenderermanager.setCameraOrientation(quaternion1);
var quaternion = Vector3f.ZP.rotationDegrees(180.0F);
var quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
quaternion.mul(quaternion1);
matrixstack.mulPose(quaternion);
var f2 = entity.yBodyRot;
var f3 = entity.getYRot();
var f4 = entity.getXRot();
var f5 = entity.yHeadRotO;
var f6 = entity.yHeadRot;
entity.yBodyRot = 180.0F + f * 20.0F;
entity.setYRot(180.0F + f * 40.0F);
entity.setXRot(-f1 * 20.0F);
entity.yHeadRot = entity.getYRot();
entity.yHeadRotO = entity.getYRot();
Lighting.setupForEntityInInventory();
var entityrenderermanager = Minecraft.getInstance().getEntityRenderDispatcher();
quaternion1.conj();
entityrenderermanager.overrideCameraOrientation(quaternion1);
entityrenderermanager.setRenderShadow(false);
IRenderTypeBuffer.Impl buff = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
entityrenderermanager.renderEntityStatic(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
buff.finish();
var buff = Minecraft.getInstance().renderBuffers().bufferSource();
entityrenderermanager.render(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
buff.endBatch();
entityrenderermanager.setRenderShadow(true);
entity.renderYawOffset = f2;
entity.rotationYaw = f3;
entity.rotationPitch = f4;
entity.prevRotationYawHead = f5;
entity.rotationYawHead = f6;
RenderSystem.popMatrix();
entity.yBodyRot = f2;
entity.setYRot(f3);
entity.setXRot(f4);
entity.yHeadRotO = f5;
entity.yHeadRot = f6;
posestack.popPose();
RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
}
@Override
@ -90,8 +91,8 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
}
@Override
public String getTitle() {
return I18n.format("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
public Component getTitle() {
return new TranslatableComponent("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
}
@Override
@ -107,38 +108,37 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
@Override
public void setIngredients(AnimalSpawnerRecipe animalSpawnerRecipe, IIngredients iIngredients) {
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
for (Ingredient ing : animalSpawnerRecipe.ingredients)
builder.add(ing.getMatchingStacks());
for (var ing : animalSpawnerRecipe.ingredients)
builder.add(ing.getItems());
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
iIngredients.setOutput(VanillaTypes.ITEM, new ItemStack(SpawnEggItem.getEgg(animalSpawnerRecipe.entity)));
iIngredients.setOutput(VanillaTypes.ITEM, new ItemStack(ForgeSpawnEggItem.fromEntityType(animalSpawnerRecipe.entity)));
}
@Override
public void setRecipe(IRecipeLayout iRecipeLayout, AnimalSpawnerRecipe recipe, IIngredients iIngredients) {
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
for (int i = 0; i < recipe.ingredients.length; i++) {
var group = iRecipeLayout.getItemStacks();
for (var i = 0; i < recipe.ingredients.length; i++) {
group.init(i, true, i * 18, 68);
group.set(i, Arrays.asList(recipe.ingredients[i].getMatchingStacks()));
group.set(i, Arrays.asList(recipe.ingredients[i].getItems()));
}
}
@Override
public void draw(AnimalSpawnerRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
Minecraft minecraft = Minecraft.getInstance();
Entity entity = this.entityCache.get(recipe.entity);
public void draw(AnimalSpawnerRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
var minecraft = Minecraft.getInstance();
var entity = this.entityCache.get(recipe.entity);
if (entity == null) {
entity = recipe.makeEntity(minecraft.level, BlockPos.ZERO);
this.entityCache.put(recipe.entity, entity);
}
matrixStack.push();
float size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
matrixStack.pushPose();
var size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
renderEntity(matrixStack, 35, 55, 100F / size * 0.4F, 40, size * 0.5F, (LivingEntity) entity);
matrixStack.pop();
matrixStack.popPose();
String name = recipe.entity.getName().getString();
minecraft.fontRenderer.drawStringWithShadow(matrixStack, name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
var name = recipe.entity.getDescription().getString();
minecraft.font.drawShadow(matrixStack, name, 36 - minecraft.font.width(name) / 2F, 55, 0xFFFFFF);
}
}
*/

View file

@ -1,9 +1,7 @@
/*
package de.ellpeck.naturesaura.compat.jei;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.items.ItemAuraBottle;
import de.ellpeck.naturesaura.items.ItemEffectPowder;
@ -11,16 +9,14 @@ import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.subtypes.ISubtypeInterpreter;
import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter;
import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeCategoryRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.registration.ISubtypeRegistration;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
@JeiPlugin
public class JEINaturesAuraPlugin implements IModPlugin {
@ -37,7 +33,7 @@ public class JEINaturesAuraPlugin implements IModPlugin {
@Override
public void registerCategories(IRecipeCategoryRegistration registry) {
IGuiHelper helper = registry.getJeiHelpers().getGuiHelper();
var helper = registry.getJeiHelpers().getGuiHelper();
registry.addRecipeCategories(
new TreeRitualCategory(helper),
new AltarCategory(helper),
@ -48,14 +44,14 @@ public class JEINaturesAuraPlugin implements IModPlugin {
@Override
public void registerItemSubtypes(ISubtypeRegistration registration) {
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, stack -> ItemEffectPowder.getEffect(stack).toString());
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, stack -> ItemAuraBottle.getType(stack).getName().toString());
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, (stack, context) -> ItemEffectPowder.getEffect(stack).toString());
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, (stack, context) -> ItemAuraBottle.getType(stack).getName().toString());
ISubtypeInterpreter auraInterpreter = stack -> {
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
var auraInterpreter = (IIngredientSubtypeInterpreter<ItemStack>) (stack, context) -> {
var container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
if (container != null)
return String.valueOf(container.getStoredAura());
return ISubtypeInterpreter.NONE;
return IIngredientSubtypeInterpreter.NONE;
};
registration.registerSubtypeInterpreter(ModItems.AURA_CACHE, auraInterpreter);
registration.registerSubtypeInterpreter(ModItems.AURA_TROVE, auraInterpreter);
@ -72,11 +68,10 @@ public class JEINaturesAuraPlugin implements IModPlugin {
@Override
public void registerRecipes(IRecipeRegistration registration) {
RecipeManager manager = Minecraft.getInstance().level.getRecipeManager();
registration.addRecipes(manager.getRecipes(ModRecipes.TREE_RITUAL_TYPE, null, null), TREE_RITUAL);
registration.addRecipes(manager.getRecipes(ModRecipes.ALTAR_TYPE, null, null), ALTAR);
registration.addRecipes(manager.getRecipes(ModRecipes.OFFERING_TYPE, null, null), OFFERING);
registration.addRecipes(manager.getRecipes(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null), SPAWNER);
var manager = Minecraft.getInstance().level.getRecipeManager();
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.TREE_RITUAL_TYPE), TREE_RITUAL);
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.ALTAR_TYPE), ALTAR);
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.OFFERING_TYPE), OFFERING);
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.ANIMAL_SPAWNER_TYPE), SPAWNER);
}
}
*/

View file

@ -1,4 +1,3 @@
/*
package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList;
@ -11,9 +10,10 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import java.util.Arrays;
@ -36,8 +36,8 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
}
@Override
public String getTitle() {
return I18n.format("container." + JEINaturesAuraPlugin.OFFERING + ".name");
public Component getTitle() {
return new TranslatableComponent("container." + JEINaturesAuraPlugin.OFFERING + ".name");
}
@Override
@ -53,8 +53,8 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
@Override
public void setIngredients(OfferingRecipe offeringRecipe, IIngredients iIngredients) {
iIngredients.setInputs(VanillaTypes.ITEM, ImmutableList.<ItemStack>builder()
.add(offeringRecipe.input.getMatchingStacks())
.add(offeringRecipe.startItem.getMatchingStacks()).build());
.add(offeringRecipe.input.getItems())
.add(offeringRecipe.startItem.getItems()).build());
iIngredients.setOutput(VanillaTypes.ITEM, offeringRecipe.output);
}
@ -62,11 +62,10 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
public void setRecipe(IRecipeLayout recipeLayout, OfferingRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup group = recipeLayout.getItemStacks();
group.init(0, true, 0, 14);
group.set(0, Arrays.asList(recipe.input.getMatchingStacks()));
group.set(0, Arrays.asList(recipe.input.getItems()));
group.init(1, false, 65, 14);
group.set(1, recipe.output);
group.init(2, true, 27, 0);
group.set(2, Arrays.asList(recipe.startItem.getMatchingStacks()));
group.set(2, Arrays.asList(recipe.startItem.getItems()));
}
}
*/

View file

@ -1,4 +1,3 @@
/*
package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList;
@ -7,14 +6,13 @@ import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import java.util.Arrays;
@ -37,8 +35,8 @@ public class TreeRitualCategory implements IRecipeCategory<TreeRitualRecipe> {
}
@Override
public String getTitle() {
return I18n.format("container." + JEINaturesAuraPlugin.TREE_RITUAL + ".name");
public Component getTitle() {
return new TranslatableComponent("container." + JEINaturesAuraPlugin.TREE_RITUAL + ".name");
}
@Override
@ -54,28 +52,27 @@ public class TreeRitualCategory implements IRecipeCategory<TreeRitualRecipe> {
@Override
public void setIngredients(TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
for (Ingredient ing : treeRitualRecipe.ingredients)
builder.add(ing.getMatchingStacks());
builder.add(treeRitualRecipe.saplingType.getMatchingStacks());
for (var ing : treeRitualRecipe.ingredients)
builder.add(ing.getItems());
builder.add(treeRitualRecipe.saplingType.getItems());
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
iIngredients.setOutput(VanillaTypes.ITEM, treeRitualRecipe.result);
}
@Override
public void setRecipe(IRecipeLayout iRecipeLayout, TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
var group = iRecipeLayout.getItemStacks();
group.init(0, true, 34, 34);
group.set(0, Arrays.asList(treeRitualRecipe.saplingType.getMatchingStacks()));
group.set(0, Arrays.asList(treeRitualRecipe.saplingType.getItems()));
group.init(1, true, 124, 34);
group.set(1, treeRitualRecipe.result);
int[][] positions = new int[][]{{35, 1}, {35, 69}, {1, 35}, {69, 35}, {12, 12}, {58, 58}, {58, 12}, {12, 58}};
for (int i = 0; i < treeRitualRecipe.ingredients.length; i++) {
var positions = new int[][]{{35, 1}, {35, 69}, {1, 35}, {69, 35}, {12, 12}, {58, 58}, {58, 12}, {12, 58}};
for (var i = 0; i < treeRitualRecipe.ingredients.length; i++) {
group.init(i + 2, true, positions[i][0] - 1, positions[i][1] - 1);
group.set(i + 2, Arrays.asList(treeRitualRecipe.ingredients[i].getMatchingStacks()));
group.set(i + 2, Arrays.asList(treeRitualRecipe.ingredients[i].getItems()));
}
}
}
*/

View file

@ -138,8 +138,7 @@ public class PatchouliCompat implements ICompat {
var r = ((info.color() >> 16) & 255) / 255F;
var g = ((info.color() >> 8) & 255) / 255F;
var b = (info.color() & 255) / 255F;
// TODO apply leaf color?
//RenderSystem.color3f(r, g, b);
RenderSystem.setShaderColor(r, g, b, 1);
Screen.blit(event.getPoseStack(), x, y, 496 - 32, 44, 16, 18, 512, 256);
}

View file

@ -8,6 +8,8 @@ import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.data.ExistingFileHelper;
@ -31,4 +33,9 @@ public class ItemTagProvider extends ItemTagsProvider {
Compat.addItemTags(this);
}
@Override
public TagAppender<Item> tag(Tag.Named<Item> p_126549_) {
// super is protected, but CuriosCompat needs this
return super.tag(p_126549_);
}
}

View file

@ -19,14 +19,15 @@ import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.EntityDamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
import org.jetbrains.annotations.Nullable;
// TODO these behave very weirdly in-world
public class EntityEffectInhibitor extends Entity implements IVisualizable {
private static final EntityDataAccessor<String> INHIBITED_EFFECT = SynchedEntityData.defineId(EntityEffectInhibitor.class, EntityDataSerializers.STRING);
@ -108,11 +109,6 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
}
}
@Override
public boolean canBeCollidedWith() {
return true;
}
@Override
protected void readAdditionalSaveData(CompoundTag compound) {
this.setInhibitedEffect(new ResourceLocation(compound.getString("effect")));
@ -132,14 +128,32 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
return NetworkHooks.getEntitySpawningPacket(this);
}
@Override
public boolean skipAttackInteraction(Entity entity) {
return entity instanceof Player player && (!this.level.mayInteract(player, this.blockPosition()) || this.hurt(DamageSource.playerAttack(player), 0.0F));
}
@Override
public boolean hurt(DamageSource source, float amount) {
if (source instanceof EntityDamageSource && !this.level.isClientSide) {
this.kill();
this.spawnAtLocation(this.getDrop(), 0F);
return true;
} else
} else {
return super.hurt(source, amount);
}
}
@Override
public boolean isPickable() {
// SOMEHOW, this actually means "is raytraceable" IN GENERAL even though getPickResult is about middle-clicking, jesus fucking christ mojang
return true;
}
@Nullable
@Override
public ItemStack getPickResult() {
return this.getDrop();
}
public ItemStack getDrop() {

View file

@ -1,13 +1,22 @@
package de.ellpeck.naturesaura.entities.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MinecartRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.state.BlockState;
@ -18,7 +27,8 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
public RenderMoverMinecart(EntityRendererProvider.Context p_174300_) {
super(p_174300_, ModelLayers.MINECART);
}
//private final ModelMoverMinecart model = new ModelMoverMinecart();
private final ModelMoverMinecart model = new ModelMoverMinecart();
@Override
protected void renderMinecartContents(EntityMoverMinecart entityIn, float partialTicks, BlockState stateIn, PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn) {
@ -26,25 +36,25 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
matrixStackIn.translate(0, 22 / 16F, 0);
matrixStackIn.translate(0, 0, 1);
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(180));
//this.model.render(matrixStackIn, bufferIn.getBuffer(this.model.getRenderType(RES)), packedLightIn, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
this.model.renderToBuffer(matrixStackIn, bufferIn.getBuffer(this.model.renderType(RES)), packedLightIn, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
matrixStackIn.popPose();
}
// TODO model rendering
/* private static class ModelMoverMinecart extends Model {
private static class ModelMoverMinecart extends Model {
private final ModelRenderer box;
private final ModelPart model;
public ModelMoverMinecart() {
super(RenderType::getEntityCutout);
this.box = new ModelRenderer(this, 0, 0);
this.box.setTextureSize(64, 64);
this.box.addBox(0, 0, 0, 16, 24, 16);
super(RenderType::entityCutout);
var mesh = new MeshDefinition();
var part = mesh.getRoot();
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 24, 16), PartPose.ZERO);
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
}
@Override
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
}
}*/
}
}

View file

@ -1,32 +1,44 @@
package de.ellpeck.naturesaura.events;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.ModConfig;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.blocks.tiles.*;
import de.ellpeck.naturesaura.items.ItemAuraCache;
import de.ellpeck.naturesaura.items.ItemRangeVisualizer;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.packet.PacketAuraChunk;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.ChatScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.BiomeColors;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.util.Tuple;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.MyceliumBlock;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderLevelLastEvent;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.apache.commons.lang3.mutable.MutableInt;
@ -236,131 +248,132 @@ public class ClientEvents {
@SubscribeEvent
public void onOverlayRender(RenderGameOverlayEvent.Post event) {
// TODO raw rendering bleh, should be easy enough to convert to PoseStack stuff
/*Minecraft mc = Minecraft.getInstance();
PoseStack stack = event.getMatrixStack();
if (event.getType() == ElementType.ALL) {
var mc = Minecraft.getInstance();
var stack = event.getMatrixStack();
if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
var res = event.getWindow();
if (mc.player != null) {
if (!heldCache.isEmpty()) {
IAuraContainer container = heldCache.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
int width = Mth.ceil(container.getStoredAura() / (float) container.getMaxAura() * 80);
var container = heldCache.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
var width = Mth.ceil(container.getStoredAura() / (float) container.getMaxAura() * 80);
int conf = ModConfig.instance.cacheBarLocation.get();
int x = res.getGuiScaledWidth() / 2 + (conf == 0 ? -173 - (mc.player.getOffhandItem().isEmpty() ? 0 : 29) : 93);
int y = res.getScreenHeight() - 8;
var x = res.getGuiScaledWidth() / 2 + (conf == 0 ? -173 - (mc.player.getOffhandItem().isEmpty() ? 0 : 29) : 93);
var y = res.getGuiScaledHeight() - 8;
RenderSystem.pushMatrix();
stack.pushPose();
int color = container.getAuraColor();
RenderSystem.color4f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
mc.getTextureManager().bindTexture(OVERLAYS);
var color = container.getAuraColor();
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
RenderSystem.setShaderTexture(0, OVERLAYS);
if (width < 80)
AbstractGui.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
Screen.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
if (width > 0)
AbstractGui.blit(stack, x, y, 0, 6, width, 6, 256, 256);
Screen.blit(stack, x, y, 0, 6, width, 6, 256, 256);
float scale = 0.75F;
RenderSystem.scalef(scale, scale, scale);
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);
var scale = 0.75F;
stack.pushPose();
stack.scale(scale, scale, scale);
var s = heldCache.getDisplayName().getString();
mc.font.drawShadow(stack, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color);
stack.popPose();
RenderSystem.color4f(1F, 1F, 1F, 1);
RenderSystem.popMatrix();
RenderSystem.setShaderColor(1F, 1F, 1F, 1);
stack.pushPose();
}
if (!heldEye.isEmpty() || !heldOcular.isEmpty()) {
RenderSystem.pushMatrix();
mc.getTextureManager().bindTexture(OVERLAYS);
stack.pushPose();
RenderSystem.setShaderTexture(0, OVERLAYS);
int conf = ModConfig.instance.auraBarLocation.get();
if (!mc.gameSettings.showDebugInfo && (conf != 2 || !(mc.currentScreen instanceof ChatScreen))) {
int color = IAuraType.forLevel(mc.level).getColor();
RenderSystem.color4f((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1);
if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) {
var color = IAuraType.forLevel(mc.level).getColor();
RenderSystem.setShaderColor((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1);
int totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.getPosition(), 35);
float totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F);
String text = I18n.format("info." + NaturesAura.MOD_ID + ".aura_in_area");
float textScale = 0.75F;
var totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.blockPosition(), 35);
var totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F);
var text = I18n.get("info." + NaturesAura.MOD_ID + ".aura_in_area");
var textScale = 0.75F;
int startX = conf % 2 == 0 ? 3 : res.getScaledWidth() - 3 - 6;
int startY = conf < 2 ? 10 : (!heldOcular.isEmpty() && (totalPercentage > 1F || totalPercentage < 0) ? -26 : 0) + res.getScaledHeight() - 60;
var startX = conf % 2 == 0 ? 3 : res.getGuiScaledWidth() - 3 - 6;
var startY = conf < 2 ? 10 : (!heldOcular.isEmpty() && (totalPercentage > 1F || totalPercentage < 0) ? -26 : 0) + res.getGuiScaledHeight() - 60;
float plusOffX = conf % 2 == 0 ? 7 : -1 - 6;
float textX = conf % 2 == 0 ? 3 : res.getScaledWidth() - 3 - mc.fontRenderer.getStringWidth(text) * textScale;
float textY = conf < 2 ? 3 : res.getScaledHeight() - 3 - 6;
var textX = conf % 2 == 0 ? 3 : res.getGuiScaledWidth() - 3 - mc.font.width(text) * textScale;
float textY = conf < 2 ? 3 : res.getGuiScaledHeight() - 3 - 6;
int tHeight = Mth.ceil(Mth.clamp(totalPercentage, 0F, 1F) * 50);
int y = !heldOcular.isEmpty() && totalPercentage > 1F ? startY + 26 : startY;
var tHeight = Mth.ceil(Mth.clamp(totalPercentage, 0F, 1F) * 50);
var y = !heldOcular.isEmpty() && totalPercentage > 1F ? startY + 26 : startY;
if (tHeight < 50)
AbstractGui.blit(stack, startX, y, 6, 12, 6, 50 - tHeight, 256, 256);
Screen.blit(stack, startX, y, 6, 12, 6, 50 - tHeight, 256, 256);
if (tHeight > 0)
AbstractGui.blit(stack, startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256);
Screen.blit(stack, startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256);
if (!heldOcular.isEmpty()) {
int topHeight = Mth.ceil(Mth.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25);
var topHeight = Mth.ceil(Mth.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25);
if (topHeight > 0) {
if (topHeight < 25)
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);
Screen.blit(stack, startX, startY, 18, 12, 6, 25 - topHeight, 256, 256);
Screen.blit(stack, startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256);
}
int bottomHeight = Mth.floor(Mth.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25);
var bottomHeight = Mth.floor(Mth.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25);
if (bottomHeight < 25) {
AbstractGui.blit(stack, startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256);
Screen.blit(stack, startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256);
if (bottomHeight > 0)
AbstractGui.blit(stack, startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256);
Screen.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(stack, "+", startX + plusOffX, startY - 0.5F, color);
mc.font.drawShadow(stack, "+", startX + plusOffX, startY - 0.5F, color);
if (totalPercentage < (heldOcular.isEmpty() ? 0F : -0.5F))
mc.fontRenderer.drawStringWithShadow(stack, "-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color);
mc.font.drawShadow(stack, "-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color);
RenderSystem.pushMatrix();
RenderSystem.scalef(textScale, textScale, textScale);
mc.fontRenderer.drawStringWithShadow(stack, text, textX / textScale, textY / textScale, color);
RenderSystem.popMatrix();
stack.pushPose();
stack.scale(textScale, textScale, textScale);
mc.font.drawShadow(stack, text, textX / textScale, textY / textScale, color);
stack.popPose();
if (!heldOcular.isEmpty()) {
float scale = 0.75F;
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, scale);
int stackX = conf % 2 == 0 ? 10 : res.getScaledWidth() - 22;
int stackY = conf < 2 ? 15 : res.getScaledHeight() - 55;
for (Tuple<ItemStack, Boolean> effect : SHOWING_EFFECTS.values()) {
int theX = (int) (stackX / scale);
int theY = (int) (stackY / scale);
ItemStack itemStack = effect.getA();
var scale = 0.75F;
stack.pushPose();
stack.scale(scale, scale, scale);
var stackX = conf % 2 == 0 ? 10 : res.getGuiScaledWidth() - 22;
var stackY = conf < 2 ? 15 : res.getGuiScaledHeight() - 55;
for (var effect : SHOWING_EFFECTS.values()) {
var theX = (int) (stackX / scale);
var theY = (int) (stackY / scale);
var itemStack = effect.getA();
Helper.renderItemInGui(itemStack, theX, theY, 1F);
if (effect.getB()) {
GlStateManager.disableDepthTest();
mc.getTextureManager().bindTexture(OVERLAYS);
AbstractGui.blit(stack, theX, theY, 240, 0, 16, 16, 256, 256);
GlStateManager.enableDepthTest();
RenderSystem.disableDepthTest();
RenderSystem.setShaderTexture(0, OVERLAYS);
Screen.blit(stack, theX, theY, 240, 0, 16, 16, 256, 256);
RenderSystem.enableDepthTest();
}
stackY += 8;
}
RenderSystem.popMatrix();
stack.popPose();
}
}
if (mc.objectMouseOver instanceof BlockRayTraceResult) {
BlockPos pos = ((BlockRayTraceResult) mc.objectMouseOver).getPos();
if (mc.hitResult instanceof BlockHitResult blockHitResult) {
var pos = blockHitResult.getBlockPos();
if (pos != null) {
BlockEntity tile = mc.level.getBlockEntity(pos);
var tile = mc.level.getBlockEntity(pos);
IAuraContainer container;
int x = res.getScaledWidth() / 2;
int y = res.getScaledHeight() / 2;
var x = res.getGuiScaledWidth() / 2;
var y = res.getGuiScaledHeight() / 2;
if (tile != null && (container = tile.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null)) != null) {
BlockState state = mc.level.getBlockState(pos);
ItemStack blockStack = state.getBlock().getPickBlock(state, mc.objectMouseOver, mc.level, pos, mc.player);
var state = mc.level.getBlockState(pos);
var blockStack = state.getBlock().getCloneItemStack(state, blockHitResult, mc.level, pos, mc.player);
this.drawContainerInfo(stack, container.getStoredAura(), container.getMaxAura(), container.getAuraColor(),
mc, res, 35, blockStack.getDisplayName().getString(), null);
if (tile instanceof BlockEntityNatureAltar) {
ItemStack tileStack = ((BlockEntityNatureAltar) tile).getItemHandler().getStackInSlot(0);
var tileStack = ((BlockEntityNatureAltar) tile).getItemHandler().getStackInSlot(0);
if (!tileStack.isEmpty()) {
IAuraContainer stackCont = tileStack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
var stackCont = tileStack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
if (stackCont != null) {
this.drawContainerInfo(stack, stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(),
mc, res, 55, tileStack.getDisplayName().getString(), null);
@ -370,50 +383,48 @@ public class ClientEvents {
} else if (tile instanceof BlockEntityRFConverter) {
EnergyStorage storage = ((BlockEntityRFConverter) tile).storage;
this.drawContainerInfo(stack, storage.getEnergyStored(), storage.getMaxEnergyStored(), 0xcc4916,
mc, res, 35, I18n.format("block.naturesaura.rf_converter"),
mc, res, 35, I18n.get("block.naturesaura.rf_converter"),
storage.getEnergyStored() + " / " + storage.getMaxEnergyStored() + " RF");
} else if (tile instanceof BlockEntityGratedChute) {
BlockEntityGratedChute chute = (BlockEntityGratedChute) tile;
ItemStack itemStack = chute.getItemHandler().getStackInSlot(0);
} else if (tile instanceof BlockEntityGratedChute chute) {
var itemStack = chute.getItemHandler().getStackInSlot(0);
if (itemStack.isEmpty())
mc.fontRenderer.drawStringWithShadow(stack,
TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.format("info.naturesaura.empty"),
if (itemStack.isEmpty()) {
mc.font.drawShadow(stack,
ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info.naturesaura.empty"),
x + 5, y - 11, 0xFFFFFF);
else
} else {
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(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
GlStateManager.enableDepthTest();
} else if (tile instanceof BlockEntityItemDistributor) {
BlockEntityItemDistributor distributor = (BlockEntityItemDistributor) tile;
RenderSystem.setShaderTexture(0, OVERLAYS);
var u = chute.isBlacklist ? 240 : 224;
RenderSystem.disableDepthTest();
Screen.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
RenderSystem.enableDepthTest();
} else if (tile instanceof BlockEntityItemDistributor distributor) {
Helper.renderItemInGui(DISPENSER, x - 24, y - 24, 1F);
mc.getTextureManager().bindTexture(OVERLAYS);
int u = !distributor.isRandomMode ? 240 : 224;
GlStateManager.disableDepthTest();
AbstractGui.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
GlStateManager.enableDepthTest();
} else if (tile instanceof BlockEntityAuraTimer) {
BlockEntityAuraTimer timer = (BlockEntityAuraTimer) tile;
ItemStack itemStack = timer.getItemHandler().getStackInSlot(0);
RenderSystem.setShaderTexture(0, OVERLAYS);
var u = !distributor.isRandomMode ? 240 : 224;
RenderSystem.disableDepthTest();
Screen.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
RenderSystem.enableDepthTest();
} else if (tile instanceof BlockEntityAuraTimer timer) {
var itemStack = timer.getItemHandler().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);
mc.font.drawShadow(stack, ChatFormatting.GRAY + this.createTimeString(timer.getTotalTime()), x + 5, y - 11, 0xFFFFFF);
mc.font.drawShadow(stack, ChatFormatting.GRAY + I18n.get("info.naturesaura.remaining", this.createTimeString(timer.getTimeLeft())), x + 5, y + 3, 0xFFFFFF);
}
}
}
}
RenderSystem.color4f(1F, 1F, 1F, 1);
RenderSystem.popMatrix();
RenderSystem.setShaderColor(1F, 1F, 1F, 1);
stack.popPose();
}
}
}*/
}
}
private String createTimeString(int totalTicks) {
@ -424,22 +435,22 @@ public class ClientEvents {
return String.format("%02d:%02d:%02d.%02d", hours, minutes, seconds, ticks);
}
/* private void drawContainerInfo(PoseStack 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);
private void drawContainerInfo(PoseStack stack, int stored, int max, int color, Minecraft mc, Window res, int yOffset, String name, String textBelow) {
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
int x = res.getScaledWidth() / 2 - 40;
int y = res.getScaledHeight() / 2 + yOffset;
int width = Mth.ceil(stored / (float) max * 80);
var x = res.getGuiScaledWidth() / 2 - 40;
var y = res.getGuiScaledHeight() / 2 + yOffset;
var width = Mth.ceil(stored / (float) max * 80);
mc.getTextureManager().bindTexture(OVERLAYS);
RenderSystem.setShaderTexture(0, OVERLAYS);
if (width < 80)
AbstractGui.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
Screen.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
if (width > 0)
AbstractGui.blit(stack, x, y, 0, 6, width, 6, 256, 256);
Screen.blit(stack, x, y, 0, 6, width, 6, 256, 256);
mc.fontRenderer.drawStringWithShadow(stack, name, x + 40 - mc.fontRenderer.getStringWidth(name) / 2F, y - 9, color);
mc.font.drawShadow(stack, name, x + 40 - mc.font.width(name) / 2F, y - 9, color);
if (textBelow != null)
mc.fontRenderer.drawStringWithShadow(stack, textBelow, x + 40 - mc.fontRenderer.getStringWidth(textBelow) / 2F, y + 7, color);
}*/
mc.font.drawShadow(stack, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color);
}
}

View file

@ -19,11 +19,8 @@ import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.TickEvent;
@ -37,28 +34,26 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.UUID;
import static net.minecraft.world.level.levelgen.GenerationStep.Decoration;
public class CommonEvents {
private static final Method GET_LOADED_CHUNKS_METHOD = ObfuscationReflectionHelper.findMethod(ChunkMap.class, "getChunks");
private static final Method GET_LOADED_CHUNKS_METHOD = ObfuscationReflectionHelper.findMethod(ChunkMap.class, "m_140416_");
private static final ListMultimap<UUID, ChunkPos> PENDING_AURA_CHUNKS = ArrayListMultimap.create();
@SubscribeEvent
public void onBiomeLoad(BiomeLoadingEvent event) {
if (ModConfig.instance.auraBlooms.get()) {
// TODO features might have to be registered *AGAIN* now because .placed() is another thing again oh my God
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_BLOOM.placed());
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.AURA_BLOOM);
switch (event.getCategory()) {
case DESERT -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_CACTUS.placed());
case DESERT -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.AURA_CACTUS);
case NETHER -> {
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.placed());
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.WARPED_AURA_MUSHROOM.placed());
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.CRIMSON_AURA_MUSHROOM);
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.WARPED_AURA_MUSHROOM);
}
case MUSHROOM -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_MUSHROOM.placed());
case MUSHROOM -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.AURA_MUSHROOM);
}
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@SuppressWarnings("FieldNamingConvention")
public final class ModFeatures {
@ -20,7 +21,6 @@ public final class ModFeatures {
public static final class Configured {
public static final ConfiguredFeature<TreeConfiguration, ?> ANCIENT_TREE = ModFeatures.ANCIENT_TREE.configured(new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> NETHER_WART_MUSHROOM = ModFeatures.NETHER_WART_MUSHROOM.configured(FeatureConfiguration.NONE);
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_BLOOM = ModFeatures.AURA_BLOOM.configured(FeatureConfiguration.NONE);
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_CACTUS = ModFeatures.AURA_CACTUS.configured(FeatureConfiguration.NONE);
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> WARPED_AURA_MUSHROOM = ModFeatures.WARPED_AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
@ -28,4 +28,14 @@ public final class ModFeatures {
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_MUSHROOM = ModFeatures.AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
}
public static final class Placed {
public static final PlacedFeature AURA_BLOOM = ModFeatures.Configured.AURA_BLOOM.placed();
public static final PlacedFeature AURA_CACTUS = ModFeatures.Configured.AURA_CACTUS.placed();
public static final PlacedFeature WARPED_AURA_MUSHROOM = ModFeatures.Configured.WARPED_AURA_MUSHROOM.placed();
public static final PlacedFeature CRIMSON_AURA_MUSHROOM = ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.placed();
public static final PlacedFeature AURA_MUSHROOM = ModFeatures.Configured.AURA_MUSHROOM.placed();
}
}

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