mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-25 04:58:33 +01:00
Compare commits
No commits in common. "29b067d294a7f4bb8ecc452b4c0ad5fc4405c55a" and "8fd1b0333e1d94d96318b58f4580c04d58bbe013" have entirely different histories.
29b067d294
...
8fd1b0333e
103 changed files with 578 additions and 596 deletions
14
build.gradle
14
build.gradle
|
@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings channel: 'official', version: '1.18.1'
|
mappings channel: 'official', version: '1.18'
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
client {
|
client {
|
||||||
|
@ -102,16 +102,18 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
|
minecraft 'net.minecraftforge:forge:1.18-38.0.14'
|
||||||
|
|
||||||
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47:api")
|
// TODO JEI
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47")
|
/* 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("vazkii.patchouli:Patchouli:1.18.1-61:api")
|
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-61:api")
|
||||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-61")
|
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-61")
|
||||||
|
|
||||||
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0")
|
// TODO Curios
|
||||||
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0:api")
|
/* 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")*/
|
||||||
|
|
||||||
// TODO Enchantability
|
// TODO Enchantability
|
||||||
/* compile fg.deobf("quarris.enchantability:Enchantability:11.0.48")*/
|
/* compile fg.deobf("quarris.enchantability:Enchantability:11.0.48")*/
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
package de.ellpeck.naturesaura;
|
package de.ellpeck.naturesaura;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||||
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
|
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
|
||||||
import de.ellpeck.naturesaura.api.misc.ILevelData;
|
import de.ellpeck.naturesaura.api.misc.ILevelData;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
|
||||||
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
||||||
import de.ellpeck.naturesaura.compat.Compat;
|
|
||||||
import de.ellpeck.naturesaura.misc.LevelData;
|
import de.ellpeck.naturesaura.misc.LevelData;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
@ -42,8 +39,7 @@ import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||||
import org.apache.commons.lang3.tuple.ImmutableTriple;
|
import org.lwjgl.opengl.GL11;
|
||||||
import top.theillusivec4.curios.api.CuriosApi;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -117,19 +113,6 @@ public final class Helper {
|
||||||
return !nbt || ItemStack.tagMatches(first, second);
|
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) {
|
public static InteractionResult putStackOnTile(Player player, InteractionHand hand, BlockPos pos, int slot, boolean sound) {
|
||||||
var tile = player.level.getBlockEntity(pos);
|
var tile = player.level.getBlockEntity(pos);
|
||||||
if (tile instanceof BlockEntityImpl) {
|
if (tile instanceof BlockEntityImpl) {
|
||||||
|
@ -138,7 +121,7 @@ public final class Helper {
|
||||||
var handStack = player.getItemInHand(hand);
|
var handStack = player.getItemInHand(hand);
|
||||||
if (!handStack.isEmpty()) {
|
if (!handStack.isEmpty()) {
|
||||||
var remain = handler.insertItem(slot, handStack, player.level.isClientSide);
|
var remain = handler.insertItem(slot, handStack, player.level.isClientSide);
|
||||||
if (!ItemStack.matches(remain, handStack)) {
|
if (!ItemStack.isSame(remain, handStack)) {
|
||||||
if (sound)
|
if (sound)
|
||||||
player.level.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
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);
|
SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
|
||||||
|
@ -240,6 +223,34 @@ public final class Helper {
|
||||||
return highestAmount;
|
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) {
|
public static boolean isHoldingItem(Player player, Item item) {
|
||||||
for (var hand : InteractionHand.values()) {
|
for (var hand : InteractionHand.values()) {
|
||||||
var stack = player.getItemInHand(hand);
|
var stack = player.getItemInHand(hand);
|
||||||
|
@ -279,11 +290,12 @@ public final class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
|
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
|
||||||
if (Compat.hasCompat("curios")) {
|
// TODO Curios
|
||||||
var stack = CuriosApi.getCuriosHelper().findEquippedCurio(predicate, player).map(ImmutableTriple::getRight);
|
/* if (Compat.hasCompat("curios")) {
|
||||||
|
Optional<ItemStack> stack = CuriosApi.getCuriosHelper().findEquippedCurio(predicate, player).map(ImmutableTriple::getRight);
|
||||||
if (stack.isPresent())
|
if (stack.isPresent())
|
||||||
return stack.get();
|
return stack.get();
|
||||||
}
|
}*/
|
||||||
for (var i = 0; i < player.getInventory().getContainerSize(); i++) {
|
for (var i = 0; i < player.getInventory().getContainerSize(); i++) {
|
||||||
var slot = player.getInventory().getItem(i);
|
var slot = player.getInventory().getItem(i);
|
||||||
if (!slot.isEmpty() && predicate.test(slot))
|
if (!slot.isEmpty() && predicate.test(slot))
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class BlockAnimalContainer extends BlockContainerImpl implements IVisuali
|
||||||
private static final VoxelShape SHAPE = box(5, 0, 5, 11, 13, 11);
|
private static final VoxelShape SHAPE = box(5, 0, 5, 11, 13, 11);
|
||||||
|
|
||||||
public BlockAnimalContainer() {
|
public BlockAnimalContainer() {
|
||||||
super("animal_container", BlockEntityAnimalContainer.class, Properties.copy(Blocks.STONE));
|
super("animal_container", BlockEntityAnimalContainer::new, Properties.copy(Blocks.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,7 +9,9 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.entity.animal.Animal;
|
import net.minecraft.world.entity.animal.Animal;
|
||||||
import net.minecraft.world.entity.npc.Npc;
|
import net.minecraft.world.entity.npc.Npc;
|
||||||
|
@ -29,7 +31,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockAnimalGenerator() {
|
public BlockAnimalGenerator() {
|
||||||
super("animal_generator", BlockEntityAnimalGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
super("animal_generator", BlockEntityAnimalGenerator::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@ import net.minecraft.world.level.material.Material;
|
||||||
public class BlockAnimalSpawner extends BlockContainerImpl {
|
public class BlockAnimalSpawner extends BlockContainerImpl {
|
||||||
|
|
||||||
public BlockAnimalSpawner() {
|
public BlockAnimalSpawner() {
|
||||||
super("animal_spawner", BlockEntityAnimalSpawner.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
super("animal_spawner", BlockEntityAnimalSpawner::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraBloom;
|
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.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.*;
|
import de.ellpeck.naturesaura.reg.*;
|
||||||
|
@ -18,13 +16,11 @@ import net.minecraft.world.level.block.BushBlock;
|
||||||
import net.minecraft.world.level.block.EntityBlock;
|
import net.minecraft.world.level.block.EntityBlock;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
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.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
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.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
@ -90,10 +86,4 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
|
||||||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
||||||
return new BlockEntityAuraBloom(pos, 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,14 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraDetector;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
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.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
|
|
||||||
public class BlockAuraDetector extends BlockContainerImpl {
|
public class BlockAuraDetector extends BlockContainerImpl {
|
||||||
|
|
||||||
public BlockAuraDetector() {
|
public BlockAuraDetector() {
|
||||||
super("aura_detector", BlockEntityAuraDetector.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
super("aura_detector", BlockEntityAuraDetector::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraTimer;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraTimer;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderAuraTimer;
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderAuraTimer;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
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);
|
private static final VoxelShape SHAPE = box(1, 0, 1, 15, 15, 15);
|
||||||
|
|
||||||
public BlockAuraTimer() {
|
public BlockAuraTimer() {
|
||||||
super("aura_timer", BlockEntityAuraTimer.class, Properties.copy(Blocks.SMOOTH_STONE));
|
super("aura_timer", BlockEntityAuraTimer::new, Properties.copy(Blocks.SMOOTH_STONE));
|
||||||
this.registerDefaultState(this.defaultBlockState().setValue(BlockStateProperties.POWERED, false));
|
this.registerDefaultState(this.defaultBlockState().setValue(BlockStateProperties.POWERED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,6 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.AURA_TIMER, RenderAuraTimer::new);
|
BlockEntityRenderers.register(ModTileEntities.AURA_TIMER, RenderAuraTimer::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class BlockAutoCrafter extends BlockContainerImpl implements ICustomBlock
|
||||||
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||||
|
|
||||||
public BlockAutoCrafter() {
|
public BlockAutoCrafter() {
|
||||||
super("auto_crafter", BlockEntityAutoCrafter.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
|
super("auto_crafter", BlockEntityAutoCrafter::new, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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);
|
private static final VoxelShape SHAPE = Shapes.create(1 / 16F, 0, 1 / 16F, 15 / 16F, 1, 15 / 16F);
|
||||||
|
|
||||||
public BlockBlastFurnaceBooster() {
|
public BlockBlastFurnaceBooster() {
|
||||||
super("blast_furnace_booster", BlockEntityBlastFurnaceBooster.class, Block.Properties.copy(Blocks.BLAST_FURNACE).lightLevel(s -> 0));
|
super("blast_furnace_booster", BlockEntityBlastFurnaceBooster::new, Block.Properties.copy(Blocks.BLAST_FURNACE).lightLevel(s -> 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
public class BlockChorusGenerator extends BlockContainerImpl implements ICustomBlockState {
|
public class BlockChorusGenerator extends BlockContainerImpl implements ICustomBlockState {
|
||||||
|
|
||||||
public BlockChorusGenerator() {
|
public BlockChorusGenerator() {
|
||||||
super("chorus_generator", BlockEntityChorusGenerator.class, Properties.copy(Blocks.END_STONE));
|
super("chorus_generator", BlockEntityChorusGenerator::new, Properties.copy(Blocks.END_STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
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.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
@ -27,7 +28,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
|
||||||
private static final VoxelShape SHAPE = box(4, 4, 4, 12, 12, 12);
|
private static final VoxelShape SHAPE = box(4, 4, 4, 12, 12, 12);
|
||||||
|
|
||||||
public BlockChunkLoader() {
|
public BlockChunkLoader() {
|
||||||
super("chunk_loader", BlockEntityChunkLoader.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
super("chunk_loader", BlockEntityChunkLoader::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
|
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.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
import de.ellpeck.naturesaura.reg.ModTileType;
|
import de.ellpeck.naturesaura.reg.ModTileType;
|
||||||
|
@ -20,7 +19,6 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.RenderShape;
|
import net.minecraft.world.level.block.RenderShape;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
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.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
|
@ -31,22 +29,19 @@ import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
||||||
|
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
private final Class<? extends BlockEntity> tileClass;
|
private final ModTileType<BlockEntity> tileType;
|
||||||
private final ModTileType<? extends BlockEntity> tileType;
|
|
||||||
|
|
||||||
public BlockContainerImpl(String baseName, Class<? extends BlockEntity> tileClass, Block.Properties properties) {
|
public BlockContainerImpl(String baseName, BlockEntityType.BlockEntitySupplier<BlockEntity> tileSupplier, Block.Properties properties) {
|
||||||
super(properties);
|
super(properties);
|
||||||
|
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
this.tileClass = tileClass;
|
this.tileType = new ModTileType<>(tileSupplier, this);
|
||||||
this.tileType = new ModTileType<>(this::createBlockEntity, this);
|
|
||||||
|
|
||||||
ModRegistry.add(this);
|
ModRegistry.add(this);
|
||||||
ModRegistry.add(this.tileType);
|
ModRegistry.add(this.tileType);
|
||||||
|
@ -90,14 +85,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
||||||
@org.jetbrains.annotations.Nullable
|
@org.jetbrains.annotations.Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
||||||
return this.createBlockEntity(pos, state);
|
return this.tileType.type.create(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
|
@Override
|
||||||
|
@ -176,12 +164,4 @@ 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,14 +1,13 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEndFlower;
|
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.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.*;
|
import de.ellpeck.naturesaura.reg.*;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -20,14 +19,13 @@ import net.minecraft.world.level.block.BushBlock;
|
||||||
import net.minecraft.world.level.block.EntityBlock;
|
import net.minecraft.world.level.block.EntityBlock;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
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.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
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.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -91,12 +89,6 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
||||||
return new BlockEntityEndFlower(pos, state);
|
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
|
@Override
|
||||||
public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest, FluidState fluid) {
|
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);
|
return willHarvest || super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid);
|
||||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.misc.ILevelData;
|
import de.ellpeck.naturesaura.api.misc.ILevelData;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
|
@ -43,7 +43,7 @@ import java.util.Random;
|
||||||
public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider<BlockEntityEnderCrate>, ICustomBlockState {
|
public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider<BlockEntityEnderCrate>, ICustomBlockState {
|
||||||
|
|
||||||
public BlockEnderCrate() {
|
public BlockEnderCrate() {
|
||||||
super("ender_crate", BlockEntityEnderCrate.class, Properties.of(Material.STONE).strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
|
super("ender_crate", BlockEntityEnderCrate::new, Properties.of(Material.STONE).strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
@ -131,6 +131,6 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.ENDER_CRATE, RenderEnderCrate::new);
|
BlockEntityRenderers.register(ModTileEntities.ENDER_CRATE, RenderEnderCrate::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,14 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomRenderType;
|
import de.ellpeck.naturesaura.reg.ICustomRenderType;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
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.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
@ -26,7 +28,7 @@ import java.util.function.Supplier;
|
||||||
public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState, ICustomRenderType {
|
public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState, ICustomRenderType {
|
||||||
|
|
||||||
public BlockFieldCreator() {
|
public BlockFieldCreator() {
|
||||||
super("field_creator", BlockEntityFieldCreator.class, Properties.of(Material.STONE).strength(2F).noCollission().sound(SoundType.STONE));
|
super("field_creator", BlockEntityFieldCreator::new, Properties.of(Material.STONE).strength(2F).noCollission().sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockFireworkGenerator() {
|
public BlockFireworkGenerator() {
|
||||||
super("firework_generator", BlockEntityFireworkGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
super("firework_generator", BlockEntityFireworkGenerator::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockFlowerGenerator() {
|
public BlockFlowerGenerator() {
|
||||||
super("flower_generator", BlockEntityFlowerGenerator.class, Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F));
|
super("flower_generator", BlockEntityFlowerGenerator::new, Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
|
||||||
};
|
};
|
||||||
|
|
||||||
public BlockFurnaceHeater() {
|
public BlockFurnaceHeater() {
|
||||||
super("furnace_heater", BlockEntityFurnaceHeater.class, Properties.of(Material.STONE).strength(3F));
|
super("furnace_heater", BlockEntityFurnaceHeater::new, Properties.of(Material.STONE).strength(3F));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover;
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
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 class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider<BlockEntityGeneratorLimitRemover>, ICustomBlockState {
|
||||||
|
|
||||||
public BlockGeneratorLimitRemover() {
|
public BlockGeneratorLimitRemover() {
|
||||||
super("generator_limit_remover", BlockEntityGeneratorLimitRemover.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
super("generator_limit_remover", BlockEntityGeneratorLimitRemover::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,6 +26,6 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
|
BlockEntityRenderers.register(ModTileEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
@ -18,6 +19,7 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.HopperBlock;
|
import net.minecraft.world.level.block.HopperBlock;
|
||||||
import net.minecraft.world.level.block.RenderShape;
|
import net.minecraft.world.level.block.RenderShape;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
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.entity.Hopper;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
|
@ -51,7 +53,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));
|
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() {
|
public BlockGratedChute() {
|
||||||
super("grated_chute", BlockEntityGratedChute.class, Properties.of(Material.METAL).strength(3.0F, 8.0F).sound(SoundType.METAL));
|
super("grated_chute", BlockEntityGratedChute::new, Properties.of(Material.METAL).strength(3.0F, 8.0F).sound(SoundType.METAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
|
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
|
||||||
|
|
||||||
public BlockHopperUpgrade() {
|
public BlockHopperUpgrade() {
|
||||||
super("hopper_upgrade", BlockEntityHopperUpgrade.class, Properties.of(Material.METAL).strength(2.5F).sound(SoundType.METAL));
|
super("hopper_upgrade", BlockEntityHopperUpgrade::new, Properties.of(Material.METAL).strength(2.5F).sound(SoundType.METAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,13 +9,14 @@ import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
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.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
|
||||||
public class BlockItemDistributor extends BlockContainerImpl implements ICustomBlockState {
|
public class BlockItemDistributor extends BlockContainerImpl implements ICustomBlockState {
|
||||||
|
|
||||||
public BlockItemDistributor() {
|
public BlockItemDistributor() {
|
||||||
super("item_distributor", BlockEntityItemDistributor.class, Properties.copy(Blocks.STONE_BRICKS));
|
super("item_distributor", BlockEntityItemDistributor::new, Properties.copy(Blocks.STONE_BRICKS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
|
public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
|
||||||
|
|
||||||
public BlockMossGenerator() {
|
public BlockMossGenerator() {
|
||||||
super("moss_generator", BlockEntityMossGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
super("moss_generator", BlockEntityMossGenerator::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
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 static final BooleanProperty NETHER = BooleanProperty.create("nether");
|
||||||
|
|
||||||
public BlockNatureAltar() {
|
public BlockNatureAltar() {
|
||||||
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of(Material.STONE).strength(4F));
|
super("nature_altar", BlockEntityNatureAltar::new, Block.Properties.of(Material.STONE).strength(4F));
|
||||||
this.registerDefaultState(this.defaultBlockState().setValue(NETHER, false));
|
this.registerDefaultState(this.defaultBlockState().setValue(NETHER, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,6 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.NATURE_ALTAR, RenderNatureAltar::new);
|
BlockEntityRenderers.register(ModTileEntities.NATURE_ALTAR, RenderNatureAltar::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,12 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
|
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockOakGenerator() {
|
public BlockOakGenerator() {
|
||||||
super("oak_generator", BlockEntityOakGenerator.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
|
super("oak_generator", BlockEntityOakGenerator::new, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityOfferingTable;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityOfferingTable;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable;
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
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);
|
private static final VoxelShape SHAPE = Shapes.create(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
|
||||||
|
|
||||||
public BlockOfferingTable() {
|
public BlockOfferingTable() {
|
||||||
super("offering_table", BlockEntityOfferingTable.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
|
super("offering_table", BlockEntityOfferingTable::new, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,6 +52,6 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.OFFERING_TABLE, RenderOfferingTable::new);
|
BlockEntityRenderers.register(ModTileEntities.OFFERING_TABLE, RenderOfferingTable::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,11 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
import net.minecraft.core.BlockPos;
|
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.Level;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
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.level.material.Material;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
@ -21,7 +24,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockPickupStopper() {
|
public BlockPickupStopper() {
|
||||||
super("pickup_stopper", BlockEntityPickupStopper.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
super("pickup_stopper", BlockEntityPickupStopper::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class BlockPlacer extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockPlacer extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockPlacer() {
|
public BlockPlacer() {
|
||||||
super("placer", BlockEntityPlacer.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
super("placer", BlockEntityPlacer::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.world.level.material.Material;
|
||||||
public class BlockPotionGenerator extends BlockContainerImpl implements ICustomBlockState {
|
public class BlockPotionGenerator extends BlockContainerImpl implements ICustomBlockState {
|
||||||
|
|
||||||
public BlockPotionGenerator() {
|
public BlockPotionGenerator() {
|
||||||
super("potion_generator", BlockEntityPotionGenerator.class, Properties.of(Material.STONE).strength(5F));
|
super("potion_generator", BlockEntityPotionGenerator::new, Properties.of(Material.STONE).strength(5F));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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);
|
private static final VoxelShape SHAPE = Shapes.create(0F, 0F, 0F, 1F, 4 / 16F, 1F);
|
||||||
|
|
||||||
public BlockPowderPlacer() {
|
public BlockPowderPlacer() {
|
||||||
super("powder_placer", BlockEntityPowderPlacer.class, Properties.of(Material.STONE).strength(2, 5F).sound(SoundType.STONE));
|
super("powder_placer", BlockEntityPowderPlacer::new, Properties.of(Material.STONE).strength(2, 5F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator;
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
|
@ -10,10 +10,12 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Position;
|
import net.minecraft.core.Position;
|
||||||
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
|
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
import net.minecraft.world.entity.projectile.Projectile;
|
import net.minecraft.world.entity.projectile.Projectile;
|
||||||
|
@ -24,8 +26,10 @@ import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.DispenserBlock;
|
import net.minecraft.world.level.block.DispenserBlock;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
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.level.material.Material;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
@ -34,7 +38,7 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||||
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<BlockEntityProjectileGenerator>, ICustomBlockState {
|
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<BlockEntityProjectileGenerator>, ICustomBlockState {
|
||||||
|
|
||||||
public BlockProjectileGenerator() {
|
public BlockProjectileGenerator() {
|
||||||
super("projectile_generator", BlockEntityProjectileGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
super("projectile_generator", BlockEntityProjectileGenerator::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
DispenserBlock.registerBehavior(Items.ENDER_PEARL, new AbstractProjectileDispenseBehavior() {
|
DispenserBlock.registerBehavior(Items.ENDER_PEARL, new AbstractProjectileDispenseBehavior() {
|
||||||
|
@ -51,7 +55,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
||||||
protected Projectile getProjectile(Level levelIn, Position position, ItemStack stackIn) {
|
protected Projectile getProjectile(Level levelIn, Position position, ItemStack stackIn) {
|
||||||
var ret = new ThrownTrident(EntityType.TRIDENT, levelIn);
|
var ret = new ThrownTrident(EntityType.TRIDENT, levelIn);
|
||||||
ret.setPos(position.x(), position.y(), position.z());
|
ret.setPos(position.x(), position.y(), position.z());
|
||||||
ObfuscationReflectionHelper.setPrivateValue(ThrownTrident.class, ret, stackIn.copy(), "f_37555_");
|
ObfuscationReflectionHelper.setPrivateValue(ThrownTrident.class, ret, stackIn.copy(), "tridentItem");
|
||||||
ret.pickup = AbstractArrow.Pickup.ALLOWED;
|
ret.pickup = AbstractArrow.Pickup.ALLOWED;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +106,6 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
|
BlockEntityRenderers.register(ModTileEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.world.level.material.Material;
|
||||||
public class BlockRFConverter extends BlockContainerImpl {
|
public class BlockRFConverter extends BlockContainerImpl {
|
||||||
|
|
||||||
public BlockRFConverter() {
|
public BlockRFConverter() {
|
||||||
super("rf_converter", BlockEntityRFConverter.class, Properties.of(Material.STONE).sound(SoundType.STONE).strength(3));
|
super("rf_converter", BlockEntityRFConverter::new, Properties.of(Material.STONE).sound(SoundType.STONE).strength(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,6 +6,7 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntitySlimeSplitGenerator;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.monster.Slime;
|
import net.minecraft.world.entity.monster.Slime;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
@ -19,7 +20,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
public class BlockSlimeSplitGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockSlimeSplitGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockSlimeSplitGenerator() {
|
public BlockSlimeSplitGenerator() {
|
||||||
super("slime_split_generator", BlockEntitySlimeSplitGenerator.class, Properties.copy(Blocks.SLIME_BLOCK).strength(2));
|
super("slime_split_generator", BlockEntitySlimeSplitGenerator::new, Properties.copy(Blocks.SLIME_BLOCK).strength(2));
|
||||||
MinecraftForge.EVENT_BUS.register(new Events());
|
MinecraftForge.EVENT_BUS.register(new Events());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
@ -14,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class BlockSnowCreator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
public class BlockSnowCreator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||||
|
|
||||||
public BlockSnowCreator() {
|
public BlockSnowCreator() {
|
||||||
super("snow_creator", BlockEntitySnowCreator.class, Properties.copy(Blocks.STONE_BRICKS));
|
super("snow_creator", BlockEntitySnowCreator::new, Properties.copy(Blocks.STONE_BRICKS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,7 +16,9 @@ import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
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.SoundType;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
@ -38,7 +40,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);
|
private static final VoxelShape SHAPE = Shapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
|
||||||
|
|
||||||
public BlockSpawnLamp() {
|
public BlockSpawnLamp() {
|
||||||
super("spawn_lamp", BlockEntitySpawnLamp.class, Properties.of(Material.METAL).strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
|
super("spawn_lamp", BlockEntitySpawnLamp::new, Properties.of(Material.METAL).strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.BucketPickup;
|
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.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
@ -30,7 +31,7 @@ import java.util.function.Supplier;
|
||||||
public class BlockSpring extends BlockContainerImpl implements ICustomBlockState, IColorProvidingBlock, IColorProvidingItem, BucketPickup, ICustomRenderType {
|
public class BlockSpring extends BlockContainerImpl implements ICustomBlockState, IColorProvidingBlock, IColorProvidingItem, BucketPickup, ICustomRenderType {
|
||||||
|
|
||||||
public BlockSpring() {
|
public BlockSpring() {
|
||||||
super("spring", BlockEntitySpring.class, Properties.copy(Blocks.STONE_BRICKS));
|
super("spring", BlockEntitySpring::new, Properties.copy(Blocks.STONE_BRICKS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.world.level.material.Material;
|
||||||
public class BlockTimeChanger extends BlockContainerImpl implements ICustomBlockState {
|
public class BlockTimeChanger extends BlockContainerImpl implements ICustomBlockState {
|
||||||
|
|
||||||
public BlockTimeChanger() {
|
public BlockTimeChanger() {
|
||||||
super("time_changer", BlockEntityTimeChanger.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
super("time_changer", BlockEntityTimeChanger::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
public class BlockWeatherChanger extends BlockContainerImpl implements ICustomBlockState {
|
public class BlockWeatherChanger extends BlockContainerImpl implements ICustomBlockState {
|
||||||
|
|
||||||
public BlockWeatherChanger() {
|
public BlockWeatherChanger() {
|
||||||
super("weather_changer", BlockEntityWeatherChanger.class, Properties.copy(Blocks.STONE_BRICKS));
|
super("weather_changer", BlockEntityWeatherChanger::new, Properties.copy(Blocks.STONE_BRICKS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,10 +3,11 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityWoodStand;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityWoodStand;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand;
|
import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
|
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||||
|
@ -14,10 +15,13 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
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.SoundType;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
@ -38,7 +42,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);
|
private static final VoxelShape SHAPE = Shapes.create(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F);
|
||||||
|
|
||||||
public BlockWoodStand() {
|
public BlockWoodStand() {
|
||||||
super("wood_stand", BlockEntityWoodStand.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
|
super("wood_stand", BlockEntityWoodStand::new, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +115,6 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new);
|
BlockEntityRenderers.register(ModTileEntities.WOOD_STAND, RenderWoodStand::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class BlockEntityAncientLeaves extends BlockEntityImpl {
|
||||||
};
|
};
|
||||||
|
|
||||||
public BlockEntityAncientLeaves(BlockPos pos, BlockState state) {
|
public BlockEntityAncientLeaves(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.ANCIENT_LEAVES, pos, state);
|
super(ModTileEntities.ANCIENT_LEAVES, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.Set;
|
||||||
public class BlockEntityAnimalContainer extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityAnimalContainer extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public BlockEntityAnimalContainer(BlockPos pos, BlockState state) {
|
public BlockEntityAnimalContainer(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.ANIMAL_CONTAINER, pos, state);
|
super(ModTileEntities.ANIMAL_CONTAINER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRadius() {
|
public int getRadius() {
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class BlockEntityAnimalGenerator extends BlockEntityImpl implements ITick
|
||||||
private int amountToRelease;
|
private int amountToRelease;
|
||||||
|
|
||||||
public BlockEntityAnimalGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityAnimalGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.ANIMAL_GENERATOR, pos, state);
|
super(ModTileEntities.ANIMAL_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
@ -32,7 +33,7 @@ public class BlockEntityAnimalSpawner extends BlockEntityImpl implements ITickab
|
||||||
private Entity entityClient;
|
private Entity entityClient;
|
||||||
|
|
||||||
public BlockEntityAnimalSpawner(BlockPos pos, BlockState state) {
|
public BlockEntityAnimalSpawner(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.ANIMAL_SPAWNER, pos, state);
|
super(ModTileEntities.ANIMAL_SPAWNER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class BlockEntityAuraBloom extends BlockEntityImpl implements ITickableBl
|
||||||
public boolean justGenerated;
|
public boolean justGenerated;
|
||||||
|
|
||||||
public BlockEntityAuraBloom(BlockPos pos, BlockState state) {
|
public BlockEntityAuraBloom(BlockPos pos, BlockState state) {
|
||||||
this(ModBlockEntities.AURA_BLOOM, pos, state);
|
this(ModTileEntities.AURA_BLOOM, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockEntityAuraBloom(BlockEntityType<BlockEntityAuraBloom> type, BlockPos pos, BlockState state) {
|
protected BlockEntityAuraBloom(BlockEntityType<BlockEntityAuraBloom> type, BlockPos pos, BlockState state) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class BlockEntityAuraDetector extends BlockEntityImpl implements ITickabl
|
||||||
public int redstonePower;
|
public int redstonePower;
|
||||||
|
|
||||||
public BlockEntityAuraDetector(BlockPos pos, BlockState state) {
|
public BlockEntityAuraDetector(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.AURA_DETECTOR, pos, state);
|
super(ModTileEntities.AURA_DETECTOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class BlockEntityAuraTimer extends BlockEntityImpl implements ITickableBl
|
||||||
private int timer;
|
private int timer;
|
||||||
|
|
||||||
public BlockEntityAuraTimer(BlockPos pos, BlockState state) {
|
public BlockEntityAuraTimer(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.AURA_TIMER, pos, state);
|
super(ModTileEntities.AURA_TIMER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.entity.EntitySelector;
|
import net.minecraft.world.entity.EntitySelector;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
@ -24,7 +25,7 @@ public class BlockEntityAutoCrafter extends BlockEntityImpl implements ITickable
|
||||||
}, 3, 3);
|
}, 3, 3);
|
||||||
|
|
||||||
public BlockEntityAutoCrafter(BlockPos pos, BlockState state) {
|
public BlockEntityAutoCrafter(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.AUTO_CRAFTER, pos, state);
|
super(ModTileEntities.AUTO_CRAFTER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,12 +5,15 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.world.inventory.ContainerData;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
|
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.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
@ -19,7 +22,7 @@ import java.util.List;
|
||||||
public class BlockEntityBlastFurnaceBooster extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityBlastFurnaceBooster extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public BlockEntityBlastFurnaceBooster(BlockPos pos, BlockState state) {
|
public BlockEntityBlastFurnaceBooster(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.BLAST_FURNACE_BOOSTER, pos, state);
|
super(ModTileEntities.BLAST_FURNACE_BOOSTER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class BlockEntityChorusGenerator extends BlockEntityImpl implements ITick
|
||||||
private int auraPerBlock;
|
private int auraPerBlock;
|
||||||
|
|
||||||
public BlockEntityChorusGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityChorusGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.CHORUS_GENERATOR, pos, state);
|
super(ModTileEntities.CHORUS_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class BlockEntityChunkLoader extends BlockEntityImpl implements ITickable
|
||||||
private boolean firstTick = true;
|
private boolean firstTick = true;
|
||||||
|
|
||||||
public BlockEntityChunkLoader(BlockPos pos, BlockState state) {
|
public BlockEntityChunkLoader(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.CHUNK_LOADER, pos, state);
|
super(ModTileEntities.CHUNK_LOADER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,11 +9,14 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockEntityEndFlower extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityEndFlower extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
private final BasicAuraContainer container = new BasicAuraContainer(null, 500000) {
|
private final BasicAuraContainer container = new BasicAuraContainer(null, 500000) {
|
||||||
|
@ -43,7 +46,7 @@ public class BlockEntityEndFlower extends BlockEntityImpl implements ITickableBl
|
||||||
public boolean isDrainMode;
|
public boolean isDrainMode;
|
||||||
|
|
||||||
public BlockEntityEndFlower(BlockPos pos, BlockState state) {
|
public BlockEntityEndFlower(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.END_FLOWER, pos, state);
|
super(ModTileEntities.END_FLOWER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class BlockEntityEnderCrate extends BlockEntityImpl implements MenuProvid
|
||||||
};
|
};
|
||||||
|
|
||||||
public BlockEntityEnderCrate(BlockPos pos, BlockState state) {
|
public BlockEntityEnderCrate(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.ENDER_CRATE, pos, state);
|
super(ModTileEntities.ENDER_CRATE, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,17 +10,22 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.Block;
|
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.block.state.BlockState;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public BlockPos connectionOffset;
|
public BlockPos connectionOffset;
|
||||||
|
@ -29,7 +34,7 @@ public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickabl
|
||||||
private int chargeTimer;
|
private int chargeTimer;
|
||||||
|
|
||||||
public BlockEntityFieldCreator(BlockPos pos, BlockState state) {
|
public BlockEntityFieldCreator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.FIELD_CREATOR, pos, state);
|
super(ModTileEntities.FIELD_CREATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,8 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
@ -27,7 +29,7 @@ public class BlockEntityFireworkGenerator extends BlockEntityImpl implements ITi
|
||||||
private int releaseTimer;
|
private int releaseTimer;
|
||||||
|
|
||||||
public BlockEntityFireworkGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityFireworkGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.FIREWORK_GENERATOR, pos, state);
|
super(ModTileEntities.FIREWORK_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,8 +9,10 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.apache.commons.lang3.mutable.MutableInt;
|
import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
|
@ -25,7 +27,7 @@ public class BlockEntityFlowerGenerator extends BlockEntityImpl implements ITick
|
||||||
private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>();
|
private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>();
|
||||||
|
|
||||||
public BlockEntityFlowerGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityFlowerGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.FLOWER_GENERATOR, pos, state);
|
super(ModTileEntities.FLOWER_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,14 +8,17 @@ import de.ellpeck.naturesaura.blocks.BlockFurnaceHeater;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.inventory.ContainerData;
|
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.AbstractCookingRecipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.block.AbstractFurnaceBlock;
|
import net.minecraft.world.level.block.AbstractFurnaceBlock;
|
||||||
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
|
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
|
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.entity.SmokerBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||||
|
@ -24,11 +27,11 @@ import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class BlockEntityFurnaceHeater extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityFurnaceHeater extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
private static final Field FURNACE_DATA_FIELD = ObfuscationReflectionHelper.findField(AbstractFurnaceBlockEntity.class, "f_58311_");
|
private static final Field FURNACE_DATA_FIELD = ObfuscationReflectionHelper.findField(AbstractFurnaceBlockEntity.class, "dataAccess");
|
||||||
public boolean isActive;
|
public boolean isActive;
|
||||||
|
|
||||||
public BlockEntityFurnaceHeater(BlockPos pos, BlockState state) {
|
public BlockEntityFurnaceHeater(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.FURNACE_HEATER, pos, state);
|
super(ModTileEntities.FURNACE_HEATER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ContainerData getFurnaceData(AbstractFurnaceBlockEntity tile) {
|
public static ContainerData getFurnaceData(AbstractFurnaceBlockEntity tile) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class BlockEntityGeneratorLimitRemover extends BlockEntityImpl {
|
public class BlockEntityGeneratorLimitRemover extends BlockEntityImpl {
|
||||||
|
|
||||||
public BlockEntityGeneratorLimitRemover(BlockPos pos, BlockState state) {
|
public BlockEntityGeneratorLimitRemover(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.GENERATOR_LIMIT_REMOVER, pos, state);
|
super(ModTileEntities.GENERATOR_LIMIT_REMOVER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,13 +5,18 @@ import de.ellpeck.naturesaura.blocks.BlockGratedChute;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.item.ItemStack;
|
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.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockEntityGratedChute extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityGratedChute extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public boolean isBlacklist;
|
public boolean isBlacklist;
|
||||||
|
@ -29,7 +34,7 @@ public class BlockEntityGratedChute extends BlockEntityImpl implements ITickable
|
||||||
private int cooldown;
|
private int cooldown;
|
||||||
|
|
||||||
public BlockEntityGratedChute(BlockPos pos, BlockState state) {
|
public BlockEntityGratedChute(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.GRATED_CHUTE, pos, state);
|
super(ModTileEntities.GRATED_CHUTE, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,7 +80,7 @@ public class BlockEntityGratedChute extends BlockEntityImpl implements ITickable
|
||||||
if (stack.isEmpty())
|
if (stack.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
var left = this.items.insertItem(0, stack, false);
|
var left = this.items.insertItem(0, stack, false);
|
||||||
if (!ItemStack.matches(stack, left)) {
|
if (!ItemStack.isSame(stack, left)) {
|
||||||
if (left.isEmpty()) {
|
if (left.isEmpty()) {
|
||||||
item.kill();
|
item.kill();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,11 +13,14 @@ import net.minecraft.world.level.block.entity.HopperBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockEntityHopperUpgrade extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityHopperUpgrade extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public BlockEntityHopperUpgrade(BlockPos pos, BlockState state) {
|
public BlockEntityHopperUpgrade(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.HOPPER_UPGRADE, pos, state);
|
super(ModTileEntities.HOPPER_UPGRADE, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isValidHopper(BlockEntity tile) {
|
private static boolean isValidHopper(BlockEntity tile) {
|
||||||
|
@ -59,7 +62,7 @@ public class BlockEntityHopperUpgrade extends BlockEntityImpl implements ITickab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ItemStack.matches(stack, copy)) {
|
if (!ItemStack.isSame(stack, copy)) {
|
||||||
item.setItem(copy);
|
item.setItem(copy);
|
||||||
if (copy.isEmpty())
|
if (copy.isEmpty())
|
||||||
item.kill();
|
item.kill();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.item.ItemStack;
|
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.level.block.state.BlockState;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
@ -18,7 +19,7 @@ public class BlockEntityItemDistributor extends BlockEntityImpl implements ITick
|
||||||
public boolean isRandomMode;
|
public boolean isRandomMode;
|
||||||
|
|
||||||
public BlockEntityItemDistributor(BlockPos pos, BlockState state) {
|
public BlockEntityItemDistributor(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.ITEM_DISTRIBUTOR, pos, state);
|
super(ModTileEntities.ITEM_DISTRIBUTOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,7 +44,7 @@ public class BlockEntityItemDistributor extends BlockEntityImpl implements ITick
|
||||||
continue;
|
continue;
|
||||||
for (var j = 0; j < dest.getSlots(); j++) {
|
for (var j = 0; j < dest.getSlots(); j++) {
|
||||||
var remain = dest.insertItem(j, stack, false);
|
var remain = dest.insertItem(j, stack, false);
|
||||||
if (!ItemStack.matches(remain, stack)) {
|
if (!ItemStack.isSame(remain, stack)) {
|
||||||
above.extractItem(i, 1, false);
|
above.extractItem(i, 1, false);
|
||||||
this.cooldown = 3;
|
this.cooldown = 3;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||||
public class BlockEntityMossGenerator extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityMossGenerator extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public BlockEntityMossGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityMossGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.MOSS_GENERATOR, pos, state);
|
super(ModTileEntities.MOSS_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
|
||||||
private boolean firstTick = true;
|
private boolean firstTick = true;
|
||||||
|
|
||||||
public BlockEntityNatureAltar(BlockPos pos, BlockState state) {
|
public BlockEntityNatureAltar(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.NATURE_ALTAR, pos, state);
|
super(ModTileEntities.NATURE_ALTAR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class BlockEntityOakGenerator extends BlockEntityImpl implements ITickabl
|
||||||
public Queue<BlockPos> scheduledBigTrees = new ArrayDeque<>();
|
public Queue<BlockPos> scheduledBigTrees = new ArrayDeque<>();
|
||||||
|
|
||||||
public BlockEntityOakGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityOakGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.OAK_GENERATOR, pos, state);
|
super(ModTileEntities.OAK_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,7 +9,9 @@ import de.ellpeck.naturesaura.recipes.OfferingRecipe;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.LightningBolt;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
@ -21,6 +23,7 @@ import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
@ -34,7 +37,7 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab
|
||||||
private final Queue<ItemStack> itemsToSpawn = new ArrayDeque<>();
|
private final Queue<ItemStack> itemsToSpawn = new ArrayDeque<>();
|
||||||
|
|
||||||
public BlockEntityOfferingTable(BlockPos pos, BlockState state) {
|
public BlockEntityOfferingTable(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.OFFERING_TABLE, pos, state);
|
super(ModTileEntities.OFFERING_TABLE, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OfferingRecipe getRecipe(ItemStack input) {
|
private OfferingRecipe getRecipe(ItemStack input) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
public class BlockEntityPickupStopper extends BlockEntityImpl {
|
public class BlockEntityPickupStopper extends BlockEntityImpl {
|
||||||
|
|
||||||
public BlockEntityPickupStopper(BlockPos pos, BlockState state) {
|
public BlockEntityPickupStopper(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.PICKUP_STOPPER, pos, state);
|
super(ModTileEntities.PICKUP_STOPPER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getRadius() {
|
public float getRadius() {
|
||||||
|
|
|
@ -13,12 +13,15 @@ import net.minecraft.world.entity.decoration.ItemFrame;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.context.UseOnContext;
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
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.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -26,7 +29,7 @@ import java.util.List;
|
||||||
public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public BlockEntityPlacer(BlockPos pos, BlockState state) {
|
public BlockEntityPlacer(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.PLACER, pos, state);
|
super(ModTileEntities.PLACER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,7 +71,7 @@ public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlock
|
||||||
|
|
||||||
var pos = validPositions.get(this.level.random.nextInt(validPositions.size()));
|
var pos = validPositions.get(this.level.random.nextInt(validPositions.size()));
|
||||||
var left = this.tryPlace(stack.copy(), pos);
|
var left = this.tryPlace(stack.copy(), pos);
|
||||||
if (ItemStack.matches(stack, left))
|
if (ItemStack.isSame(stack, left))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
handler.extractItem(i, 1, false);
|
handler.extractItem(i, 1, false);
|
||||||
|
|
|
@ -4,15 +4,20 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.core.BlockPos;
|
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.entity.AreaEffectCloud;
|
||||||
|
import net.minecraft.world.item.alchemy.Potion;
|
||||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
public BlockEntityPotionGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityPotionGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.POTION_GENERATOR, pos, state);
|
super(ModTileEntities.POTION_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,14 +5,19 @@ import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.entity.Entity;
|
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.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockEntityPowderPlacer extends BlockEntityImpl {
|
public class BlockEntityPowderPlacer extends BlockEntityImpl {
|
||||||
|
|
||||||
public BlockEntityPowderPlacer(BlockPos pos, BlockState state) {
|
public BlockEntityPowderPlacer(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.POWDER_PLACER, pos, state);
|
super(ModTileEntities.POWDER_PLACER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class BlockEntityProjectileGenerator extends BlockEntityImpl {
|
||||||
public Direction nextSide = Direction.NORTH;
|
public Direction nextSide = Direction.NORTH;
|
||||||
|
|
||||||
public BlockEntityProjectileGenerator(BlockPos pos, BlockState state) {
|
public BlockEntityProjectileGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.PROJECTILE_GENERATOR, pos, state);
|
super(ModTileEntities.PROJECTILE_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
@ -25,7 +26,7 @@ public class BlockEntityRFConverter extends BlockEntityImpl implements ITickable
|
||||||
private int lastEnergy;
|
private int lastEnergy;
|
||||||
|
|
||||||
public BlockEntityRFConverter(BlockPos pos, BlockState state) {
|
public BlockEntityRFConverter(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.RF_CONVERTER, pos, state);
|
super(ModTileEntities.RF_CONVERTER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class BlockEntitySlimeSplitGenerator extends BlockEntityImpl implements I
|
||||||
private int color;
|
private int color;
|
||||||
|
|
||||||
public BlockEntitySlimeSplitGenerator(BlockPos pos, BlockState state) {
|
public BlockEntitySlimeSplitGenerator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.SLIME_SPLIT_GENERATOR, pos, state);
|
super(ModTileEntities.SLIME_SPLIT_GENERATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.entity.animal.SnowGolem;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
|
||||||
public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
@ -20,7 +21,7 @@ public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickable
|
||||||
private int snowmanCount;
|
private int snowmanCount;
|
||||||
|
|
||||||
public BlockEntitySnowCreator(BlockPos pos, BlockState state) {
|
public BlockEntitySnowCreator(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.SNOW_CREATOR, pos, state);
|
super(ModTileEntities.SNOW_CREATOR, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRange() {
|
public int getRange() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
public class BlockEntitySpawnLamp extends BlockEntityImpl {
|
public class BlockEntitySpawnLamp extends BlockEntityImpl {
|
||||||
|
|
||||||
public BlockEntitySpawnLamp(BlockPos pos, BlockState state) {
|
public BlockEntitySpawnLamp(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.SPAWN_LAMP, pos, state);
|
super(ModTileEntities.SPAWN_LAMP, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRadius() {
|
public int getRadius() {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
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.level.material.Fluids;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.common.FarmlandWaterManager;
|
import net.minecraftforge.common.FarmlandWaterManager;
|
||||||
|
@ -29,7 +30,7 @@ public class BlockEntitySpring extends BlockEntityImpl implements ITickableBlock
|
||||||
private AABBTicket waterTicket;
|
private AABBTicket waterTicket;
|
||||||
|
|
||||||
public BlockEntitySpring(BlockPos pos, BlockState state) {
|
public BlockEntitySpring(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.SPRING, pos, state);
|
super(ModTileEntities.SPRING, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,21 +9,26 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.protocol.game.ClientboundSetTimePacket;
|
import net.minecraft.network.protocol.game.ClientboundSetTimePacket;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.players.PlayerList;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.GameRules;
|
import net.minecraft.world.level.GameRules;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.storage.ServerLevelData;
|
import net.minecraft.world.level.storage.ServerLevelData;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockEntityTimeChanger extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityTimeChanger extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
private long goalTime;
|
private long goalTime;
|
||||||
|
|
||||||
public BlockEntityTimeChanger(BlockPos pos, BlockState state) {
|
public BlockEntityTimeChanger(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.TIME_CHANGER, pos, state);
|
super(ModTileEntities.TIME_CHANGER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,6 +14,9 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITickableBlockEntity {
|
public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITickableBlockEntity {
|
||||||
|
|
||||||
private int processTime;
|
private int processTime;
|
||||||
|
@ -21,7 +24,7 @@ public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITicka
|
||||||
private int itemAmount;
|
private int itemAmount;
|
||||||
|
|
||||||
public BlockEntityWeatherChanger(BlockPos pos, BlockState state) {
|
public BlockEntityWeatherChanger(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.WEATHER_CHANGER, pos, state);
|
super(ModTileEntities.WEATHER_CHANGER, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.LeavesBlock;
|
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.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
@ -39,7 +40,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
|
||||||
private int timer;
|
private int timer;
|
||||||
|
|
||||||
public BlockEntityWoodStand(BlockPos pos, BlockState state) {
|
public BlockEntityWoodStand(BlockPos pos, BlockState state) {
|
||||||
super(ModBlockEntities.WOOD_STAND, pos, state);
|
super(ModTileEntities.WOOD_STAND, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRitual(BlockPos pos, TreeRitualRecipe recipe) {
|
public void setRitual(BlockPos pos, TreeRitualRecipe recipe) {
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
package de.ellpeck.naturesaura.blocks.tiles;
|
package de.ellpeck.naturesaura.blocks.tiles;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
// 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.BlockEntityTicker;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
|
|
||||||
public interface ITickableBlockEntity {
|
public interface ITickableBlockEntity {
|
||||||
|
|
||||||
void tick();
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("FieldNamingConvention")
|
||||||
public final class ModBlockEntities {
|
public final class ModTileEntities {
|
||||||
|
|
||||||
public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES;
|
public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES;
|
||||||
public static BlockEntityType<BlockEntityAnimalGenerator> ANIMAL_GENERATOR;
|
public static BlockEntityType<BlockEntityAnimalGenerator> ANIMAL_GENERATOR;
|
|
@ -1,31 +1,23 @@
|
||||||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraTimer;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraTimer;
|
||||||
import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
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.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RenderAuraTimer implements BlockEntityRenderer<BlockEntityAuraTimer> {
|
public class RenderAuraTimer implements BlockEntityRenderer<BlockEntityAuraTimer> {
|
||||||
|
|
||||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/aura_timer_aura.png");
|
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) {
|
public RenderAuraTimer(BlockEntityRendererProvider.Context context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,26 +35,26 @@ public class RenderAuraTimer implements BlockEntityRenderer<BlockEntityAuraTimer
|
||||||
var r = (type.getColor() >> 16 & 255) / 255F;
|
var r = (type.getColor() >> 16 & 255) / 255F;
|
||||||
var g = (type.getColor() >> 8 & 255) / 255F;
|
var g = (type.getColor() >> 8 & 255) / 255F;
|
||||||
var b = (type.getColor() & 255) / 255F;
|
var b = (type.getColor() & 255) / 255F;
|
||||||
this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(RES)), combinedLightIn, combinedOverlayIn, r, g, b, 0.75F);
|
//this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), combinedLightIn, combinedOverlayIn, r, g, b, 0.75F);
|
||||||
stack.popPose();
|
stack.popPose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AuraModel extends Model {
|
// TODO model rendering
|
||||||
|
/* private static class AuraModel extends Model {
|
||||||
|
|
||||||
private final ModelPart model;
|
private final ModelRenderer box;
|
||||||
|
|
||||||
public AuraModel() {
|
public AuraModel() {
|
||||||
super(RenderType::entityTranslucent);
|
super(RenderType::getEntityTranslucent);
|
||||||
var mesh = new MeshDefinition();
|
this.box = new ModelRenderer(this, 0, 0);
|
||||||
var part = mesh.getRoot();
|
this.box.setTextureSize(64, 64);
|
||||||
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 16, 16), PartPose.ZERO);
|
this.box.addBox(0, 0, 0, 16, 16, 16);
|
||||||
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
||||||
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
// TODO get the 1-pixel border around the ender overlay back
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class RenderEnderCrate implements BlockEntityRenderer<BlockEntityEnderCrate> {
|
public class RenderEnderCrate implements BlockEntityRenderer<BlockEntityEnderCrate> {
|
||||||
|
|
||||||
|
@ -26,10 +27,10 @@ public class RenderEnderCrate implements BlockEntityRenderer<BlockEntityEnderCra
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderFace(Matrix4f p_173696_, VertexConsumer p_173697_, float p_173700_, float p_173701_) {
|
private static void renderFace(Matrix4f p_173696_, VertexConsumer p_173697_, float p_173700_, float p_173701_) {
|
||||||
p_173697_.vertex(p_173696_, (float) 1 / 16F, p_173700_, (float) 15 / 16F).endVertex();
|
p_173697_.vertex(p_173696_, (float) 0.0, p_173700_, (float) 1.0).endVertex();
|
||||||
p_173697_.vertex(p_173696_, (float) 15 / 16F, p_173700_, (float) 15 / 16F).endVertex();
|
p_173697_.vertex(p_173696_, (float) 1.0, p_173700_, (float) 1.0).endVertex();
|
||||||
p_173697_.vertex(p_173696_, (float) 15 / 16F, p_173701_, (float) 1 / 16F).endVertex();
|
p_173697_.vertex(p_173696_, (float) 1.0, p_173701_, (float) 0.0).endVertex();
|
||||||
p_173697_.vertex(p_173696_, (float) 1 / 16F, p_173701_, (float) 1 / 16F).endVertex();
|
p_173697_.vertex(p_173696_, (float) 0.0, p_173701_, (float) 0.0).endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float getOffsetUp() {
|
private static float getOffsetUp() {
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
|
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.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
@ -25,7 +17,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class RenderGeneratorLimitRemover implements BlockEntityRenderer<BlockEntityGeneratorLimitRemover> {
|
public class RenderGeneratorLimitRemover implements BlockEntityRenderer<BlockEntityGeneratorLimitRemover> {
|
||||||
|
|
||||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/generator_limit_remover_glint.png");
|
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) {
|
public RenderGeneratorLimitRemover(BlockEntityRendererProvider.Context context) {
|
||||||
|
|
||||||
|
@ -47,25 +39,25 @@ public class RenderGeneratorLimitRemover implements BlockEntityRenderer<BlockEnt
|
||||||
stack.translate(-0.001F, yOff + 1 + 0.001F, 1 + 0.001F);
|
stack.translate(-0.001F, yOff + 1 + 0.001F, 1 + 0.001F);
|
||||||
stack.mulPose(Vector3f.XP.rotationDegrees(180F));
|
stack.mulPose(Vector3f.XP.rotationDegrees(180F));
|
||||||
stack.scale(1.002F, 1.002F, 1.002F);
|
stack.scale(1.002F, 1.002F, 1.002F);
|
||||||
this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, alpha);
|
//this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, alpha);
|
||||||
stack.popPose();
|
stack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ModelLimitRemoverGlint extends Model {
|
// TODO model rendering
|
||||||
|
/* private static class ModelLimitRemoverGlint extends Model {
|
||||||
|
|
||||||
private final ModelPart model;
|
private final ModelRenderer box;
|
||||||
|
|
||||||
public ModelLimitRemoverGlint() {
|
public ModelLimitRemoverGlint() {
|
||||||
super(RenderType::entityTranslucent);
|
super(RenderType::getEntityTranslucent);
|
||||||
var mesh = new MeshDefinition();
|
this.box = new ModelRenderer(this, 0, 0);
|
||||||
var part = mesh.getRoot();
|
this.box.setTextureSize(64, 64);
|
||||||
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 16, 16), PartPose.ZERO);
|
this.box.addBox(0, 0, 0, 16, 16, 16);
|
||||||
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrixStack, IVertexBuilder iVertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
||||||
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
this.box.render(matrixStack, iVertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
|
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.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -24,7 +16,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
public class RenderProjectileGenerator implements BlockEntityRenderer<BlockEntityProjectileGenerator> {
|
public class RenderProjectileGenerator implements BlockEntityRenderer<BlockEntityProjectileGenerator> {
|
||||||
|
|
||||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png");
|
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) {
|
public RenderProjectileGenerator(BlockEntityRendererProvider.Context context) {
|
||||||
|
|
||||||
|
@ -46,25 +38,25 @@ public class RenderProjectileGenerator implements BlockEntityRenderer<BlockEntit
|
||||||
stack.translate(-0.002F, 0, 0);
|
stack.translate(-0.002F, 0, 0);
|
||||||
}
|
}
|
||||||
var brightness = 15 << 20 | 15 << 4;
|
var brightness = 15 << 20 | 15 << 4;
|
||||||
this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, 1);
|
//this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, 1);
|
||||||
stack.popPose();
|
stack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ModelOverlay extends Model {
|
// TODO model rendering
|
||||||
|
/* private static class ModelOverlay extends Model {
|
||||||
|
|
||||||
private final ModelPart model;
|
private final ModelPart box;
|
||||||
|
|
||||||
public ModelOverlay() {
|
public ModelOverlay() {
|
||||||
super(RenderType::entityTranslucent);
|
super(RenderType::entityTranslucent);
|
||||||
var mesh = new MeshDefinition();
|
this.box = new ModelPart(this, 0, 0);
|
||||||
var part = mesh.getRoot();
|
this.box.setTextureSize(64, 64);
|
||||||
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 16, 16), PartPose.ZERO);
|
this.box.(0, 0, 0, 16, 16, 16);
|
||||||
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
||||||
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ public final class Compat {
|
||||||
|
|
||||||
private static final Map<String, Supplier<ICompat>> MODULE_TYPES = ImmutableMap.<String, Supplier<ICompat>>builder()
|
private static final Map<String, Supplier<ICompat>> MODULE_TYPES = ImmutableMap.<String, Supplier<ICompat>>builder()
|
||||||
.put("patchouli", PatchouliCompat::new)
|
.put("patchouli", PatchouliCompat::new)
|
||||||
.put("curios", CuriosCompat::new)
|
/* .put("curios", CuriosCompat::new)
|
||||||
//.put("enchantability", EnchantibilityCompat::new)
|
.put("enchantability", EnchantibilityCompat::new)*/
|
||||||
.build();
|
.build();
|
||||||
private static final Map<String, ICompat> MODULES = new HashMap<>();
|
private static final Map<String, ICompat> MODULES = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
|
// TODO Curios
|
||||||
|
/*
|
||||||
package de.ellpeck.naturesaura.compat;
|
package de.ellpeck.naturesaura.compat;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.data.ItemTagProvider;
|
import de.ellpeck.naturesaura.data.ItemTagProvider;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tags.ITag;
|
||||||
import net.minecraft.tags.ItemTags;
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
|
@ -54,18 +58,14 @@ public class CuriosCompat implements ICompat {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCapabilitiesAttach(AttachCapabilitiesEvent<ItemStack> event) {
|
private void onCapabilitiesAttach(AttachCapabilitiesEvent<ItemStack> event) {
|
||||||
var stack = event.getObject();
|
ItemStack stack = event.getObject();
|
||||||
if (TYPES.containsKey(stack.getItem())) {
|
if (TYPES.containsKey(stack.getItem())) {
|
||||||
event.addCapability(new ResourceLocation(NaturesAura.MOD_ID, "curios"), new ICapabilityProvider() {
|
event.addCapability(new ResourceLocation(NaturesAura.MOD_ID, "curios"), new ICapabilityProvider() {
|
||||||
private final LazyOptional<ICurio> curio = LazyOptional.of(() -> new ICurio() {
|
private final LazyOptional<ICurio> curio = LazyOptional.of(() -> new ICurio() {
|
||||||
@Override
|
@Override
|
||||||
public void curioTick(SlotContext slotContext) {
|
public void curioTick(String identifier, int index, LivingEntity livingEntity) {
|
||||||
stack.getItem().inventoryTick(stack, slotContext.entity().level, slotContext.entity(), -1, false);
|
stack.getItem().inventoryTick(stack, livingEntity.level, livingEntity, -1, false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStack() {
|
|
||||||
return stack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -74,7 +74,7 @@ public class CuriosCompat implements ICompat {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSync(SlotContext slotContext) {
|
public boolean canSync(String identifier, int index, LivingEntity livingEntity) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -92,9 +92,10 @@ public class CuriosCompat implements ICompat {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addItemTags(ItemTagProvider provider) {
|
public void addItemTags(ItemTagProvider provider) {
|
||||||
for (var entry : TYPES.entrySet()) {
|
for (Map.Entry<Item, String> entry : TYPES.entrySet()) {
|
||||||
var tag = ItemTags.createOptional(new ResourceLocation("curios", entry.getValue()));
|
ITag.INamedTag<Item> tag = ItemTags.createOptional(new ResourceLocation("curios", entry.getValue()));
|
||||||
provider.tag(tag).add(entry.getKey());
|
provider.getOrCreateBuilder(tag).add(entry.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// TODO Enchantability
|
||||||
/*
|
/*
|
||||||
package de.ellpeck.naturesaura.compat.enchantibility;
|
package de.ellpeck.naturesaura.compat.enchantibility;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// TODO Enchantability
|
||||||
/*
|
/*
|
||||||
package de.ellpeck.naturesaura.compat.enchantibility;
|
package de.ellpeck.naturesaura.compat.enchantibility;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/*
|
||||||
package de.ellpeck.naturesaura.compat.jei;
|
package de.ellpeck.naturesaura.compat.jei;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
@ -7,14 +8,14 @@ import de.ellpeck.naturesaura.recipes.AltarRecipe;
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
import mezz.jei.api.constants.VanillaTypes;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.gui.drawable.IDrawable;
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
|
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.helpers.IGuiHelper;
|
import mezz.jei.api.helpers.IGuiHelper;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -39,8 +40,8 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTitle() {
|
public String getTitle() {
|
||||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.ALTAR + ".name");
|
return I18n.format("container." + JEINaturesAuraPlugin.ALTAR + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,9 +57,9 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
|
||||||
@Override
|
@Override
|
||||||
public void setIngredients(AltarRecipe altarRecipe, IIngredients iIngredients) {
|
public void setIngredients(AltarRecipe altarRecipe, IIngredients iIngredients) {
|
||||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||||
builder.add(altarRecipe.input.getItems());
|
builder.add(altarRecipe.input.getMatchingStacks());
|
||||||
if (altarRecipe.catalyst != Ingredient.EMPTY)
|
if (altarRecipe.catalyst != Ingredient.EMPTY)
|
||||||
builder.add(altarRecipe.catalyst.getItems());
|
builder.add(altarRecipe.catalyst.getMatchingStacks());
|
||||||
if (altarRecipe.requiredType != null)
|
if (altarRecipe.requiredType != null)
|
||||||
builder.add(altarRecipe.getDimensionBottle());
|
builder.add(altarRecipe.getDimensionBottle());
|
||||||
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
||||||
|
@ -67,16 +68,17 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout iRecipeLayout, AltarRecipe recipe, IIngredients iIngredients) {
|
public void setRecipe(IRecipeLayout iRecipeLayout, AltarRecipe recipe, IIngredients iIngredients) {
|
||||||
var group = iRecipeLayout.getItemStacks();
|
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
|
||||||
group.init(0, true, 0, 18);
|
group.init(0, true, 0, 18);
|
||||||
group.set(0, Arrays.asList(recipe.input.getItems()));
|
group.set(0, Arrays.asList(recipe.input.getMatchingStacks()));
|
||||||
group.init(1, false, 80, 18);
|
group.init(1, false, 80, 18);
|
||||||
group.set(1, recipe.output);
|
group.set(1, recipe.output);
|
||||||
group.init(2, true, 26, 18);
|
group.init(2, true, 26, 18);
|
||||||
group.set(2, recipe.catalyst == Ingredient.EMPTY ?
|
group.set(2, recipe.catalyst == Ingredient.EMPTY ?
|
||||||
Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getItems()));
|
Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getMatchingStacks()));
|
||||||
group.init(3, true, 51, 18);
|
group.init(3, true, 51, 18);
|
||||||
if (recipe.requiredType != null)
|
if (recipe.requiredType != null)
|
||||||
group.set(3, recipe.getDimensionBottle());
|
group.set(3, recipe.getDimensionBottle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -1,28 +1,32 @@
|
||||||
|
/*
|
||||||
package de.ellpeck.naturesaura.compat.jei;
|
package de.ellpeck.naturesaura.compat.jei;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.platform.Lighting;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
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.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
|
import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
import mezz.jei.api.constants.VanillaTypes;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.gui.drawable.IDrawable;
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
|
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.helpers.IGuiHelper;
|
import mezz.jei.api.helpers.IGuiHelper;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.item.SpawnEggItem;
|
||||||
import net.minecraftforge.common.ForgeSpawnEggItem;
|
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 java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -31,53 +35,48 @@ import java.util.Map;
|
||||||
public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecipe> {
|
public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecipe> {
|
||||||
|
|
||||||
private final IDrawable background;
|
private final IDrawable background;
|
||||||
private final Map<EntityType<?>, Entity> entityCache = new HashMap<>();
|
private final Map<EntityType, Entity> entityCache = new HashMap<>();
|
||||||
|
|
||||||
public AnimalSpawnerCategory(IGuiHelper helper) {
|
public AnimalSpawnerCategory(IGuiHelper helper) {
|
||||||
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/animal_spawner.png"), 0, 0, 72, 86);
|
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/animal_spawner.png"), 0, 0, 72, 86);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderEntity(PoseStack matrixstack, int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
|
private static void renderEntity(MatrixStack matrixstack, int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
|
||||||
var f = (float) Math.atan(yaw / 40.0F);
|
float f = (float) Math.atan(yaw / 40.0F);
|
||||||
var f1 = (float) Math.atan(pitch / 40.0F);
|
float f1 = (float) Math.atan(pitch / 40.0F);
|
||||||
var posestack = RenderSystem.getModelViewStack();
|
RenderSystem.pushMatrix();
|
||||||
posestack.pushPose();
|
RenderSystem.translatef((float) x, (float) y, 1050.0F);
|
||||||
posestack.translate(x, y, 1050.0D);
|
RenderSystem.scalef(1.0F, 1.0F, -1.0F);
|
||||||
posestack.scale(1.0F, 1.0F, -1.0F);
|
|
||||||
RenderSystem.applyModelViewMatrix();
|
|
||||||
matrixstack.translate(0.0D, 0.0D, 1000.0D);
|
matrixstack.translate(0.0D, 0.0D, 1000.0D);
|
||||||
matrixstack.scale(scale, scale, scale);
|
matrixstack.scale(scale, scale, scale);
|
||||||
var quaternion = Vector3f.ZP.rotationDegrees(180.0F);
|
Quaternion quaternion = Vector3f.ZP.rotationDegrees(180.0F);
|
||||||
var quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
|
Quaternion quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
|
||||||
quaternion.mul(quaternion1);
|
quaternion.multiply(quaternion1);
|
||||||
matrixstack.mulPose(quaternion);
|
matrixstack.rotate(quaternion);
|
||||||
var f2 = entity.yBodyRot;
|
float f2 = entity.renderYawOffset;
|
||||||
var f3 = entity.getYRot();
|
float f3 = entity.rotationYaw;
|
||||||
var f4 = entity.getXRot();
|
float f4 = entity.rotationPitch;
|
||||||
var f5 = entity.yHeadRotO;
|
float f5 = entity.prevRotationYawHead;
|
||||||
var f6 = entity.yHeadRot;
|
float f6 = entity.rotationYawHead;
|
||||||
entity.yBodyRot = 180.0F + f * 20.0F;
|
entity.renderYawOffset = 180.0F + f * 20.0F;
|
||||||
entity.setYRot(180.0F + f * 40.0F);
|
entity.rotationYaw = 180.0F + f * 40.0F;
|
||||||
entity.setXRot(-f1 * 20.0F);
|
entity.rotationPitch = -f1 * 20.0F;
|
||||||
entity.yHeadRot = entity.getYRot();
|
entity.rotationYawHead = entity.rotationYaw;
|
||||||
entity.yHeadRotO = entity.getYRot();
|
entity.prevRotationYawHead = entity.rotationYaw;
|
||||||
Lighting.setupForEntityInInventory();
|
EntityRendererManager entityrenderermanager = Minecraft.getInstance().getRenderManager();
|
||||||
var entityrenderermanager = Minecraft.getInstance().getEntityRenderDispatcher();
|
quaternion1.conjugate();
|
||||||
quaternion1.conj();
|
entityrenderermanager.setCameraOrientation(quaternion1);
|
||||||
entityrenderermanager.overrideCameraOrientation(quaternion1);
|
|
||||||
entityrenderermanager.setRenderShadow(false);
|
entityrenderermanager.setRenderShadow(false);
|
||||||
var buff = Minecraft.getInstance().renderBuffers().bufferSource();
|
IRenderTypeBuffer.Impl buff = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||||
entityrenderermanager.render(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
|
entityrenderermanager.renderEntityStatic(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
|
||||||
buff.endBatch();
|
buff.finish();
|
||||||
entityrenderermanager.setRenderShadow(true);
|
entityrenderermanager.setRenderShadow(true);
|
||||||
entity.yBodyRot = f2;
|
entity.renderYawOffset = f2;
|
||||||
entity.setYRot(f3);
|
entity.rotationYaw = f3;
|
||||||
entity.setXRot(f4);
|
entity.rotationPitch = f4;
|
||||||
entity.yHeadRotO = f5;
|
entity.prevRotationYawHead = f5;
|
||||||
entity.yHeadRot = f6;
|
entity.rotationYawHead = f6;
|
||||||
posestack.popPose();
|
RenderSystem.popMatrix();
|
||||||
RenderSystem.applyModelViewMatrix();
|
|
||||||
Lighting.setupFor3DItems();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,8 +90,8 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTitle() {
|
public String getTitle() {
|
||||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
|
return I18n.format("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -108,37 +107,38 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
||||||
@Override
|
@Override
|
||||||
public void setIngredients(AnimalSpawnerRecipe animalSpawnerRecipe, IIngredients iIngredients) {
|
public void setIngredients(AnimalSpawnerRecipe animalSpawnerRecipe, IIngredients iIngredients) {
|
||||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||||
for (var ing : animalSpawnerRecipe.ingredients)
|
for (Ingredient ing : animalSpawnerRecipe.ingredients)
|
||||||
builder.add(ing.getItems());
|
builder.add(ing.getMatchingStacks());
|
||||||
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
||||||
iIngredients.setOutput(VanillaTypes.ITEM, new ItemStack(ForgeSpawnEggItem.fromEntityType(animalSpawnerRecipe.entity)));
|
iIngredients.setOutput(VanillaTypes.ITEM, new ItemStack(SpawnEggItem.getEgg(animalSpawnerRecipe.entity)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout iRecipeLayout, AnimalSpawnerRecipe recipe, IIngredients iIngredients) {
|
public void setRecipe(IRecipeLayout iRecipeLayout, AnimalSpawnerRecipe recipe, IIngredients iIngredients) {
|
||||||
var group = iRecipeLayout.getItemStacks();
|
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
|
||||||
for (var i = 0; i < recipe.ingredients.length; i++) {
|
for (int i = 0; i < recipe.ingredients.length; i++) {
|
||||||
group.init(i, true, i * 18, 68);
|
group.init(i, true, i * 18, 68);
|
||||||
group.set(i, Arrays.asList(recipe.ingredients[i].getItems()));
|
group.set(i, Arrays.asList(recipe.ingredients[i].getMatchingStacks()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(AnimalSpawnerRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
|
public void draw(AnimalSpawnerRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
|
||||||
var minecraft = Minecraft.getInstance();
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
var entity = this.entityCache.get(recipe.entity);
|
Entity entity = this.entityCache.get(recipe.entity);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = recipe.makeEntity(minecraft.level, BlockPos.ZERO);
|
entity = recipe.makeEntity(minecraft.level, BlockPos.ZERO);
|
||||||
this.entityCache.put(recipe.entity, entity);
|
this.entityCache.put(recipe.entity, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrixStack.pushPose();
|
matrixStack.push();
|
||||||
var size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
|
float 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);
|
renderEntity(matrixStack, 35, 55, 100F / size * 0.4F, 40, size * 0.5F, (LivingEntity) entity);
|
||||||
matrixStack.popPose();
|
matrixStack.pop();
|
||||||
|
|
||||||
var name = recipe.entity.getDescription().getString();
|
String name = recipe.entity.getName().getString();
|
||||||
minecraft.font.drawShadow(matrixStack, name, 36 - minecraft.font.width(name) / 2F, 55, 0xFFFFFF);
|
minecraft.fontRenderer.drawStringWithShadow(matrixStack, name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
/*
|
||||||
package de.ellpeck.naturesaura.compat.jei;
|
package de.ellpeck.naturesaura.compat.jei;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||||
import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
||||||
import de.ellpeck.naturesaura.items.ItemEffectPowder;
|
import de.ellpeck.naturesaura.items.ItemEffectPowder;
|
||||||
|
@ -9,14 +11,16 @@ import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
import mezz.jei.api.IModPlugin;
|
import mezz.jei.api.IModPlugin;
|
||||||
import mezz.jei.api.JeiPlugin;
|
import mezz.jei.api.JeiPlugin;
|
||||||
import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter;
|
import mezz.jei.api.helpers.IGuiHelper;
|
||||||
|
import mezz.jei.api.ingredients.subtypes.ISubtypeInterpreter;
|
||||||
import mezz.jei.api.registration.IRecipeCatalystRegistration;
|
import mezz.jei.api.registration.IRecipeCatalystRegistration;
|
||||||
import mezz.jei.api.registration.IRecipeCategoryRegistration;
|
import mezz.jei.api.registration.IRecipeCategoryRegistration;
|
||||||
import mezz.jei.api.registration.IRecipeRegistration;
|
import mezz.jei.api.registration.IRecipeRegistration;
|
||||||
import mezz.jei.api.registration.ISubtypeRegistration;
|
import mezz.jei.api.registration.ISubtypeRegistration;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.item.crafting.RecipeManager;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
@JeiPlugin
|
@JeiPlugin
|
||||||
public class JEINaturesAuraPlugin implements IModPlugin {
|
public class JEINaturesAuraPlugin implements IModPlugin {
|
||||||
|
@ -33,7 +37,7 @@ public class JEINaturesAuraPlugin implements IModPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerCategories(IRecipeCategoryRegistration registry) {
|
public void registerCategories(IRecipeCategoryRegistration registry) {
|
||||||
var helper = registry.getJeiHelpers().getGuiHelper();
|
IGuiHelper helper = registry.getJeiHelpers().getGuiHelper();
|
||||||
registry.addRecipeCategories(
|
registry.addRecipeCategories(
|
||||||
new TreeRitualCategory(helper),
|
new TreeRitualCategory(helper),
|
||||||
new AltarCategory(helper),
|
new AltarCategory(helper),
|
||||||
|
@ -44,14 +48,14 @@ public class JEINaturesAuraPlugin implements IModPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerItemSubtypes(ISubtypeRegistration registration) {
|
public void registerItemSubtypes(ISubtypeRegistration registration) {
|
||||||
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, (stack, context) -> ItemEffectPowder.getEffect(stack).toString());
|
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, stack -> ItemEffectPowder.getEffect(stack).toString());
|
||||||
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, (stack, context) -> ItemAuraBottle.getType(stack).getName().toString());
|
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, stack -> ItemAuraBottle.getType(stack).getName().toString());
|
||||||
|
|
||||||
var auraInterpreter = (IIngredientSubtypeInterpreter<ItemStack>) (stack, context) -> {
|
ISubtypeInterpreter auraInterpreter = stack -> {
|
||||||
var container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
||||||
if (container != null)
|
if (container != null)
|
||||||
return String.valueOf(container.getStoredAura());
|
return String.valueOf(container.getStoredAura());
|
||||||
return IIngredientSubtypeInterpreter.NONE;
|
return ISubtypeInterpreter.NONE;
|
||||||
};
|
};
|
||||||
registration.registerSubtypeInterpreter(ModItems.AURA_CACHE, auraInterpreter);
|
registration.registerSubtypeInterpreter(ModItems.AURA_CACHE, auraInterpreter);
|
||||||
registration.registerSubtypeInterpreter(ModItems.AURA_TROVE, auraInterpreter);
|
registration.registerSubtypeInterpreter(ModItems.AURA_TROVE, auraInterpreter);
|
||||||
|
@ -68,10 +72,11 @@ public class JEINaturesAuraPlugin implements IModPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRecipes(IRecipeRegistration registration) {
|
public void registerRecipes(IRecipeRegistration registration) {
|
||||||
var manager = Minecraft.getInstance().level.getRecipeManager();
|
RecipeManager manager = Minecraft.getInstance().level.getRecipeManager();
|
||||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.TREE_RITUAL_TYPE), TREE_RITUAL);
|
registration.addRecipes(manager.getRecipes(ModRecipes.TREE_RITUAL_TYPE, null, null), TREE_RITUAL);
|
||||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.ALTAR_TYPE), ALTAR);
|
registration.addRecipes(manager.getRecipes(ModRecipes.ALTAR_TYPE, null, null), ALTAR);
|
||||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.OFFERING_TYPE), OFFERING);
|
registration.addRecipes(manager.getRecipes(ModRecipes.OFFERING_TYPE, null, null), OFFERING);
|
||||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.ANIMAL_SPAWNER_TYPE), SPAWNER);
|
registration.addRecipes(manager.getRecipes(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null), SPAWNER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/*
|
||||||
package de.ellpeck.naturesaura.compat.jei;
|
package de.ellpeck.naturesaura.compat.jei;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
@ -10,10 +11,9 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.helpers.IGuiHelper;
|
import mezz.jei.api.helpers.IGuiHelper;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTitle() {
|
public String getTitle() {
|
||||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.OFFERING + ".name");
|
return I18n.format("container." + JEINaturesAuraPlugin.OFFERING + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,8 +53,8 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
|
||||||
@Override
|
@Override
|
||||||
public void setIngredients(OfferingRecipe offeringRecipe, IIngredients iIngredients) {
|
public void setIngredients(OfferingRecipe offeringRecipe, IIngredients iIngredients) {
|
||||||
iIngredients.setInputs(VanillaTypes.ITEM, ImmutableList.<ItemStack>builder()
|
iIngredients.setInputs(VanillaTypes.ITEM, ImmutableList.<ItemStack>builder()
|
||||||
.add(offeringRecipe.input.getItems())
|
.add(offeringRecipe.input.getMatchingStacks())
|
||||||
.add(offeringRecipe.startItem.getItems()).build());
|
.add(offeringRecipe.startItem.getMatchingStacks()).build());
|
||||||
iIngredients.setOutput(VanillaTypes.ITEM, offeringRecipe.output);
|
iIngredients.setOutput(VanillaTypes.ITEM, offeringRecipe.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +62,11 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
|
||||||
public void setRecipe(IRecipeLayout recipeLayout, OfferingRecipe recipe, IIngredients ingredients) {
|
public void setRecipe(IRecipeLayout recipeLayout, OfferingRecipe recipe, IIngredients ingredients) {
|
||||||
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
||||||
group.init(0, true, 0, 14);
|
group.init(0, true, 0, 14);
|
||||||
group.set(0, Arrays.asList(recipe.input.getItems()));
|
group.set(0, Arrays.asList(recipe.input.getMatchingStacks()));
|
||||||
group.init(1, false, 65, 14);
|
group.init(1, false, 65, 14);
|
||||||
group.set(1, recipe.output);
|
group.set(1, recipe.output);
|
||||||
group.init(2, true, 27, 0);
|
group.init(2, true, 27, 0);
|
||||||
group.set(2, Arrays.asList(recipe.startItem.getItems()));
|
group.set(2, Arrays.asList(recipe.startItem.getMatchingStacks()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/*
|
||||||
package de.ellpeck.naturesaura.compat.jei;
|
package de.ellpeck.naturesaura.compat.jei;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
@ -6,13 +7,14 @@ import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
import mezz.jei.api.constants.VanillaTypes;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.gui.drawable.IDrawable;
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
|
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.helpers.IGuiHelper;
|
import mezz.jei.api.helpers.IGuiHelper;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@ -35,8 +37,8 @@ public class TreeRitualCategory implements IRecipeCategory<TreeRitualRecipe> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTitle() {
|
public String getTitle() {
|
||||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.TREE_RITUAL + ".name");
|
return I18n.format("container." + JEINaturesAuraPlugin.TREE_RITUAL + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,27 +54,28 @@ public class TreeRitualCategory implements IRecipeCategory<TreeRitualRecipe> {
|
||||||
@Override
|
@Override
|
||||||
public void setIngredients(TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
|
public void setIngredients(TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
|
||||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||||
for (var ing : treeRitualRecipe.ingredients)
|
for (Ingredient ing : treeRitualRecipe.ingredients)
|
||||||
builder.add(ing.getItems());
|
builder.add(ing.getMatchingStacks());
|
||||||
builder.add(treeRitualRecipe.saplingType.getItems());
|
builder.add(treeRitualRecipe.saplingType.getMatchingStacks());
|
||||||
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
||||||
iIngredients.setOutput(VanillaTypes.ITEM, treeRitualRecipe.result);
|
iIngredients.setOutput(VanillaTypes.ITEM, treeRitualRecipe.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout iRecipeLayout, TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
|
public void setRecipe(IRecipeLayout iRecipeLayout, TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
|
||||||
var group = iRecipeLayout.getItemStacks();
|
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
|
||||||
|
|
||||||
group.init(0, true, 34, 34);
|
group.init(0, true, 34, 34);
|
||||||
group.set(0, Arrays.asList(treeRitualRecipe.saplingType.getItems()));
|
group.set(0, Arrays.asList(treeRitualRecipe.saplingType.getMatchingStacks()));
|
||||||
|
|
||||||
group.init(1, true, 124, 34);
|
group.init(1, true, 124, 34);
|
||||||
group.set(1, treeRitualRecipe.result);
|
group.set(1, treeRitualRecipe.result);
|
||||||
|
|
||||||
var positions = new int[][]{{35, 1}, {35, 69}, {1, 35}, {69, 35}, {12, 12}, {58, 58}, {58, 12}, {12, 58}};
|
int[][] 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++) {
|
for (int i = 0; i < treeRitualRecipe.ingredients.length; i++) {
|
||||||
group.init(i + 2, true, positions[i][0] - 1, positions[i][1] - 1);
|
group.init(i + 2, true, positions[i][0] - 1, positions[i][1] - 1);
|
||||||
group.set(i + 2, Arrays.asList(treeRitualRecipe.ingredients[i].getItems()));
|
group.set(i + 2, Arrays.asList(treeRitualRecipe.ingredients[i].getMatchingStacks()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -138,7 +138,8 @@ public class PatchouliCompat implements ICompat {
|
||||||
var r = ((info.color() >> 16) & 255) / 255F;
|
var r = ((info.color() >> 16) & 255) / 255F;
|
||||||
var g = ((info.color() >> 8) & 255) / 255F;
|
var g = ((info.color() >> 8) & 255) / 255F;
|
||||||
var b = (info.color() & 255) / 255F;
|
var b = (info.color() & 255) / 255F;
|
||||||
RenderSystem.setShaderColor(r, g, b, 1);
|
// TODO apply leaf color?
|
||||||
|
//RenderSystem.color3f(r, g, b);
|
||||||
Screen.blit(event.getPoseStack(), x, y, 496 - 32, 44, 16, 18, 512, 256);
|
Screen.blit(event.getPoseStack(), x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ import net.minecraft.data.tags.BlockTagsProvider;
|
||||||
import net.minecraft.data.tags.ItemTagsProvider;
|
import net.minecraft.data.tags.ItemTagsProvider;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.tags.ItemTags;
|
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.Tags;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||||
|
|
||||||
|
@ -33,9 +31,4 @@ public class ItemTagProvider extends ItemTagsProvider {
|
||||||
Compat.addItemTags(this);
|
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_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,14 @@ import net.minecraft.world.damagesource.DamageSource;
|
||||||
import net.minecraft.world.damagesource.EntityDamageSource;
|
import net.minecraft.world.damagesource.EntityDamageSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
|
// TODO these behave very weirdly in-world
|
||||||
public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
|
|
||||||
private static final EntityDataAccessor<String> INHIBITED_EFFECT = SynchedEntityData.defineId(EntityEffectInhibitor.class, EntityDataSerializers.STRING);
|
private static final EntityDataAccessor<String> INHIBITED_EFFECT = SynchedEntityData.defineId(EntityEffectInhibitor.class, EntityDataSerializers.STRING);
|
||||||
|
@ -109,6 +108,11 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeCollidedWith() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readAdditionalSaveData(CompoundTag compound) {
|
protected void readAdditionalSaveData(CompoundTag compound) {
|
||||||
this.setInhibitedEffect(new ResourceLocation(compound.getString("effect")));
|
this.setInhibitedEffect(new ResourceLocation(compound.getString("effect")));
|
||||||
|
@ -128,33 +132,15 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
return NetworkHooks.getEntitySpawningPacket(this);
|
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
|
@Override
|
||||||
public boolean hurt(DamageSource source, float amount) {
|
public boolean hurt(DamageSource source, float amount) {
|
||||||
if (source instanceof EntityDamageSource && !this.level.isClientSide) {
|
if (source instanceof EntityDamageSource && !this.level.isClientSide) {
|
||||||
this.kill();
|
this.kill();
|
||||||
this.spawnAtLocation(this.getDrop(), 0F);
|
this.spawnAtLocation(this.getDrop(), 0F);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else
|
||||||
return super.hurt(source, amount);
|
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() {
|
public ItemStack getDrop() {
|
||||||
return ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, this.getAmount()), this.getInhibitedEffect());
|
return ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, this.getAmount()), this.getInhibitedEffect());
|
||||||
|
|
|
@ -1,22 +1,13 @@
|
||||||
package de.ellpeck.naturesaura.entities.render;
|
package de.ellpeck.naturesaura.entities.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
|
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.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.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||||
import net.minecraft.client.renderer.entity.MinecartRenderer;
|
import net.minecraft.client.renderer.entity.MinecartRenderer;
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
|
@ -27,8 +18,7 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
||||||
public RenderMoverMinecart(EntityRendererProvider.Context p_174300_) {
|
public RenderMoverMinecart(EntityRendererProvider.Context p_174300_) {
|
||||||
super(p_174300_, ModelLayers.MINECART);
|
super(p_174300_, ModelLayers.MINECART);
|
||||||
}
|
}
|
||||||
|
//private final ModelMoverMinecart model = new ModelMoverMinecart();
|
||||||
private final ModelMoverMinecart model = new ModelMoverMinecart();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderMinecartContents(EntityMoverMinecart entityIn, float partialTicks, BlockState stateIn, PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn) {
|
protected void renderMinecartContents(EntityMoverMinecart entityIn, float partialTicks, BlockState stateIn, PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn) {
|
||||||
|
@ -36,25 +26,25 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
||||||
matrixStackIn.translate(0, 22 / 16F, 0);
|
matrixStackIn.translate(0, 22 / 16F, 0);
|
||||||
matrixStackIn.translate(0, 0, 1);
|
matrixStackIn.translate(0, 0, 1);
|
||||||
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(180));
|
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(180));
|
||||||
this.model.renderToBuffer(matrixStackIn, bufferIn.getBuffer(this.model.renderType(RES)), packedLightIn, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
|
//this.model.render(matrixStackIn, bufferIn.getBuffer(this.model.getRenderType(RES)), packedLightIn, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
|
||||||
matrixStackIn.popPose();
|
matrixStackIn.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ModelMoverMinecart extends Model {
|
// TODO model rendering
|
||||||
|
/* private static class ModelMoverMinecart extends Model {
|
||||||
|
|
||||||
private final ModelPart model;
|
private final ModelRenderer box;
|
||||||
|
|
||||||
public ModelMoverMinecart() {
|
public ModelMoverMinecart() {
|
||||||
super(RenderType::entityCutout);
|
super(RenderType::getEntityCutout);
|
||||||
var mesh = new MeshDefinition();
|
this.box = new ModelRenderer(this, 0, 0);
|
||||||
var part = mesh.getRoot();
|
this.box.setTextureSize(64, 64);
|
||||||
part.addOrReplaceChild("main", new CubeListBuilder().addBox(0, 0, 0, 16, 24, 16), PartPose.ZERO);
|
this.box.addBox(0, 0, 0, 16, 24, 16);
|
||||||
this.model = LayerDefinition.create(mesh, 64, 64).bakeRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
||||||
this.model.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,32 @@
|
||||||
package de.ellpeck.naturesaura.events;
|
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.Helper;
|
||||||
import de.ellpeck.naturesaura.ModConfig;
|
import de.ellpeck.naturesaura.ModConfig;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
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.api.aura.type.IAuraType;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.*;
|
|
||||||
import de.ellpeck.naturesaura.items.ItemAuraCache;
|
import de.ellpeck.naturesaura.items.ItemAuraCache;
|
||||||
import de.ellpeck.naturesaura.items.ItemRangeVisualizer;
|
import de.ellpeck.naturesaura.items.ItemRangeVisualizer;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import de.ellpeck.naturesaura.packet.PacketAuraChunk;
|
import de.ellpeck.naturesaura.packet.PacketAuraChunk;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
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.renderer.BiomeColors;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.util.Tuple;
|
import net.minecraft.util.Tuple;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.*;
|
||||||
import net.minecraft.world.level.block.BonemealableBlock;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
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.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
import net.minecraftforge.client.event.RenderLevelLastEvent;
|
import net.minecraftforge.client.event.RenderLevelLastEvent;
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
import net.minecraftforge.energy.EnergyStorage;
|
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import org.apache.commons.lang3.mutable.MutableInt;
|
import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
|
@ -248,132 +236,131 @@ public class ClientEvents {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onOverlayRender(RenderGameOverlayEvent.Post event) {
|
public void onOverlayRender(RenderGameOverlayEvent.Post event) {
|
||||||
var mc = Minecraft.getInstance();
|
// TODO raw rendering bleh, should be easy enough to convert to PoseStack stuff
|
||||||
var stack = event.getMatrixStack();
|
/*Minecraft mc = Minecraft.getInstance();
|
||||||
if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
|
PoseStack stack = event.getMatrixStack();
|
||||||
|
if (event.getType() == ElementType.ALL) {
|
||||||
var res = event.getWindow();
|
var res = event.getWindow();
|
||||||
if (mc.player != null) {
|
if (mc.player != null) {
|
||||||
if (!heldCache.isEmpty()) {
|
if (!heldCache.isEmpty()) {
|
||||||
var container = heldCache.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
|
IAuraContainer container = heldCache.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
|
||||||
var width = Mth.ceil(container.getStoredAura() / (float) container.getMaxAura() * 80);
|
int width = Mth.ceil(container.getStoredAura() / (float) container.getMaxAura() * 80);
|
||||||
|
|
||||||
int conf = ModConfig.instance.cacheBarLocation.get();
|
int conf = ModConfig.instance.cacheBarLocation.get();
|
||||||
var x = res.getGuiScaledWidth() / 2 + (conf == 0 ? -173 - (mc.player.getOffhandItem().isEmpty() ? 0 : 29) : 93);
|
int x = res.getGuiScaledWidth() / 2 + (conf == 0 ? -173 - (mc.player.getOffhandItem().isEmpty() ? 0 : 29) : 93);
|
||||||
var y = res.getGuiScaledHeight() - 8;
|
int y = res.getScreenHeight() - 8;
|
||||||
|
|
||||||
stack.pushPose();
|
RenderSystem.pushMatrix();
|
||||||
|
|
||||||
var color = container.getAuraColor();
|
int color = container.getAuraColor();
|
||||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
RenderSystem.color4f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
||||||
RenderSystem.setShaderTexture(0, OVERLAYS);
|
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||||
if (width < 80)
|
if (width < 80)
|
||||||
Screen.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
AbstractGui.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
Screen.blit(stack, x, y, 0, 6, width, 6, 256, 256);
|
AbstractGui.blit(stack, x, y, 0, 6, width, 6, 256, 256);
|
||||||
|
|
||||||
var scale = 0.75F;
|
float scale = 0.75F;
|
||||||
stack.pushPose();
|
RenderSystem.scalef(scale, scale, scale);
|
||||||
stack.scale(scale, scale, scale);
|
String s = heldCache.getDisplayName().getString();
|
||||||
var s = heldCache.getDisplayName().getString();
|
mc.fontRenderer.drawStringWithShadow(stack, s, conf == 1 ? x / scale : (x + 80) / scale - mc.fontRenderer.getStringWidth(s), (y - 7) / scale, color);
|
||||||
mc.font.drawShadow(stack, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color);
|
|
||||||
stack.popPose();
|
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1);
|
RenderSystem.color4f(1F, 1F, 1F, 1);
|
||||||
stack.pushPose();
|
RenderSystem.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!heldEye.isEmpty() || !heldOcular.isEmpty()) {
|
if (!heldEye.isEmpty() || !heldOcular.isEmpty()) {
|
||||||
stack.pushPose();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.setShaderTexture(0, OVERLAYS);
|
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||||
|
|
||||||
int conf = ModConfig.instance.auraBarLocation.get();
|
int conf = ModConfig.instance.auraBarLocation.get();
|
||||||
if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) {
|
if (!mc.gameSettings.showDebugInfo && (conf != 2 || !(mc.currentScreen instanceof ChatScreen))) {
|
||||||
var color = IAuraType.forLevel(mc.level).getColor();
|
int color = IAuraType.forLevel(mc.level).getColor();
|
||||||
RenderSystem.setShaderColor((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1);
|
RenderSystem.color4f((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1);
|
||||||
|
|
||||||
var totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.blockPosition(), 35);
|
int totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.getPosition(), 35);
|
||||||
var totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F);
|
float totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F);
|
||||||
var text = I18n.get("info." + NaturesAura.MOD_ID + ".aura_in_area");
|
String text = I18n.format("info." + NaturesAura.MOD_ID + ".aura_in_area");
|
||||||
var textScale = 0.75F;
|
float textScale = 0.75F;
|
||||||
|
|
||||||
var startX = conf % 2 == 0 ? 3 : res.getGuiScaledWidth() - 3 - 6;
|
int startX = conf % 2 == 0 ? 3 : res.getScaledWidth() - 3 - 6;
|
||||||
var startY = conf < 2 ? 10 : (!heldOcular.isEmpty() && (totalPercentage > 1F || totalPercentage < 0) ? -26 : 0) + res.getGuiScaledHeight() - 60;
|
int startY = conf < 2 ? 10 : (!heldOcular.isEmpty() && (totalPercentage > 1F || totalPercentage < 0) ? -26 : 0) + res.getScaledHeight() - 60;
|
||||||
float plusOffX = conf % 2 == 0 ? 7 : -1 - 6;
|
float plusOffX = conf % 2 == 0 ? 7 : -1 - 6;
|
||||||
var textX = conf % 2 == 0 ? 3 : res.getGuiScaledWidth() - 3 - mc.font.width(text) * textScale;
|
float textX = conf % 2 == 0 ? 3 : res.getScaledWidth() - 3 - mc.fontRenderer.getStringWidth(text) * textScale;
|
||||||
float textY = conf < 2 ? 3 : res.getGuiScaledHeight() - 3 - 6;
|
float textY = conf < 2 ? 3 : res.getScaledHeight() - 3 - 6;
|
||||||
|
|
||||||
var tHeight = Mth.ceil(Mth.clamp(totalPercentage, 0F, 1F) * 50);
|
int tHeight = Mth.ceil(Mth.clamp(totalPercentage, 0F, 1F) * 50);
|
||||||
var y = !heldOcular.isEmpty() && totalPercentage > 1F ? startY + 26 : startY;
|
int y = !heldOcular.isEmpty() && totalPercentage > 1F ? startY + 26 : startY;
|
||||||
if (tHeight < 50)
|
if (tHeight < 50)
|
||||||
Screen.blit(stack, startX, y, 6, 12, 6, 50 - tHeight, 256, 256);
|
AbstractGui.blit(stack, startX, y, 6, 12, 6, 50 - tHeight, 256, 256);
|
||||||
if (tHeight > 0)
|
if (tHeight > 0)
|
||||||
Screen.blit(stack, startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256);
|
AbstractGui.blit(stack, startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256);
|
||||||
|
|
||||||
if (!heldOcular.isEmpty()) {
|
if (!heldOcular.isEmpty()) {
|
||||||
var topHeight = Mth.ceil(Mth.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25);
|
int topHeight = Mth.ceil(Mth.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25);
|
||||||
if (topHeight > 0) {
|
if (topHeight > 0) {
|
||||||
if (topHeight < 25)
|
if (topHeight < 25)
|
||||||
Screen.blit(stack, startX, startY, 18, 12, 6, 25 - topHeight, 256, 256);
|
AbstractGui.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);
|
AbstractGui.blit(stack, startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256);
|
||||||
}
|
}
|
||||||
var bottomHeight = Mth.floor(Mth.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25);
|
int bottomHeight = Mth.floor(Mth.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25);
|
||||||
if (bottomHeight < 25) {
|
if (bottomHeight < 25) {
|
||||||
Screen.blit(stack, startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256);
|
AbstractGui.blit(stack, startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256);
|
||||||
if (bottomHeight > 0)
|
if (bottomHeight > 0)
|
||||||
Screen.blit(stack, startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256);
|
AbstractGui.blit(stack, startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalPercentage > (heldOcular.isEmpty() ? 1F : 1.5F))
|
if (totalPercentage > (heldOcular.isEmpty() ? 1F : 1.5F))
|
||||||
mc.font.drawShadow(stack, "+", startX + plusOffX, startY - 0.5F, color);
|
mc.fontRenderer.drawStringWithShadow(stack, "+", startX + plusOffX, startY - 0.5F, color);
|
||||||
if (totalPercentage < (heldOcular.isEmpty() ? 0F : -0.5F))
|
if (totalPercentage < (heldOcular.isEmpty() ? 0F : -0.5F))
|
||||||
mc.font.drawShadow(stack, "-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color);
|
mc.fontRenderer.drawStringWithShadow(stack, "-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color);
|
||||||
|
|
||||||
stack.pushPose();
|
RenderSystem.pushMatrix();
|
||||||
stack.scale(textScale, textScale, textScale);
|
RenderSystem.scalef(textScale, textScale, textScale);
|
||||||
mc.font.drawShadow(stack, text, textX / textScale, textY / textScale, color);
|
mc.fontRenderer.drawStringWithShadow(stack, text, textX / textScale, textY / textScale, color);
|
||||||
stack.popPose();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
if (!heldOcular.isEmpty()) {
|
if (!heldOcular.isEmpty()) {
|
||||||
var scale = 0.75F;
|
float scale = 0.75F;
|
||||||
stack.pushPose();
|
RenderSystem.pushMatrix();
|
||||||
stack.scale(scale, scale, scale);
|
RenderSystem.scalef(scale, scale, scale);
|
||||||
var stackX = conf % 2 == 0 ? 10 : res.getGuiScaledWidth() - 22;
|
int stackX = conf % 2 == 0 ? 10 : res.getScaledWidth() - 22;
|
||||||
var stackY = conf < 2 ? 15 : res.getGuiScaledHeight() - 55;
|
int stackY = conf < 2 ? 15 : res.getScaledHeight() - 55;
|
||||||
for (var effect : SHOWING_EFFECTS.values()) {
|
for (Tuple<ItemStack, Boolean> effect : SHOWING_EFFECTS.values()) {
|
||||||
var theX = (int) (stackX / scale);
|
int theX = (int) (stackX / scale);
|
||||||
var theY = (int) (stackY / scale);
|
int theY = (int) (stackY / scale);
|
||||||
var itemStack = effect.getA();
|
ItemStack itemStack = effect.getA();
|
||||||
Helper.renderItemInGui(itemStack, theX, theY, 1F);
|
Helper.renderItemInGui(itemStack, theX, theY, 1F);
|
||||||
if (effect.getB()) {
|
if (effect.getB()) {
|
||||||
RenderSystem.disableDepthTest();
|
GlStateManager.disableDepthTest();
|
||||||
RenderSystem.setShaderTexture(0, OVERLAYS);
|
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||||
Screen.blit(stack, theX, theY, 240, 0, 16, 16, 256, 256);
|
AbstractGui.blit(stack, theX, theY, 240, 0, 16, 16, 256, 256);
|
||||||
RenderSystem.enableDepthTest();
|
GlStateManager.enableDepthTest();
|
||||||
}
|
}
|
||||||
stackY += 8;
|
stackY += 8;
|
||||||
}
|
}
|
||||||
stack.popPose();
|
RenderSystem.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc.hitResult instanceof BlockHitResult blockHitResult) {
|
if (mc.objectMouseOver instanceof BlockRayTraceResult) {
|
||||||
var pos = blockHitResult.getBlockPos();
|
BlockPos pos = ((BlockRayTraceResult) mc.objectMouseOver).getPos();
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
var tile = mc.level.getBlockEntity(pos);
|
BlockEntity tile = mc.level.getBlockEntity(pos);
|
||||||
IAuraContainer container;
|
IAuraContainer container;
|
||||||
var x = res.getGuiScaledWidth() / 2;
|
int x = res.getScaledWidth() / 2;
|
||||||
var y = res.getGuiScaledHeight() / 2;
|
int y = res.getScaledHeight() / 2;
|
||||||
if (tile != null && (container = tile.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null)) != null) {
|
if (tile != null && (container = tile.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null)) != null) {
|
||||||
var state = mc.level.getBlockState(pos);
|
BlockState state = mc.level.getBlockState(pos);
|
||||||
var blockStack = state.getBlock().getCloneItemStack(state, blockHitResult, mc.level, pos, mc.player);
|
ItemStack blockStack = state.getBlock().getPickBlock(state, mc.objectMouseOver, mc.level, pos, mc.player);
|
||||||
this.drawContainerInfo(stack, container.getStoredAura(), container.getMaxAura(), container.getAuraColor(),
|
this.drawContainerInfo(stack, container.getStoredAura(), container.getMaxAura(), container.getAuraColor(),
|
||||||
mc, res, 35, blockStack.getDisplayName().getString(), null);
|
mc, res, 35, blockStack.getDisplayName().getString(), null);
|
||||||
|
|
||||||
if (tile instanceof BlockEntityNatureAltar) {
|
if (tile instanceof BlockEntityNatureAltar) {
|
||||||
var tileStack = ((BlockEntityNatureAltar) tile).getItemHandler().getStackInSlot(0);
|
ItemStack tileStack = ((BlockEntityNatureAltar) tile).getItemHandler().getStackInSlot(0);
|
||||||
if (!tileStack.isEmpty()) {
|
if (!tileStack.isEmpty()) {
|
||||||
var stackCont = tileStack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
|
IAuraContainer stackCont = tileStack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
|
||||||
if (stackCont != null) {
|
if (stackCont != null) {
|
||||||
this.drawContainerInfo(stack, stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(),
|
this.drawContainerInfo(stack, stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(),
|
||||||
mc, res, 55, tileStack.getDisplayName().getString(), null);
|
mc, res, 55, tileStack.getDisplayName().getString(), null);
|
||||||
|
@ -383,48 +370,50 @@ public class ClientEvents {
|
||||||
} else if (tile instanceof BlockEntityRFConverter) {
|
} else if (tile instanceof BlockEntityRFConverter) {
|
||||||
EnergyStorage storage = ((BlockEntityRFConverter) tile).storage;
|
EnergyStorage storage = ((BlockEntityRFConverter) tile).storage;
|
||||||
this.drawContainerInfo(stack, storage.getEnergyStored(), storage.getMaxEnergyStored(), 0xcc4916,
|
this.drawContainerInfo(stack, storage.getEnergyStored(), storage.getMaxEnergyStored(), 0xcc4916,
|
||||||
mc, res, 35, I18n.get("block.naturesaura.rf_converter"),
|
mc, res, 35, I18n.format("block.naturesaura.rf_converter"),
|
||||||
storage.getEnergyStored() + " / " + storage.getMaxEnergyStored() + " RF");
|
storage.getEnergyStored() + " / " + storage.getMaxEnergyStored() + " RF");
|
||||||
} else if (tile instanceof BlockEntityGratedChute chute) {
|
} else if (tile instanceof BlockEntityGratedChute) {
|
||||||
var itemStack = chute.getItemHandler().getStackInSlot(0);
|
BlockEntityGratedChute chute = (BlockEntityGratedChute) tile;
|
||||||
|
ItemStack itemStack = chute.getItemHandler().getStackInSlot(0);
|
||||||
|
|
||||||
if (itemStack.isEmpty()) {
|
if (itemStack.isEmpty())
|
||||||
mc.font.drawShadow(stack,
|
mc.fontRenderer.drawStringWithShadow(stack,
|
||||||
ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info.naturesaura.empty"),
|
TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.format("info.naturesaura.empty"),
|
||||||
x + 5, y - 11, 0xFFFFFF);
|
x + 5, y - 11, 0xFFFFFF);
|
||||||
} else {
|
else
|
||||||
Helper.renderItemInGui(itemStack, x + 2, y - 18, 1F);
|
Helper.renderItemInGui(itemStack, x + 2, y - 18, 1F);
|
||||||
}
|
|
||||||
|
|
||||||
Helper.renderItemInGui(ITEM_FRAME, x - 24, y - 24, 1F);
|
Helper.renderItemInGui(ITEM_FRAME, x - 24, y - 24, 1F);
|
||||||
RenderSystem.setShaderTexture(0, OVERLAYS);
|
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||||
var u = chute.isBlacklist ? 240 : 224;
|
int u = chute.isBlacklist ? 240 : 224;
|
||||||
RenderSystem.disableDepthTest();
|
GlStateManager.disableDepthTest();
|
||||||
Screen.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
AbstractGui.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
||||||
RenderSystem.enableDepthTest();
|
GlStateManager.enableDepthTest();
|
||||||
} else if (tile instanceof BlockEntityItemDistributor distributor) {
|
} else if (tile instanceof BlockEntityItemDistributor) {
|
||||||
|
BlockEntityItemDistributor distributor = (BlockEntityItemDistributor) tile;
|
||||||
Helper.renderItemInGui(DISPENSER, x - 24, y - 24, 1F);
|
Helper.renderItemInGui(DISPENSER, x - 24, y - 24, 1F);
|
||||||
RenderSystem.setShaderTexture(0, OVERLAYS);
|
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||||
var u = !distributor.isRandomMode ? 240 : 224;
|
int u = !distributor.isRandomMode ? 240 : 224;
|
||||||
RenderSystem.disableDepthTest();
|
GlStateManager.disableDepthTest();
|
||||||
Screen.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
AbstractGui.blit(stack, x - 18, y - 18, u, 0, 16, 16, 256, 256);
|
||||||
RenderSystem.enableDepthTest();
|
GlStateManager.enableDepthTest();
|
||||||
} else if (tile instanceof BlockEntityAuraTimer timer) {
|
} else if (tile instanceof BlockEntityAuraTimer) {
|
||||||
var itemStack = timer.getItemHandler().getStackInSlot(0);
|
BlockEntityAuraTimer timer = (BlockEntityAuraTimer) tile;
|
||||||
|
ItemStack itemStack = timer.getItemHandler().getStackInSlot(0);
|
||||||
if (!itemStack.isEmpty()) {
|
if (!itemStack.isEmpty()) {
|
||||||
Helper.renderItemInGui(itemStack, x - 20, y - 20, 1);
|
Helper.renderItemInGui(itemStack, x - 20, y - 20, 1);
|
||||||
mc.font.drawShadow(stack, ChatFormatting.GRAY + this.createTimeString(timer.getTotalTime()), x + 5, y - 11, 0xFFFFFF);
|
mc.fontRenderer.drawStringWithShadow(stack, TextFormatting.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);
|
mc.fontRenderer.drawStringWithShadow(stack, TextFormatting.GRAY + I18n.format("info.naturesaura.remaining", this.createTimeString(timer.getTimeLeft())), x + 5, y + 3, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1);
|
RenderSystem.color4f(1F, 1F, 1F, 1);
|
||||||
stack.popPose();
|
RenderSystem.popMatrix();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createTimeString(int totalTicks) {
|
private String createTimeString(int totalTicks) {
|
||||||
|
@ -435,22 +424,22 @@ public class ClientEvents {
|
||||||
return String.format("%02d:%02d:%02d.%02d", hours, minutes, seconds, ticks);
|
return String.format("%02d:%02d:%02d.%02d", hours, minutes, seconds, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawContainerInfo(PoseStack stack, int stored, int max, int color, Minecraft mc, Window res, int yOffset, String name, String textBelow) {
|
/* private void drawContainerInfo(PoseStack stack, int stored, int max, int color, Minecraft mc, MainWindow res, int yOffset, String name, String textBelow) {
|
||||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
RenderSystem.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F);
|
||||||
|
|
||||||
var x = res.getGuiScaledWidth() / 2 - 40;
|
int x = res.getScaledWidth() / 2 - 40;
|
||||||
var y = res.getGuiScaledHeight() / 2 + yOffset;
|
int y = res.getScaledHeight() / 2 + yOffset;
|
||||||
var width = Mth.ceil(stored / (float) max * 80);
|
int width = Mth.ceil(stored / (float) max * 80);
|
||||||
|
|
||||||
RenderSystem.setShaderTexture(0, OVERLAYS);
|
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||||
if (width < 80)
|
if (width < 80)
|
||||||
Screen.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
AbstractGui.blit(stack, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
Screen.blit(stack, x, y, 0, 6, width, 6, 256, 256);
|
AbstractGui.blit(stack, x, y, 0, 6, width, 6, 256, 256);
|
||||||
|
|
||||||
mc.font.drawShadow(stack, name, x + 40 - mc.font.width(name) / 2F, y - 9, color);
|
mc.fontRenderer.drawStringWithShadow(stack, name, x + 40 - mc.fontRenderer.getStringWidth(name) / 2F, y - 9, color);
|
||||||
|
|
||||||
if (textBelow != null)
|
if (textBelow != null)
|
||||||
mc.font.drawShadow(stack, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color);
|
mc.fontRenderer.drawStringWithShadow(stack, textBelow, x + 40 - mc.fontRenderer.getStringWidth(textBelow) / 2F, y + 7, color);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,11 @@ import net.minecraft.server.level.ChunkHolder;
|
||||||
import net.minecraft.server.level.ChunkMap;
|
import net.minecraft.server.level.ChunkMap;
|
||||||
import net.minecraft.server.level.ServerChunkCache;
|
import net.minecraft.server.level.ServerChunkCache;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.Level;
|
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.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
|
@ -34,26 +37,28 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
import static net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||||
|
|
||||||
public class CommonEvents {
|
public class CommonEvents {
|
||||||
|
|
||||||
private static final Method GET_LOADED_CHUNKS_METHOD = ObfuscationReflectionHelper.findMethod(ChunkMap.class, "m_140416_");
|
private static final Method GET_LOADED_CHUNKS_METHOD = ObfuscationReflectionHelper.findMethod(ChunkMap.class, "getChunks");
|
||||||
private static final ListMultimap<UUID, ChunkPos> PENDING_AURA_CHUNKS = ArrayListMultimap.create();
|
private static final ListMultimap<UUID, ChunkPos> PENDING_AURA_CHUNKS = ArrayListMultimap.create();
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBiomeLoad(BiomeLoadingEvent event) {
|
public void onBiomeLoad(BiomeLoadingEvent event) {
|
||||||
if (ModConfig.instance.auraBlooms.get()) {
|
if (ModConfig.instance.auraBlooms.get()) {
|
||||||
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.AURA_BLOOM);
|
// 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());
|
||||||
switch (event.getCategory()) {
|
switch (event.getCategory()) {
|
||||||
case DESERT -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.AURA_CACTUS);
|
case DESERT -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_CACTUS.placed());
|
||||||
case NETHER -> {
|
case NETHER -> {
|
||||||
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.CRIMSON_AURA_MUSHROOM);
|
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.placed());
|
||||||
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.WARPED_AURA_MUSHROOM);
|
event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.WARPED_AURA_MUSHROOM.placed());
|
||||||
}
|
}
|
||||||
case MUSHROOM -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Placed.AURA_MUSHROOM);
|
case MUSHROOM -> event.getGeneration().addFeature(Decoration.VEGETAL_DECORATION, ModFeatures.Configured.AURA_MUSHROOM.placed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ 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.FeatureConfiguration;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("FieldNamingConvention")
|
||||||
public final class ModFeatures {
|
public final class ModFeatures {
|
||||||
|
@ -21,6 +20,7 @@ public final class ModFeatures {
|
||||||
public static final class Configured {
|
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<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_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, ?> AURA_CACTUS = ModFeatures.AURA_CACTUS.configured(FeatureConfiguration.NONE);
|
||||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> WARPED_AURA_MUSHROOM = ModFeatures.WARPED_AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> WARPED_AURA_MUSHROOM = ModFeatures.WARPED_AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
||||||
|
@ -28,14 +28,4 @@ public final class ModFeatures {
|
||||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_MUSHROOM = ModFeatures.AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
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
Loading…
Reference in a new issue