mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
cleanup
This commit is contained in:
parent
a004fd9918
commit
6a20dbadc9
50 changed files with 290 additions and 328 deletions
|
@ -6,7 +6,7 @@ To add this project as a dependency (for using the [API](https://github.com/Ellp
|
||||||
```
|
```
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url 'https://pkgs.dev.azure.com/Ellpeck/Public/_packaging/NaturesAura/maven/v1'
|
url 'https://pkgs.dev.azure.com/Ellpeck/Public/_packaging/All/maven/v1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ publishing {
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url 'https://pkgs.dev.azure.com/Ellpeck/Public/_packaging/NaturesAura/maven/v1'
|
url 'https://pkgs.dev.azure.com/Ellpeck/Public/_packaging/All/maven/v1'
|
||||||
credentials {
|
credentials {
|
||||||
username "Azure DevOps Services"
|
username "Azure DevOps Services"
|
||||||
password System.getenv('ACCESS_TOKEN')
|
password System.getenv('ACCESS_TOKEN')
|
||||||
|
|
|
@ -37,8 +37,14 @@ public final class NaturesAura {
|
||||||
public static final String VERSION = "@VERSION@";
|
public static final String VERSION = "@VERSION@";
|
||||||
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
|
public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
|
||||||
|
public static final ItemGroup CREATIVE_TAB = new ItemGroup(MOD_ID) {
|
||||||
|
@Override
|
||||||
|
public ItemStack createIcon() {
|
||||||
|
return new ItemStack(ModItems.GOLD_LEAF);
|
||||||
|
}
|
||||||
|
};
|
||||||
public static NaturesAura instance;
|
public static NaturesAura instance;
|
||||||
|
public static IProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);
|
||||||
|
|
||||||
public NaturesAura() {
|
public NaturesAura() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
@ -49,15 +55,6 @@ public final class NaturesAura {
|
||||||
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, builder.build());
|
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, builder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);
|
|
||||||
|
|
||||||
public static final ItemGroup CREATIVE_TAB = new ItemGroup(MOD_ID) {
|
|
||||||
@Override
|
|
||||||
public ItemStack createIcon() {
|
|
||||||
return new ItemStack(ModItems.GOLD_LEAF);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public void setup(FMLCommonSetupEvent event) {
|
public void setup(FMLCommonSetupEvent event) {
|
||||||
this.preInit(event);
|
this.preInit(event);
|
||||||
this.init(event);
|
this.init(event);
|
||||||
|
|
|
@ -41,12 +41,9 @@ import java.util.function.Supplier;
|
||||||
* internal mod functions not exposed to the API.
|
* internal mod functions not exposed to the API.
|
||||||
*/
|
*/
|
||||||
public final class NaturesAuraAPI {
|
public final class NaturesAuraAPI {
|
||||||
private static IInternalHooks instance = new StubHooks();
|
|
||||||
|
|
||||||
public static final String MOD_ID = "naturesaura";
|
public static final String MOD_ID = "naturesaura";
|
||||||
public static final String API_ID = MOD_ID + "api";
|
public static final String API_ID = MOD_ID + "api";
|
||||||
public static final String VERSION = "9";
|
public static final String VERSION = "9";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of all {@link AltarRecipe} instances which are the recipes used
|
* The list of all {@link AltarRecipe} instances which are the recipes used
|
||||||
* by the Natural Altar. Newly created recipes can be easily added using
|
* by the Natural Altar. Newly created recipes can be easily added using
|
||||||
|
@ -131,7 +128,6 @@ public final class NaturesAuraAPI {
|
||||||
* each generate in the projectile generator
|
* each generate in the projectile generator
|
||||||
*/
|
*/
|
||||||
public static final Map<EntityType, Integer> PROJECTILE_GENERATIONS = new HashMap<>();
|
public static final Map<EntityType, Integer> PROJECTILE_GENERATIONS = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The capability for any item or block that stores Aura in the form of an
|
* The capability for any item or block that stores Aura in the form of an
|
||||||
* {@link IAuraContainer}
|
* {@link IAuraContainer}
|
||||||
|
@ -161,6 +157,7 @@ public final class NaturesAuraAPI {
|
||||||
*/
|
*/
|
||||||
@CapabilityInject(IWorldData.class)
|
@CapabilityInject(IWorldData.class)
|
||||||
public static Capability<IWorldData> capWorldData;
|
public static Capability<IWorldData> capWorldData;
|
||||||
|
private static IInternalHooks instance = new StubHooks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the active {@link IInternalHooks} instance which can
|
* This method returns the active {@link IInternalHooks} instance which can
|
||||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.naturesaura.api.aura.type;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IAuraType {
|
public interface IAuraType {
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,6 @@ public class Matcher {
|
||||||
this.check = check;
|
this.check = check;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockState getDefaultState() {
|
|
||||||
return this.defaultState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICheck getCheck() {
|
|
||||||
return this.check;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Matcher wildcard() {
|
public static Matcher wildcard() {
|
||||||
return new Matcher(Blocks.AIR.getDefaultState(), null);
|
return new Matcher(Blocks.AIR.getDefaultState(), null);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +25,14 @@ public class Matcher {
|
||||||
return new Matcher(defaultBlock.getDefaultState(), (world, start, offset, pos, state, c) -> state.getBlock().getTags().contains(tag.getId()));
|
return new Matcher(defaultBlock.getDefaultState(), (world, start, offset, pos, state, c) -> state.getBlock().getTags().contains(tag.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockState getDefaultState() {
|
||||||
|
return this.defaultState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICheck getCheck() {
|
||||||
|
return this.check;
|
||||||
|
}
|
||||||
|
|
||||||
public interface ICheck {
|
public interface ICheck {
|
||||||
boolean matches(IWorld world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c);
|
boolean matches(IWorld world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public interface ITrinketItem {
|
public interface ITrinketItem {
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
void render(ItemStack stack, PlayerEntity player, RenderType type, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight, boolean isHolding);
|
||||||
|
|
||||||
enum RenderType {
|
enum RenderType {
|
||||||
HEAD, BODY
|
HEAD, BODY
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
void render(ItemStack stack, PlayerEntity player, RenderType type, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight, boolean isHolding);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraDetector;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraDetector;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.world.World;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraft.world.storage.loot.LootContext;
|
import net.minecraft.world.storage.loot.LootContext;
|
||||||
import net.minecraft.world.storage.loot.LootParameters;
|
import net.minecraft.world.storage.loot.LootParameters;
|
||||||
import net.minecraft.world.storage.loot.conditions.BlockStateProperty;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -45,7 +44,7 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem {
|
||||||
ModRegistry.add(this);
|
ModRegistry.add(this);
|
||||||
ModRegistry.add(this.tileType);
|
ModRegistry.add(this.tileType);
|
||||||
|
|
||||||
if(this.hasWaterlogging())
|
if (this.hasWaterlogging())
|
||||||
this.setDefaultState(this.stateContainer.getBaseState().with(BlockStateProperties.WATERLOGGED, false));
|
this.setDefaultState(this.stateContainer.getBaseState().with(BlockStateProperties.WATERLOGGED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,21 +42,6 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
this.setDefaultState(this.stateContainer.getBaseState().with(NORTH, RedstoneSide.NONE).with(EAST, RedstoneSide.NONE).with(SOUTH, RedstoneSide.NONE).with(WEST, RedstoneSide.NONE));
|
this.setDefaultState(this.stateContainer.getBaseState().with(NORTH, RedstoneSide.NONE).with(EAST, RedstoneSide.NONE).with(SOUTH, RedstoneSide.NONE).with(WEST, RedstoneSide.NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
|
||||||
builder.add(NORTH, EAST, SOUTH, WEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockColor getBlockColor() {
|
|
||||||
return (state, worldIn, pos, tintIndex) -> 0xf4cb42;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
|
||||||
return SHAPES[getShapeIndex(state)];
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getShapeIndex(BlockState state) {
|
private static int getShapeIndex(BlockState state) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
boolean n = state.get(NORTH) != RedstoneSide.NONE;
|
boolean n = state.get(NORTH) != RedstoneSide.NONE;
|
||||||
|
@ -79,6 +64,21 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||||
|
builder.add(NORTH, EAST, SOUTH, WEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockColor getBlockColor() {
|
||||||
|
return (state, worldIn, pos, tintIndex) -> 0xf4cb42;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
|
return SHAPES[getShapeIndex(state)];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
IBlockReader iblockreader = context.getWorld();
|
IBlockReader iblockreader = context.getWorld();
|
||||||
|
|
|
@ -34,6 +34,19 @@ public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IColorPr
|
||||||
ModRegistry.add(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean convert(World world, BlockPos pos) {
|
||||||
|
BlockState state = world.getBlockState(pos);
|
||||||
|
if ((state.getBlock().isFoliage(state, world, pos) || state.getBlock() instanceof LeavesBlock) && !(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) {
|
||||||
|
if (!world.isRemote) {
|
||||||
|
world.setBlockState(pos, ModBlocks.GOLDEN_LEAVES.getDefaultState()
|
||||||
|
.with(DISTANCE, state.has(DISTANCE) ? state.get(DISTANCE) : 1)
|
||||||
|
.with(PERSISTENT, state.has(PERSISTENT) ? state.get(PERSISTENT) : false));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBaseName() {
|
public String getBaseName() {
|
||||||
return "golden_leaves";
|
return "golden_leaves";
|
||||||
|
@ -99,19 +112,6 @@ public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IColorPr
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean convert(World world, BlockPos pos) {
|
|
||||||
BlockState state = world.getBlockState(pos);
|
|
||||||
if ((state.getBlock().isFoliage(state, world, pos) || state.getBlock() instanceof LeavesBlock) && !(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
world.setBlockState(pos, ModBlocks.GOLDEN_LEAVES.getDefaultState()
|
|
||||||
.with(DISTANCE, state.has(DISTANCE) ? state.get(DISTANCE) : 1)
|
|
||||||
.with(PERSISTENT, state.has(PERSISTENT) ? state.get(PERSISTENT) : false));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateCustomBlockState(BlockStateGenerator generator) {
|
public void generateCustomBlockState(BlockStateGenerator generator) {
|
||||||
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
|
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityMossGenerator;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityMossGenerator;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
|
@ -4,7 +4,6 @@ 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.api.render.IVisualizable;
|
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOakGenerator;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOakGenerator;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
|
@ -70,7 +69,6 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
||||||
return 0x2e7a11;
|
return 0x2e7a11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateCustomBlockState(BlockStateGenerator generator) {
|
public void generateCustomBlockState(BlockStateGenerator generator) {
|
||||||
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
|
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
public class BlockStairsNA extends StairsBlock implements IModItem, ICustomBlockState {
|
public class BlockStairsNA extends StairsBlock implements IModItem, ICustomBlockState {
|
||||||
|
|
||||||
private final String baseName;
|
|
||||||
public final String textureName;
|
public final String textureName;
|
||||||
|
private final String baseName;
|
||||||
|
|
||||||
public BlockStairsNA(String baseName, String textureName, Supplier<BlockState> modelState, Block.Properties properties) {
|
public BlockStairsNA(String baseName, String textureName, Supplier<BlockState> modelState, Block.Properties properties) {
|
||||||
super(modelState, properties.variableOpacity());
|
super(modelState, properties.variableOpacity());
|
||||||
|
|
|
@ -9,8 +9,8 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class Slab extends SlabBlock implements IModItem, ICustomBlockState {
|
public class Slab extends SlabBlock implements IModItem, ICustomBlockState {
|
||||||
|
|
||||||
private final String baseName;
|
|
||||||
public final String textureName;
|
public final String textureName;
|
||||||
|
private final String baseName;
|
||||||
|
|
||||||
public Slab(String baseName, String textureName, Properties properties) {
|
public Slab(String baseName, String textureName, Properties properties) {
|
||||||
super(properties);
|
super(properties);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class TileEntityEnderCrate extends TileEntityImpl implements INamedContainerProvider {
|
public class TileEntityEnderCrate extends TileEntityImpl implements INamedContainerProvider {
|
||||||
|
|
||||||
|
public String name;
|
||||||
private final IItemHandlerModifiable wrappedEnderStorage = new IItemHandlerModifiable() {
|
private final IItemHandlerModifiable wrappedEnderStorage = new IItemHandlerModifiable() {
|
||||||
@Override
|
@Override
|
||||||
public void setStackInSlot(int slot, @Nonnull ItemStack stack) {
|
public void setStackInSlot(int slot, @Nonnull ItemStack stack) {
|
||||||
|
@ -73,7 +74,6 @@ public class TileEntityEnderCrate extends TileEntityImpl implements INamedContai
|
||||||
return IWorldData.getOverworldData(TileEntityEnderCrate.this.world).getEnderStorage(TileEntityEnderCrate.this.name);
|
return IWorldData.getOverworldData(TileEntityEnderCrate.this.world).getEnderStorage(TileEntityEnderCrate.this.name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public String name;
|
|
||||||
|
|
||||||
public TileEntityEnderCrate() {
|
public TileEntityEnderCrate() {
|
||||||
super(ModTileEntities.ENDER_CRATE);
|
super(ModTileEntities.ENDER_CRATE);
|
||||||
|
|
|
@ -30,6 +30,25 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
||||||
super(ModTileEntities.FURNACE_HEATER);
|
super(ModTileEntities.FURNACE_HEATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IIntArray getFurnaceData(AbstractFurnaceTileEntity tile) {
|
||||||
|
try {
|
||||||
|
return (IIntArray) FURNACE_DATA_FIELD.get(tile);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
NaturesAura.LOGGER.fatal("Couldn't reflect furnace field", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IRecipeType<? extends AbstractCookingRecipe> getRecipeType(AbstractFurnaceTileEntity furnace) {
|
||||||
|
if (furnace instanceof BlastFurnaceTileEntity) {
|
||||||
|
return IRecipeType.BLASTING;
|
||||||
|
} else if (furnace instanceof SmokerTileEntity) {
|
||||||
|
return IRecipeType.SMOKING;
|
||||||
|
} else {
|
||||||
|
return IRecipeType.SMELTING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (!this.world.isRemote && this.world.getGameTime() % 5 == 0) {
|
if (!this.world.isRemote && this.world.getGameTime() % 5 == 0) {
|
||||||
|
@ -76,15 +95,6 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IIntArray getFurnaceData(AbstractFurnaceTileEntity tile) {
|
|
||||||
try {
|
|
||||||
return (IIntArray) FURNACE_DATA_FIELD.get(tile);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
NaturesAura.LOGGER.fatal("Couldn't reflect furnace field", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isReady(AbstractFurnaceTileEntity furnace) {
|
private boolean isReady(AbstractFurnaceTileEntity furnace) {
|
||||||
if (!furnace.getStackInSlot(1).isEmpty())
|
if (!furnace.getStackInSlot(1).isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -101,16 +111,6 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IRecipeType<? extends AbstractCookingRecipe> getRecipeType(AbstractFurnaceTileEntity furnace) {
|
|
||||||
if (furnace instanceof BlastFurnaceTileEntity) {
|
|
||||||
return IRecipeType.BLASTING;
|
|
||||||
} else if (furnace instanceof SmokerTileEntity) {
|
|
||||||
return IRecipeType.SMOKING;
|
|
||||||
} else {
|
|
||||||
return IRecipeType.SMELTING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||||
super.writeNBT(compound, type);
|
super.writeNBT(compound, type);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.ellpeck.naturesaura.blocks.tiles;
|
package de.ellpeck.naturesaura.blocks.tiles;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.ITickableTileEntity;
|
import net.minecraft.tileentity.ITickableTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
@ -20,6 +19,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class TileEntityGratedChute extends TileEntityImpl implements ITickableTileEntity {
|
public class TileEntityGratedChute extends TileEntityImpl implements ITickableTileEntity {
|
||||||
|
|
||||||
|
public boolean isBlacklist;
|
||||||
private final ItemStackHandlerNA items = new ItemStackHandlerNA(1, this, true) {
|
private final ItemStackHandlerNA items = new ItemStackHandlerNA(1, this, true) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean canExtract(ItemStack stack, int slot, int amount) {
|
protected boolean canExtract(ItemStack stack, int slot, int amount) {
|
||||||
|
@ -31,7 +31,6 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickableTi
|
||||||
return TileEntityGratedChute.this.isBlacklist != TileEntityGratedChute.this.isItemInFrame(stack);
|
return TileEntityGratedChute.this.isBlacklist != TileEntityGratedChute.this.isItemInFrame(stack);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public boolean isBlacklist;
|
|
||||||
private int cooldown;
|
private int cooldown;
|
||||||
|
|
||||||
public TileEntityGratedChute() {
|
public TileEntityGratedChute() {
|
||||||
|
|
|
@ -22,6 +22,14 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable
|
||||||
super(ModTileEntities.HOPPER_UPGRADE);
|
super(ModTileEntities.HOPPER_UPGRADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isValidHopper(TileEntity tile) {
|
||||||
|
if (tile instanceof HopperTileEntity)
|
||||||
|
return tile.getWorld().getBlockState(tile.getPos()).get(HopperBlock.ENABLED);
|
||||||
|
if (tile instanceof TileEntityGratedChute)
|
||||||
|
return ((TileEntityGratedChute) tile).redstonePower <= 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (!this.world.isRemote && this.world.getGameTime() % 10 == 0) {
|
if (!this.world.isRemote && this.world.getGameTime() % 10 == 0) {
|
||||||
|
@ -68,12 +76,4 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isValidHopper(TileEntity tile) {
|
|
||||||
if (tile instanceof HopperTileEntity)
|
|
||||||
return tile.getWorld().getBlockState(tile.getPos()).get(HopperBlock.ENABLED);
|
|
||||||
if (tile instanceof TileEntityGratedChute)
|
|
||||||
return ((TileEntityGratedChute) tile).redstonePower <= 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.util.Random;
|
||||||
|
|
||||||
public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTileEntity {
|
public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTileEntity {
|
||||||
|
|
||||||
|
private final BasicAuraContainer container = new BasicAuraContainer(NaturesAuraAPI.TYPE_OVERWORLD, 500000);
|
||||||
|
private final ItemStack[] catalysts = new ItemStack[4];
|
||||||
public final ItemStackHandler items = new ItemStackHandlerNA(1, this, true) {
|
public final ItemStackHandler items = new ItemStackHandlerNA(1, this, true) {
|
||||||
@Override
|
@Override
|
||||||
public int getSlotLimit(int slot) {
|
public int getSlotLimit(int slot) {
|
||||||
|
@ -50,12 +52,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
|
||||||
return TileEntityNatureAltar.this.getRecipeForInput(stack) == null;
|
return TileEntityNatureAltar.this.getRecipeForInput(stack) == null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public int bobTimer;
|
public int bobTimer;
|
||||||
|
|
||||||
private final BasicAuraContainer container = new BasicAuraContainer(NaturesAuraAPI.TYPE_OVERWORLD, 500000);
|
|
||||||
private final ItemStack[] catalysts = new ItemStack[4];
|
|
||||||
public boolean structureFine;
|
public boolean structureFine;
|
||||||
|
|
||||||
private AltarRecipe currentRecipe;
|
private AltarRecipe currentRecipe;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.block.LogBlock;
|
import net.minecraft.block.LogBlock;
|
||||||
import net.minecraft.tileentity.ITickableTileEntity;
|
import net.minecraft.tileentity.ITickableTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
|
|
|
@ -36,6 +36,13 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
||||||
super(ModTileEntities.OFFERING_TABLE);
|
super(ModTileEntities.OFFERING_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static OfferingRecipe getRecipe(ItemStack input) {
|
||||||
|
for (OfferingRecipe recipe : NaturesAuraAPI.OFFERING_RECIPES.values())
|
||||||
|
if (recipe.input.test(input))
|
||||||
|
return recipe;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (!this.world.isRemote) {
|
if (!this.world.isRemote) {
|
||||||
|
@ -92,13 +99,6 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static OfferingRecipe getRecipe(ItemStack input) {
|
|
||||||
for (OfferingRecipe recipe : NaturesAuraAPI.OFFERING_RECIPES.values())
|
|
||||||
if (recipe.input.test(input))
|
|
||||||
return recipe;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||||
super.writeNBT(compound, type);
|
super.writeNBT(compound, type);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package de.ellpeck.naturesaura.blocks.tiles;
|
package de.ellpeck.naturesaura.blocks.tiles;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
|
|
||||||
public class TileEntityPickupStopper extends TileEntityImpl {
|
public class TileEntityPickupStopper extends TileEntityImpl {
|
||||||
|
|
||||||
public TileEntityPickupStopper() {
|
public TileEntityPickupStopper() {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.ITickableTileEntity;
|
import net.minecraft.tileentity.ITickableTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.client.renderer.Vector3f;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> {
|
public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> {
|
||||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -2,8 +2,8 @@ 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.items.ModItems;
|
|
||||||
import de.ellpeck.naturesaura.data.ItemTagProvider;
|
import de.ellpeck.naturesaura.data.ItemTagProvider;
|
||||||
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -39,6 +39,45 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
||||||
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(int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
|
||||||
|
float f = (float) Math.atan(yaw / 40.0F);
|
||||||
|
float f1 = (float) Math.atan(pitch / 40.0F);
|
||||||
|
RenderSystem.pushMatrix();
|
||||||
|
RenderSystem.translatef((float) x, (float) y, 1050.0F);
|
||||||
|
RenderSystem.scalef(1.0F, 1.0F, -1.0F);
|
||||||
|
MatrixStack matrixstack = new MatrixStack();
|
||||||
|
matrixstack.translate(0.0D, 0.0D, 1000.0D);
|
||||||
|
matrixstack.scale(scale, scale, scale);
|
||||||
|
Quaternion quaternion = Vector3f.ZP.rotationDegrees(180.0F);
|
||||||
|
Quaternion quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
|
||||||
|
quaternion.multiply(quaternion1);
|
||||||
|
matrixstack.rotate(quaternion);
|
||||||
|
float f2 = entity.renderYawOffset;
|
||||||
|
float f3 = entity.rotationYaw;
|
||||||
|
float f4 = entity.rotationPitch;
|
||||||
|
float f5 = entity.prevRotationYawHead;
|
||||||
|
float f6 = entity.rotationYawHead;
|
||||||
|
entity.renderYawOffset = 180.0F + f * 20.0F;
|
||||||
|
entity.rotationYaw = 180.0F + f * 40.0F;
|
||||||
|
entity.rotationPitch = -f1 * 20.0F;
|
||||||
|
entity.rotationYawHead = entity.rotationYaw;
|
||||||
|
entity.prevRotationYawHead = entity.rotationYaw;
|
||||||
|
EntityRendererManager entityrenderermanager = Minecraft.getInstance().getRenderManager();
|
||||||
|
quaternion1.conjugate();
|
||||||
|
entityrenderermanager.setCameraOrientation(quaternion1);
|
||||||
|
entityrenderermanager.setRenderShadow(false);
|
||||||
|
IRenderTypeBuffer.Impl buff = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||||
|
entityrenderermanager.renderEntityStatic(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
|
||||||
|
buff.finish();
|
||||||
|
entityrenderermanager.setRenderShadow(true);
|
||||||
|
entity.renderYawOffset = f2;
|
||||||
|
entity.rotationYaw = f3;
|
||||||
|
entity.rotationPitch = f4;
|
||||||
|
entity.prevRotationYawHead = f5;
|
||||||
|
entity.rotationYawHead = f6;
|
||||||
|
RenderSystem.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getUid() {
|
public ResourceLocation getUid() {
|
||||||
return JEINaturesAuraPlugin.SPAWNER;
|
return JEINaturesAuraPlugin.SPAWNER;
|
||||||
|
@ -97,43 +136,4 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
||||||
String name = recipe.entity.getName().getFormattedText();
|
String name = recipe.entity.getName().getFormattedText();
|
||||||
minecraft.fontRenderer.drawStringWithShadow(name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
|
minecraft.fontRenderer.drawStringWithShadow(name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderEntity(int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
|
|
||||||
float f = (float) Math.atan(yaw / 40.0F);
|
|
||||||
float f1 = (float) Math.atan(pitch / 40.0F);
|
|
||||||
RenderSystem.pushMatrix();
|
|
||||||
RenderSystem.translatef((float) x, (float) y, 1050.0F);
|
|
||||||
RenderSystem.scalef(1.0F, 1.0F, -1.0F);
|
|
||||||
MatrixStack matrixstack = new MatrixStack();
|
|
||||||
matrixstack.translate(0.0D, 0.0D, 1000.0D);
|
|
||||||
matrixstack.scale(scale, scale, scale);
|
|
||||||
Quaternion quaternion = Vector3f.ZP.rotationDegrees(180.0F);
|
|
||||||
Quaternion quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
|
|
||||||
quaternion.multiply(quaternion1);
|
|
||||||
matrixstack.rotate(quaternion);
|
|
||||||
float f2 = entity.renderYawOffset;
|
|
||||||
float f3 = entity.rotationYaw;
|
|
||||||
float f4 = entity.rotationPitch;
|
|
||||||
float f5 = entity.prevRotationYawHead;
|
|
||||||
float f6 = entity.rotationYawHead;
|
|
||||||
entity.renderYawOffset = 180.0F + f * 20.0F;
|
|
||||||
entity.rotationYaw = 180.0F + f * 40.0F;
|
|
||||||
entity.rotationPitch = -f1 * 20.0F;
|
|
||||||
entity.rotationYawHead = entity.rotationYaw;
|
|
||||||
entity.prevRotationYawHead = entity.rotationYaw;
|
|
||||||
EntityRendererManager entityrenderermanager = Minecraft.getInstance().getRenderManager();
|
|
||||||
quaternion1.conjugate();
|
|
||||||
entityrenderermanager.setCameraOrientation(quaternion1);
|
|
||||||
entityrenderermanager.setRenderShadow(false);
|
|
||||||
IRenderTypeBuffer.Impl buff = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
|
||||||
entityrenderermanager.renderEntityStatic(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
|
|
||||||
buff.finish();
|
|
||||||
entityrenderermanager.setRenderShadow(true);
|
|
||||||
entity.renderYawOffset = f2;
|
|
||||||
entity.rotationYaw = f3;
|
|
||||||
entity.rotationPitch = f4;
|
|
||||||
entity.prevRotationYawHead = f5;
|
|
||||||
entity.rotationYawHead = f6;
|
|
||||||
RenderSystem.popMatrix();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ import de.ellpeck.naturesaura.ModConfig;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.multiblock.Matcher;
|
import de.ellpeck.naturesaura.api.multiblock.Matcher;
|
||||||
import de.ellpeck.naturesaura.compat.ICompat;
|
import de.ellpeck.naturesaura.compat.ICompat;
|
||||||
import de.ellpeck.naturesaura.events.ClientEvents;
|
|
||||||
import de.ellpeck.naturesaura.data.ItemTagProvider;
|
import de.ellpeck.naturesaura.data.ItemTagProvider;
|
||||||
|
import de.ellpeck.naturesaura.events.ClientEvents;
|
||||||
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
|
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
|
||||||
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler.FancyInfo;
|
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler.FancyInfo;
|
||||||
import net.minecraft.client.gui.AbstractGui;
|
import net.minecraft.client.gui.AbstractGui;
|
||||||
|
@ -31,6 +31,29 @@ public class PatchouliCompat implements ICompat {
|
||||||
|
|
||||||
private static final ResourceLocation BOOK = new ResourceLocation(NaturesAura.MOD_ID, "book");
|
private static final ResourceLocation BOOK = new ResourceLocation(NaturesAura.MOD_ID, "book");
|
||||||
|
|
||||||
|
public static void addPatchouliMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers) {
|
||||||
|
for (int i = 1; i < rawMatchers.length; i += 2) {
|
||||||
|
if (rawMatchers[i] instanceof Matcher) {
|
||||||
|
Matcher matcher = (Matcher) rawMatchers[i];
|
||||||
|
Matcher.ICheck check = matcher.getCheck();
|
||||||
|
if (check == null)
|
||||||
|
rawMatchers[i] = PatchouliAPI.instance.anyMatcher();
|
||||||
|
else
|
||||||
|
rawMatchers[i] = PatchouliAPI.instance.predicateMatcher(matcher.getDefaultState(),
|
||||||
|
state -> check.matches(null, null, null, null, state, (char) 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PatchouliAPI.instance.registerMultiblock(name, PatchouliAPI.instance.makeMultiblock(pattern, rawMatchers));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T getRecipe(Map<ResourceLocation, T> recipes, String name) {
|
||||||
|
ResourceLocation res = new ResourceLocation(name);
|
||||||
|
T recipe = recipes.get(res);
|
||||||
|
if (recipe == null)
|
||||||
|
recipe = recipes.get(new ResourceLocation("crafttweaker", res.getPath()));
|
||||||
|
return recipe;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
PatchouliAPI.instance.setConfigFlag(NaturesAura.MOD_ID + ":rf_converter", ModConfig.instance.rfConverter.get());
|
PatchouliAPI.instance.setConfigFlag(NaturesAura.MOD_ID + ":rf_converter", ModConfig.instance.rfConverter.get());
|
||||||
|
@ -101,27 +124,4 @@ public class PatchouliCompat implements ICompat {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPatchouliMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers) {
|
|
||||||
for (int i = 1; i < rawMatchers.length; i += 2) {
|
|
||||||
if (rawMatchers[i] instanceof Matcher) {
|
|
||||||
Matcher matcher = (Matcher) rawMatchers[i];
|
|
||||||
Matcher.ICheck check = matcher.getCheck();
|
|
||||||
if (check == null)
|
|
||||||
rawMatchers[i] = PatchouliAPI.instance.anyMatcher();
|
|
||||||
else
|
|
||||||
rawMatchers[i] = PatchouliAPI.instance.predicateMatcher(matcher.getDefaultState(),
|
|
||||||
state -> check.matches(null, null, null, null, state, (char) 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PatchouliAPI.instance.registerMultiblock(name, PatchouliAPI.instance.makeMultiblock(pattern, rawMatchers));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> T getRecipe(Map<ResourceLocation, T> recipes, String name) {
|
|
||||||
ResourceLocation res = new ResourceLocation(name);
|
|
||||||
T recipe = recipes.get(res);
|
|
||||||
if (recipe == null)
|
|
||||||
recipe = recipes.get(new ResourceLocation("crafttweaker", res.getPath()));
|
|
||||||
return recipe;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,10 @@ public class BlockLootProvider implements IDataProvider {
|
||||||
this.lootFunctions.put(ModBlocks.NETHER_WART_MUSHROOM, b -> LootTableHooks.genSilkOr(b, ItemLootEntry.builder(Items.NETHER_WART).acceptFunction(SetCount.builder(RandomValueRange.of(1, 2)))));
|
this.lootFunctions.put(ModBlocks.NETHER_WART_MUSHROOM, b -> LootTableHooks.genSilkOr(b, ItemLootEntry.builder(Items.NETHER_WART).acceptFunction(SetCount.builder(RandomValueRange.of(1, 2)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Path getPath(Path root, ResourceLocation res) {
|
||||||
|
return root.resolve("data/" + res.getNamespace() + "/loot_tables/blocks/" + res.getPath() + ".json");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void act(DirectoryCache cache) throws IOException {
|
public void act(DirectoryCache cache) throws IOException {
|
||||||
for (Map.Entry<Block, Function<Block, LootTable.Builder>> function : this.lootFunctions.entrySet()) {
|
for (Map.Entry<Block, Function<Block, LootTable.Builder>> function : this.lootFunctions.entrySet()) {
|
||||||
|
@ -64,10 +68,6 @@ public class BlockLootProvider implements IDataProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Path getPath(Path root, ResourceLocation res) {
|
|
||||||
return root.resolve("data/" + res.getNamespace() + "/loot_tables/blocks/" + res.getPath() + ".json");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
@ -162,12 +162,6 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
return ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, this.getAmount()), this.getInhibitedEffect());
|
return ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, this.getAmount()), this.getInhibitedEffect());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInhibitedEffect(ResourceLocation effect) {
|
|
||||||
this.removeFromPowderList();
|
|
||||||
this.dataManager.set(INHIBITED_EFFECT, effect.toString());
|
|
||||||
this.addToPowderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourceLocation getInhibitedEffect() {
|
public ResourceLocation getInhibitedEffect() {
|
||||||
String effect = this.dataManager.get(INHIBITED_EFFECT);
|
String effect = this.dataManager.get(INHIBITED_EFFECT);
|
||||||
if (effect == null || effect.isEmpty())
|
if (effect == null || effect.isEmpty())
|
||||||
|
@ -175,24 +169,30 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
return new ResourceLocation(effect);
|
return new ResourceLocation(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(int color) {
|
public void setInhibitedEffect(ResourceLocation effect) {
|
||||||
this.dataManager.set(COLOR, color);
|
this.removeFromPowderList();
|
||||||
|
this.dataManager.set(INHIBITED_EFFECT, effect.toString());
|
||||||
|
this.addToPowderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return this.dataManager.get(COLOR);
|
return this.dataManager.get(COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAmount(int amount) {
|
public void setColor(int color) {
|
||||||
this.removeFromPowderList();
|
this.dataManager.set(COLOR, color);
|
||||||
this.dataManager.set(AMOUNT, amount);
|
|
||||||
this.addToPowderList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmount() {
|
public int getAmount() {
|
||||||
return this.dataManager.get(AMOUNT);
|
return this.dataManager.get(AMOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAmount(int amount) {
|
||||||
|
this.removeFromPowderList();
|
||||||
|
this.dataManager.set(AMOUNT, amount);
|
||||||
|
this.addToPowderList();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||||
|
|
|
@ -34,8 +34,8 @@ import java.util.List;
|
||||||
public class EntityMoverMinecart extends AbstractMinecartEntity {
|
public class EntityMoverMinecart extends AbstractMinecartEntity {
|
||||||
|
|
||||||
private final List<BlockPos> spotOffsets = new ArrayList<>();
|
private final List<BlockPos> spotOffsets = new ArrayList<>();
|
||||||
private BlockPos lastPosition = BlockPos.ZERO;
|
|
||||||
public boolean isActive;
|
public boolean isActive;
|
||||||
|
private BlockPos lastPosition = BlockPos.ZERO;
|
||||||
|
|
||||||
public EntityMoverMinecart(EntityType<?> type, World world) {
|
public EntityMoverMinecart(EntityType<?> type, World world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.entities;
|
package de.ellpeck.naturesaura.entities;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraftforge.registries.ObjectHolder;
|
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("FieldNamingConvention")
|
||||||
public final class ModEntities {
|
public final class ModEntities {
|
||||||
|
|
|
@ -69,9 +69,9 @@ public class ClientEvents {
|
||||||
|
|
||||||
public static final ResourceLocation OVERLAYS = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/overlays.png");
|
public static final ResourceLocation OVERLAYS = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/overlays.png");
|
||||||
public static final ResourceLocation BOOK_GUI = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/book.png");
|
public static final ResourceLocation BOOK_GUI = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/book.png");
|
||||||
|
public static final List<PacketAuraChunk> PENDING_AURA_CHUNKS = new ArrayList<>();
|
||||||
private static final ItemStack ITEM_FRAME = new ItemStack(Items.ITEM_FRAME);
|
private static final ItemStack ITEM_FRAME = new ItemStack(Items.ITEM_FRAME);
|
||||||
private static final Map<ResourceLocation, Tuple<ItemStack, Boolean>> SHOWING_EFFECTS = new HashMap<>();
|
private static final Map<ResourceLocation, Tuple<ItemStack, Boolean>> SHOWING_EFFECTS = new HashMap<>();
|
||||||
public static final List<PacketAuraChunk> PENDING_AURA_CHUNKS = new ArrayList<>();
|
|
||||||
private static ItemStack heldCache = ItemStack.EMPTY;
|
private static ItemStack heldCache = ItemStack.EMPTY;
|
||||||
private static ItemStack heldEye = ItemStack.EMPTY;
|
private static ItemStack heldEye = ItemStack.EMPTY;
|
||||||
private static ItemStack heldOcular = ItemStack.EMPTY;
|
private static ItemStack heldOcular = ItemStack.EMPTY;
|
||||||
|
|
|
@ -57,6 +57,20 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICu
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IAuraType getType(ItemStack stack) {
|
||||||
|
if (!stack.hasTag())
|
||||||
|
return NaturesAuraAPI.TYPE_OTHER;
|
||||||
|
String type = stack.getTag().getString("stored_type");
|
||||||
|
if (type.isEmpty())
|
||||||
|
return NaturesAuraAPI.TYPE_OTHER;
|
||||||
|
return NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack setType(ItemStack stack, IAuraType type) {
|
||||||
|
stack.getOrCreateTag().putString("stored_type", type.getName().toString());
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillItemGroup(ItemGroup tab, NonNullList<ItemStack> items) {
|
public void fillItemGroup(ItemGroup tab, NonNullList<ItemStack> items) {
|
||||||
if (this.isInGroup(tab)) {
|
if (this.isInGroup(tab)) {
|
||||||
|
@ -73,20 +87,6 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICu
|
||||||
return new TranslationTextComponent(stack.getTranslationKey() + "." + getType(stack).getName());
|
return new TranslationTextComponent(stack.getTranslationKey() + "." + getType(stack).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IAuraType getType(ItemStack stack) {
|
|
||||||
if (!stack.hasTag())
|
|
||||||
return NaturesAuraAPI.TYPE_OTHER;
|
|
||||||
String type = stack.getTag().getString("stored_type");
|
|
||||||
if (type.isEmpty())
|
|
||||||
return NaturesAuraAPI.TYPE_OTHER;
|
|
||||||
return NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack setType(ItemStack stack, IAuraType type) {
|
|
||||||
stack.getOrCreateTag().putString("stored_type", type.getName().toString());
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public IItemColor getItemColor() {
|
public IItemColor getItemColor() {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.EntitySpawnPlacementRegistry;
|
import net.minecraft.entity.EntitySpawnPlacementRegistry;
|
||||||
import net.minecraft.entity.MobEntity;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
|
|
|
@ -31,16 +31,6 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I
|
||||||
(stack, worldIn, entityIn) -> getStoredColor(stack) != null ? 1F : 0F);
|
(stack, worldIn, entityIn) -> getStoredColor(stack) != null ? 1F : 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActionResultType onItemUse(ItemUseContext context) {
|
|
||||||
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
|
|
||||||
if (changeOrCopyColor(context.getPlayer(), stack, context.getWorld(), context.getPos(), null)) {
|
|
||||||
return ActionResultType.SUCCESS;
|
|
||||||
} else {
|
|
||||||
return ActionResultType.PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) {
|
private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) {
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
List<Block> blocks = ColoredBlockHelper.getBlocksContaining(block);
|
List<Block> blocks = ColoredBlockHelper.getBlocksContaining(block);
|
||||||
|
@ -81,20 +71,6 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
|
||||||
ItemStack stack = playerIn.getHeldItem(handIn);
|
|
||||||
if (playerIn.isShiftKeyDown() && getStoredColor(stack) != null) {
|
|
||||||
worldIn.playSound(playerIn, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F);
|
|
||||||
if (!worldIn.isRemote) {
|
|
||||||
setFillMode(stack, !isFillMode(stack));
|
|
||||||
}
|
|
||||||
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
|
||||||
} else {
|
|
||||||
return new ActionResult<>(ActionResultType.PASS, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DyeColor getStoredColor(ItemStack stack) {
|
private static DyeColor getStoredColor(ItemStack stack) {
|
||||||
if (!stack.hasTag()) {
|
if (!stack.hasTag()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -120,6 +96,30 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, I
|
||||||
stack.getOrCreateTag().putBoolean("fill", fill);
|
stack.getOrCreateTag().putBoolean("fill", fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
|
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
|
||||||
|
if (changeOrCopyColor(context.getPlayer(), stack, context.getWorld(), context.getPos(), null)) {
|
||||||
|
return ActionResultType.SUCCESS;
|
||||||
|
} else {
|
||||||
|
return ActionResultType.PASS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
||||||
|
ItemStack stack = playerIn.getHeldItem(handIn);
|
||||||
|
if (playerIn.isShiftKeyDown() && getStoredColor(stack) != null) {
|
||||||
|
worldIn.playSound(playerIn, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F);
|
||||||
|
if (!worldIn.isRemote) {
|
||||||
|
setFillMode(stack, !isFillMode(stack));
|
||||||
|
}
|
||||||
|
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
||||||
|
} else {
|
||||||
|
return new ActionResult<>(ActionResultType.PASS, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public IItemColor getItemColor() {
|
public IItemColor getItemColor() {
|
||||||
|
|
|
@ -24,6 +24,20 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem {
|
||||||
super("effect_powder", new Properties().group(NaturesAura.CREATIVE_TAB));
|
super("effect_powder", new Properties().group(NaturesAura.CREATIVE_TAB));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation getEffect(ItemStack stack) {
|
||||||
|
if (!stack.hasTag())
|
||||||
|
return null;
|
||||||
|
String effect = stack.getTag().getString("effect");
|
||||||
|
if (effect.isEmpty())
|
||||||
|
return null;
|
||||||
|
return new ResourceLocation(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack setEffect(ItemStack stack, ResourceLocation effect) {
|
||||||
|
stack.getOrCreateTag().putString("effect", effect.toString());
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResultType onItemUse(ItemUseContext context) {
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
World world = context.getWorld();
|
World world = context.getWorld();
|
||||||
|
@ -52,20 +66,6 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem {
|
||||||
return new TranslationTextComponent(this.getTranslationKey(stack) + "." + getEffect(stack));
|
return new TranslationTextComponent(this.getTranslationKey(stack) + "." + getEffect(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResourceLocation getEffect(ItemStack stack) {
|
|
||||||
if (!stack.hasTag())
|
|
||||||
return null;
|
|
||||||
String effect = stack.getTag().getString("effect");
|
|
||||||
if (effect.isEmpty())
|
|
||||||
return null;
|
|
||||||
return new ResourceLocation(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack setEffect(ItemStack stack, ResourceLocation effect) {
|
|
||||||
stack.getOrCreateTag().putString("effect", effect.toString());
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public IItemColor getItemColor() {
|
public IItemColor getItemColor() {
|
||||||
|
|
|
@ -4,14 +4,9 @@ import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.blocks.BlockGoldenLeaves;
|
import de.ellpeck.naturesaura.blocks.BlockGoldenLeaves;
|
||||||
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUseContext;
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem {
|
public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem {
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,20 @@ public class ItemMultiblockMaker extends ItemImpl {
|
||||||
super("multiblock_maker", new Properties().group(NaturesAura.CREATIVE_TAB));
|
super("multiblock_maker", new Properties().group(NaturesAura.CREATIVE_TAB));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int getMultiblock(ItemStack stack) {
|
||||||
|
if (!stack.hasTag())
|
||||||
|
return -1;
|
||||||
|
return stack.getTag().getInt("multiblock");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<IMultiblock> multiblocks() {
|
||||||
|
if (multiblocks == null) {
|
||||||
|
multiblocks = new ArrayList<>();
|
||||||
|
multiblocks.addAll(NaturesAuraAPI.MULTIBLOCKS.values());
|
||||||
|
}
|
||||||
|
return multiblocks;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
||||||
ItemStack stack = playerIn.getHeldItem(handIn);
|
ItemStack stack = playerIn.getHeldItem(handIn);
|
||||||
|
@ -65,18 +79,4 @@ public class ItemMultiblockMaker extends ItemImpl {
|
||||||
IMultiblock multi = multiblocks().get(id);
|
IMultiblock multi = multiblocks().get(id);
|
||||||
return multi == null ? name : name.appendText(" (" + multi.getName() + ")");
|
return multi == null ? name : name.appendText(" (" + multi.getName() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getMultiblock(ItemStack stack) {
|
|
||||||
if (!stack.hasTag())
|
|
||||||
return -1;
|
|
||||||
return stack.getTag().getInt("multiblock");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<IMultiblock> multiblocks() {
|
|
||||||
if (multiblocks == null) {
|
|
||||||
multiblocks = new ArrayList<>();
|
|
||||||
multiblocks.addAll(NaturesAuraAPI.MULTIBLOCKS.values());
|
|
||||||
}
|
|
||||||
return multiblocks;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,25 @@ public class ItemRangeVisualizer extends ItemImpl {
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clear() {
|
||||||
|
if (!VISUALIZED_BLOCKS.isEmpty())
|
||||||
|
VISUALIZED_BLOCKS.clear();
|
||||||
|
if (!VISUALIZED_ENTITIES.isEmpty())
|
||||||
|
VISUALIZED_ENTITIES.clear();
|
||||||
|
if (!VISUALIZED_RAILS.isEmpty())
|
||||||
|
VISUALIZED_RAILS.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> void visualize(PlayerEntity player, ListMultimap<DimensionType, T> map, DimensionType dim, T value) {
|
||||||
|
if (map.containsEntry(dim, value)) {
|
||||||
|
map.remove(dim, value);
|
||||||
|
player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end"), true);
|
||||||
|
} else {
|
||||||
|
map.put(dim, value);
|
||||||
|
player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.start"), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
||||||
ItemStack stack = playerIn.getHeldItem(handIn);
|
ItemStack stack = playerIn.getHeldItem(handIn);
|
||||||
|
@ -57,25 +76,6 @@ public class ItemRangeVisualizer extends ItemImpl {
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clear() {
|
|
||||||
if (!VISUALIZED_BLOCKS.isEmpty())
|
|
||||||
VISUALIZED_BLOCKS.clear();
|
|
||||||
if (!VISUALIZED_ENTITIES.isEmpty())
|
|
||||||
VISUALIZED_ENTITIES.clear();
|
|
||||||
if (!VISUALIZED_RAILS.isEmpty())
|
|
||||||
VISUALIZED_RAILS.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> void visualize(PlayerEntity player, ListMultimap<DimensionType, T> map, DimensionType dim, T value) {
|
|
||||||
if (map.containsEntry(dim, value)) {
|
|
||||||
map.remove(dim, value);
|
|
||||||
player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end"), true);
|
|
||||||
} else {
|
|
||||||
map.put(dim, value);
|
|
||||||
player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.start"), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EventHandler {
|
public class EventHandler {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -36,17 +36,6 @@ public class ItemArmor extends ArmorItem implements IModItem {
|
||||||
ModRegistry.add(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBaseName() {
|
|
||||||
return this.baseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
|
|
||||||
return Helper.makeRechargeProvider(stack, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isFullSetEquipped(LivingEntity entity, int setIndex) {
|
public static boolean isFullSetEquipped(LivingEntity entity, int setIndex) {
|
||||||
if (sets == null) {
|
if (sets == null) {
|
||||||
sets = new ArrayList<>();
|
sets = new ArrayList<>();
|
||||||
|
@ -63,6 +52,17 @@ public class ItemArmor extends ArmorItem implements IModItem {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBaseName() {
|
||||||
|
return this.baseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
|
||||||
|
return Helper.makeRechargeProvider(stack, false);
|
||||||
|
}
|
||||||
|
|
||||||
private static class EventHandler {
|
private static class EventHandler {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -29,9 +29,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class WorldData implements IWorldData {
|
public class WorldData implements IWorldData {
|
||||||
private final Map<String, ItemStackHandlerNA> enderStorages = new HashMap<>();
|
|
||||||
public final ListMultimap<ResourceLocation, Tuple<Vec3d, Integer>> effectPowders = ArrayListMultimap.create();
|
public final ListMultimap<ResourceLocation, Tuple<Vec3d, Integer>> effectPowders = ArrayListMultimap.create();
|
||||||
public final List<BlockPos> recentlyConvertedMossStones = new ArrayList<>();
|
public final List<BlockPos> recentlyConvertedMossStones = new ArrayList<>();
|
||||||
|
private final Map<String, ItemStackHandlerNA> enderStorages = new HashMap<>();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,8 +7,6 @@ import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
import net.minecraftforge.fml.network.NetworkEvent;
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
import org.apache.commons.lang3.mutable.MutableInt;
|
import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
|
|
||||||
|
@ -59,6 +57,11 @@ public class PacketAuraChunk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onMessage(PacketAuraChunk message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
ctx.get().enqueueWork(() -> ClientEvents.PENDING_AURA_CHUNKS.add(message));
|
||||||
|
ctx.get().setPacketHandled(true);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean tryHandle(World world) {
|
public boolean tryHandle(World world) {
|
||||||
Chunk chunk = world.getChunk(this.chunkX, this.chunkZ);
|
Chunk chunk = world.getChunk(this.chunkX, this.chunkZ);
|
||||||
if (chunk.isEmpty())
|
if (chunk.isEmpty())
|
||||||
|
@ -69,9 +72,4 @@ public class PacketAuraChunk {
|
||||||
auraChunk.setSpots(this.drainSpots);
|
auraChunk.setSpots(this.drainSpots);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onMessage(PacketAuraChunk message, Supplier<NetworkEvent.Context> ctx) {
|
|
||||||
ctx.get().enqueueWork(() -> ClientEvents.PENDING_AURA_CHUNKS.add(message));
|
|
||||||
ctx.get().setPacketHandled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package de.ellpeck.naturesaura.packet;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
import net.minecraftforge.fml.network.NetworkEvent;
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package de.ellpeck.naturesaura.packet;
|
package de.ellpeck.naturesaura.packet;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
|
@ -65,6 +64,20 @@ public class PacketParticles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lambda causes classloading issues on a server here
|
||||||
|
@SuppressWarnings("Convert2Lambda")
|
||||||
|
public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
ctx.get().enqueueWork(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
World world = Minecraft.getInstance().world;
|
||||||
|
if (world != null)
|
||||||
|
message.type.action.accept(message, world);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ctx.get().setPacketHandled(true);
|
||||||
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
TR_GOLD_POWDER((message, world) -> {
|
TR_GOLD_POWDER((message, world) -> {
|
||||||
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
|
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
|
||||||
|
@ -479,18 +492,4 @@ public class PacketParticles {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lambda causes classloading issues on a server here
|
|
||||||
@SuppressWarnings("Convert2Lambda")
|
|
||||||
public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) {
|
|
||||||
ctx.get().enqueueWork(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
World world = Minecraft.getInstance().world;
|
|
||||||
if (world != null)
|
|
||||||
message.type.action.accept(message, world);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ctx.get().setPacketHandled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ import java.util.function.Supplier;
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public final class ParticleHandler {
|
public final class ParticleHandler {
|
||||||
|
|
||||||
public static boolean depthEnabled = true;
|
|
||||||
public static int range = 32;
|
|
||||||
private static final List<Particle> PARTICLES = new ArrayList<>();
|
private static final List<Particle> PARTICLES = new ArrayList<>();
|
||||||
private static final List<Particle> PARTICLES_NO_DEPTH = new ArrayList<>();
|
private static final List<Particle> PARTICLES_NO_DEPTH = new ArrayList<>();
|
||||||
|
public static boolean depthEnabled = true;
|
||||||
|
public static int range = 32;
|
||||||
|
|
||||||
public static void spawnParticle(Supplier<Particle> particle, double x, double y, double z) {
|
public static void spawnParticle(Supplier<Particle> particle, double x, double y, double z) {
|
||||||
if (Minecraft.getInstance().player.getDistanceSq(x, y, z) <= range * range) {
|
if (Minecraft.getInstance().player.getDistanceSq(x, y, z) <= range * range) {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.potion;
|
package de.ellpeck.naturesaura.potion;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
|
||||||
import net.minecraft.potion.Effect;
|
import net.minecraft.potion.Effect;
|
||||||
import net.minecraftforge.registries.ObjectHolder;
|
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("FieldNamingConvention")
|
||||||
public final class ModPotions {
|
public final class ModPotions {
|
||||||
|
|
Loading…
Reference in a new issue