Added the start of the space ship entity
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
package net.halbear.supernova;
|
||||
|
||||
import net.halbear.supernova.registry.ModEntities;
|
||||
import net.halbear.supernova.registry.ModParticles;
|
||||
import net.halbear.supernova.registry.blocks.ModBlocks;
|
||||
import net.halbear.supernova.registry.blocks.ModFluids;
|
||||
import net.halbear.supernova.registry.items.ModItems;
|
||||
import net.halbear.supernova.registry.util.ModSoundEvents;
|
||||
import net.halbear.supernova.registry.worldgen.ModBiomes;
|
||||
import net.halbear.supernova.registry.worldgen.ModConfiguredFeatures;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// The value here should match an entry in the META-INF/mods.toml file
|
||||
@Mod(SuperNova.MOD_ID)
|
||||
public class SuperNova // to chef, peaceful and pal, no touchy
|
||||
{
|
||||
// string for the 'supernova' mod ID, this string will be used A LOT throughout the project to avoid retyping this variable
|
||||
public static final String MOD_ID = "supernova";
|
||||
// Directly reference a log4j logger.
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public static float DegToRad = (float)Math.PI/180.0F;
|
||||
public static float RadToDeg = 180.0F/(float)Math.PI;
|
||||
|
||||
public SuperNova() { //hal
|
||||
//creates a mod event bus
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
//register the mod elements on the mod event bus (loads them)
|
||||
ModEntities.ENTITY_TYPES.register(bus);
|
||||
ModBlocks.BLOCKS.register(bus);
|
||||
ModItems.ITEMS.register(bus);
|
||||
ModFluids.FLUIDS.register(bus);
|
||||
ModSoundEvents.SOUND_EVENTS.register(bus);
|
||||
ModBiomes.BIOMES.register(bus);
|
||||
ModParticles.PARTICLE_TYPES.register(bus);
|
||||
//ModEntities.ENTITIES.register(bus);
|
||||
//ModFeatures.FEATURES.register(bus);
|
||||
//ModSurfaceBuilders.SURFACE_BUILDERS.register(bus);
|
||||
//ModBiomes.registerBiomes();
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
||||
// Register the enqueueIMC method for modloading
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
|
||||
// Register the processIMC method for modloading
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
|
||||
// Register the doClientStuff method for modloading
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
||||
|
||||
bus.addListener(this::setup);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event) {
|
||||
event.enqueueWork(ModConfiguredFeatures::registerConfiguredFeatures);
|
||||
}
|
||||
|
||||
private void doClientStuff(final FMLClientSetupEvent event) {
|
||||
// do something that can only be done on the client
|
||||
}
|
||||
|
||||
private void enqueueIMC(final InterModEnqueueEvent event)
|
||||
{
|
||||
// some example code to dispatch IMC to another mod
|
||||
InterModComms.sendTo(SuperNova.MOD_ID, "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";});
|
||||
}
|
||||
|
||||
private void processIMC(final InterModProcessEvent event)
|
||||
{
|
||||
// some example code to receive and process InterModComms from other mods
|
||||
LOGGER.info("Got IMC {}", event.getIMCStream().
|
||||
map(m->m.getMessageSupplier().get()).
|
||||
collect(Collectors.toList()));
|
||||
}
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(FMLServerStartingEvent event) {
|
||||
// do something when the server starts
|
||||
LOGGER.info("HELLO from server starting");
|
||||
}
|
||||
|
||||
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
|
||||
// Event bus for receiving Registry Events)
|
||||
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
|
||||
public static class RegistryEvents {
|
||||
@SubscribeEvent
|
||||
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
|
||||
// register a new block here
|
||||
LOGGER.info("HELLO from Register Block");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.halbear.supernova.custom.block;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ArcFurnace extends HorizontalBlock{
|
||||
|
||||
public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
public ArcFurnace(Properties builder){
|
||||
super(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder){
|
||||
builder.add(HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context){
|
||||
return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package net.halbear.supernova.custom.block;
|
||||
|
||||
import net.halbear.supernova.registry.blocks.ModBlocks;
|
||||
import net.halbear.supernova.registry.worldgen.ModDimensions;
|
||||
import net.halbear.supernova.world.dimension.DebugTeleporter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.text.ChatType;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class DebugPortalBlock extends Block {
|
||||
public DebugPortalBlock(Properties p_i48440_1_) {
|
||||
super(p_i48440_1_);
|
||||
}
|
||||
@Override
|
||||
public ActionResultType onBlockActivated(BlockState bstate, World worldin, BlockPos blockPos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit){
|
||||
if (!worldin.isRemote){
|
||||
if (!player.isCrouching()){
|
||||
MinecraftServer server = worldin.getServer();
|
||||
if (server != null){
|
||||
if(worldin.getBlockState(blockPos.down(1).east(1)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get())&&
|
||||
worldin.getBlockState(blockPos.down(1).west(1)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get()) &&
|
||||
worldin.getBlockState(blockPos.up(1)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get()) &&
|
||||
worldin.getBlockState(blockPos.up(2)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get())) {
|
||||
DimensionSwitch(worldin, blockPos, player);
|
||||
server.getPlayerList().func_232641_a_(new StringTextComponent("dimension changed portal"), ChatType.SYSTEM, Util.DUMMY_UUID);
|
||||
return ActionResultType.SUCCESS;
|
||||
} else if (worldin.getBlockState(blockPos.down(1).north(1)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get())&&
|
||||
worldin.getBlockState(blockPos.down(1).south(1)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get()) &&
|
||||
worldin.getBlockState(blockPos.up(1)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get()) &&
|
||||
worldin.getBlockState(blockPos.up(2)).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get())) {
|
||||
DimensionSwitch(worldin, blockPos, player);
|
||||
server.getPlayerList().func_232641_a_(new StringTextComponent("dimension changed portal"), ChatType.SYSTEM, Util.DUMMY_UUID);
|
||||
return ActionResultType.SUCCESS;
|
||||
} else if(worldin.getBlockState(blockPos).matchesBlock(ModBlocks.DEBUG_PORTAL_BLOCK.get())) {
|
||||
DimensionSwitch(worldin, blockPos, player);
|
||||
server.getPlayerList().func_232641_a_(new StringTextComponent("dimension changed portal"), ChatType.SYSTEM, Util.DUMMY_UUID);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onBlockActivated(bstate, worldin, blockPos, player, handIn, hit);
|
||||
}
|
||||
private static void DimensionSwitch(World worldin, BlockPos blockPos, PlayerEntity player){
|
||||
MinecraftServer server = worldin.getServer();
|
||||
if (worldin.getDimensionKey() == ModDimensions.SPACE) {
|
||||
ServerWorld OverWorld = server.getWorld(World.OVERWORLD);
|
||||
if (OverWorld != null) {
|
||||
player.changeDimension(OverWorld, new DebugTeleporter(blockPos, true));
|
||||
}
|
||||
}
|
||||
if (worldin.getDimensionKey() != ModDimensions.SPACE) {
|
||||
ServerWorld OverWorld = server.getWorld(ModDimensions.SPACE);
|
||||
if (OverWorld != null) {
|
||||
player.changeDimension(OverWorld, new DebugTeleporter(blockPos, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.halbear.supernova.custom.block;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class HorizontalRotationalDecorBlock extends HorizontalBlock{
|
||||
|
||||
public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
public HorizontalRotationalDecorBlock(Properties builder){
|
||||
super(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder){
|
||||
builder.add(HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context){
|
||||
return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package net.halbear.supernova.custom.block;
|
||||
|
||||
import net.halbear.supernova.custom.block.blockstate_stuff.SupernovaBlockstates;
|
||||
import net.halbear.supernova.registry.blocks.ModBlocks;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.halbear.supernova.custom.block.blockstate_stuff.enums.PipeContents;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class StraightSteelPipe extends DirectionalBlock {
|
||||
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
||||
public static final BooleanProperty FLOOR_PLACEMENT = BooleanProperty.create("floor_placement");
|
||||
public static final BooleanProperty ROOF_PLACEMENT = BooleanProperty.create("roof_placement");
|
||||
public static final EnumProperty<PipeContents> PIPE_CONTENTS_EMPTY;
|
||||
public static final EnumProperty<PipeContents> PIPE_CONTENTS_OIL;
|
||||
public static final EnumProperty<PipeContents> PIPE_CONTENTS_WATER;
|
||||
public static final EnumProperty<PipeContents> PIPE_CONTENTS_LAVA;
|
||||
public static final EnumProperty<PipeContents> PIPE_CONTENTS_SALTWATER;
|
||||
public static final DirectionProperty FLOW_DIRECTION = DirectionProperty.create("flow_direction");
|
||||
|
||||
public StraightSteelPipe(AbstractBlock.Properties builder){
|
||||
super(builder);
|
||||
}
|
||||
|
||||
private static final VoxelShape NORTHBOX = Block.makeCuboidShape(4, 4, 0, 12, 12, 16);
|
||||
private static final VoxelShape WESTBOX = Block.makeCuboidShape(0, 4, 4, 16, 12, 12);
|
||||
private static final VoxelShape VERTICALBOX = Block.makeCuboidShape(4, 0, 4, 12, 16, 12);
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos position, ISelectionContext context){
|
||||
switch (state.get(FACING)){
|
||||
case NORTH:
|
||||
return NORTHBOX;
|
||||
case SOUTH:
|
||||
return NORTHBOX;
|
||||
case WEST:
|
||||
return WESTBOX;
|
||||
case EAST:
|
||||
return WESTBOX;
|
||||
case UP:
|
||||
return VERTICALBOX;
|
||||
case DOWN:
|
||||
return VERTICALBOX;
|
||||
default:
|
||||
return NORTHBOX;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder){
|
||||
builder.add(FACING, FLOOR_PLACEMENT, ROOF_PLACEMENT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
BlockPos placementPos = context.getPos();
|
||||
World world = context.getWorld();
|
||||
int PlacementX = placementPos.getX();
|
||||
int PlacementY = placementPos.getY();
|
||||
int PlacementZ = placementPos.getZ();
|
||||
Direction facing = context.getNearestLookingDirection().getOpposite();
|
||||
boolean OnGround = false;
|
||||
boolean OnRoof = false;
|
||||
if (world.getBlockState(placementPos.down()).getBlock()!=Blocks.AIR &&
|
||||
world.getBlockState(placementPos.down()).getMaterial() != Material.PLANTS &&
|
||||
!world.getBlockState(placementPos.down()).isReplaceable(context) &&
|
||||
world.getBlockState(placementPos.down()).getBlock()!=ModBlocks.STEEL_PIPE.get()
|
||||
&& facing != Direction.UP && facing != Direction.DOWN){
|
||||
OnGround = true;
|
||||
} else if(world.getBlockState(placementPos.down()).getBlockState().getMaterial() == Material.WOOD){
|
||||
OnGround = true;
|
||||
}
|
||||
if (world.getBlockState(placementPos.up()).getBlock()!=Blocks.AIR &&
|
||||
world.getBlockState(placementPos.up()).getBlock()!=ModBlocks.STEEL_PIPE.get()
|
||||
&& !OnGround && facing != Direction.UP && facing != Direction.DOWN){
|
||||
OnRoof = true;
|
||||
}
|
||||
return this.getDefaultState()
|
||||
.with(FACING, facing)
|
||||
.with(FLOOR_PLACEMENT, OnGround)
|
||||
.with(ROOF_PLACEMENT, OnRoof);
|
||||
}
|
||||
|
||||
static {
|
||||
PIPE_CONTENTS_EMPTY = SupernovaBlockstates.EMPTY_PIPE;
|
||||
PIPE_CONTENTS_OIL = SupernovaBlockstates.CRUDE_OIL_PIPE;
|
||||
PIPE_CONTENTS_LAVA = SupernovaBlockstates.LAVA_PIPE;
|
||||
PIPE_CONTENTS_SALTWATER = SupernovaBlockstates.SALT_WATER_PIPE;
|
||||
PIPE_CONTENTS_WATER = SupernovaBlockstates.WATER_PIPE;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package net.halbear.supernova.custom.block.blockstate_stuff;
|
||||
|
||||
import net.halbear.supernova.custom.block.blockstate_stuff.enums.PipeContents;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
|
||||
public class SupernovaBlockstates {
|
||||
public static final EnumProperty<PipeContents> EMPTY_PIPE;
|
||||
public static final EnumProperty<PipeContents> CRUDE_OIL_PIPE;
|
||||
public static final EnumProperty<PipeContents> WATER_PIPE;
|
||||
public static final EnumProperty<PipeContents> LAVA_PIPE;
|
||||
public static final EnumProperty<PipeContents> SALT_WATER_PIPE;
|
||||
|
||||
static {
|
||||
EMPTY_PIPE = EnumProperty.create("empty", PipeContents.class);
|
||||
CRUDE_OIL_PIPE = EnumProperty.create("crude_oil", PipeContents.class);
|
||||
WATER_PIPE = EnumProperty.create("water", PipeContents.class);
|
||||
LAVA_PIPE = EnumProperty.create("lava", PipeContents.class);
|
||||
SALT_WATER_PIPE = EnumProperty.create("salt_water", PipeContents.class);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package net.halbear.supernova.custom.block.blockstate_stuff.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum PipeContents implements IStringSerializable {
|
||||
EMPTY("empty"),
|
||||
FLOWING("flowing");
|
||||
|
||||
private final String name;
|
||||
|
||||
private PipeContents(String Name) {
|
||||
this.name = Name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.halbear.supernova.custom.fluid;
|
||||
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FlammableFluid extends FlowingFluidBlock {
|
||||
|
||||
public FlammableFluid(Supplier<? extends SupernovaFlowingFluid> supplier, Properties properties) {
|
||||
super(supplier, properties);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package net.halbear.supernova.custom.fluid;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
import net.minecraft.fluid.FlowingFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class SupernovaFlowingFluid extends FlowingFluid {
|
||||
private final Supplier<? extends Fluid> flowing;
|
||||
private final Supplier<? extends Fluid> still;
|
||||
private final FluidAttributes.Builder FluidBuilder;
|
||||
private final SupernovaFluidAttributes.SupernovaFluidBuilder ExtendedBuilder;
|
||||
@Nullable
|
||||
private final Supplier<? extends Item> bucket;
|
||||
@Nullable
|
||||
private final Supplier<? extends FlammableFluid> block;
|
||||
private final boolean canMultiply;
|
||||
private final int slopeFindDistance;
|
||||
private final int levelDecreasePerBlock;
|
||||
private final float explosionResistance;
|
||||
private final int tickRate;
|
||||
|
||||
protected SupernovaFlowingFluid(Properties properties) {
|
||||
this.FluidBuilder = properties.attributes;
|
||||
this.flowing = properties.flowing;
|
||||
this.still = properties.still;
|
||||
this.canMultiply = properties.canMultiply;
|
||||
this.bucket = properties.bucket;
|
||||
this.block = properties.block;
|
||||
this.slopeFindDistance = properties.slopeFindDistance;
|
||||
this.levelDecreasePerBlock = properties.levelDecreasePerBlock;
|
||||
this.explosionResistance = properties.explosionResistance;
|
||||
this.tickRate = properties.tickRate;
|
||||
this.ExtendedBuilder = properties.extended_attributes;
|
||||
}
|
||||
|
||||
public Fluid getFlowingFluid() {
|
||||
return (Fluid)this.flowing.get();
|
||||
}
|
||||
|
||||
public Fluid getStillFluid() {
|
||||
return (Fluid)this.still.get();
|
||||
}
|
||||
|
||||
protected boolean canSourcesMultiply() {
|
||||
return this.canMultiply;
|
||||
}
|
||||
|
||||
protected void beforeReplacingBlock(IWorld worldIn, BlockPos pos, BlockState state) {
|
||||
TileEntity tileentity = state.getBlock().hasTileEntity(state) ? worldIn.getTileEntity(pos) : null;
|
||||
Block.spawnDrops(state, worldIn, pos, tileentity);
|
||||
}
|
||||
|
||||
protected int getSlopeFindDistance(IWorldReader worldIn) {
|
||||
return this.slopeFindDistance;
|
||||
}
|
||||
|
||||
protected int getLevelDecreasePerBlock(IWorldReader worldIn) {
|
||||
return this.levelDecreasePerBlock;
|
||||
}
|
||||
|
||||
public Item getFilledBucket() {
|
||||
return this.bucket != null ? (Item)this.bucket.get() : Items.AIR;
|
||||
}
|
||||
|
||||
protected boolean canDisplace(FluidState state, IBlockReader world, BlockPos pos, Fluid fluidIn, Direction direction) {
|
||||
return direction == Direction.DOWN && !this.isEquivalentTo(fluidIn);
|
||||
}
|
||||
|
||||
public int getTickRate(IWorldReader world) {
|
||||
return this.tickRate;
|
||||
}
|
||||
|
||||
protected float getExplosionResistance() {
|
||||
return this.explosionResistance;
|
||||
}
|
||||
|
||||
protected BlockState getBlockState(FluidState state) {
|
||||
return this.block != null ? (BlockState)((FlowingFluidBlock)this.block.get()).getDefaultState().with(FlowingFluidBlock.LEVEL, getLevelFromState(state)) : Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
public boolean isEquivalentTo(Fluid fluidIn) {
|
||||
return fluidIn == this.still.get() || fluidIn == this.flowing.get();
|
||||
}
|
||||
|
||||
|
||||
protected FluidAttributes createAttributes() {
|
||||
return this.FluidBuilder.build(this);
|
||||
}
|
||||
|
||||
public static class Properties {
|
||||
private Supplier<? extends Fluid> still;
|
||||
private Supplier<? extends Fluid> flowing;
|
||||
private FluidAttributes.Builder attributes;
|
||||
private SupernovaFluidAttributes.SupernovaFluidBuilder extended_attributes;
|
||||
private boolean canMultiply;
|
||||
private Supplier<? extends Item> bucket;
|
||||
private Supplier<? extends FlammableFluid> block;
|
||||
private int slopeFindDistance = 4;
|
||||
private int levelDecreasePerBlock = 1;
|
||||
private float explosionResistance = 1.0F;
|
||||
private int tickRate = 5;
|
||||
|
||||
public Properties(Supplier<? extends Fluid> still, Supplier<? extends Fluid> flowing, FluidAttributes.Builder attributes, SupernovaFluidAttributes.SupernovaFluidBuilder extended_attributes) {
|
||||
this.still = still;
|
||||
this.flowing = flowing;
|
||||
this.attributes = attributes;
|
||||
this.extended_attributes = extended_attributes;
|
||||
}
|
||||
public SupernovaFlowingFluid.Properties canMultiply() {
|
||||
this.canMultiply = true;
|
||||
return this;
|
||||
}
|
||||
public SupernovaFlowingFluid.Properties bucket(Supplier<? extends Item> bucket) {
|
||||
this.bucket = bucket;
|
||||
return this;
|
||||
}
|
||||
public SupernovaFlowingFluid.Properties block(Supplier<? extends FlammableFluid> block) {
|
||||
this.block = block;
|
||||
return this;
|
||||
}
|
||||
public SupernovaFlowingFluid.Properties slopeFindDistance(int slopeFindDistance) {
|
||||
this.slopeFindDistance = slopeFindDistance;
|
||||
return this;
|
||||
}
|
||||
public SupernovaFlowingFluid.Properties levelDecreasePerBlock(int levelDecreasePerBlock) {
|
||||
this.levelDecreasePerBlock = levelDecreasePerBlock;
|
||||
return this;
|
||||
}
|
||||
public SupernovaFlowingFluid.Properties explosionResistance(float explosionResistance) {
|
||||
this.explosionResistance = explosionResistance;
|
||||
return this;
|
||||
}
|
||||
public SupernovaFlowingFluid.Properties tickRate(int tickRate) {
|
||||
this.tickRate = tickRate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Source extends SupernovaFlowingFluid {
|
||||
public Source(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
public int getLevel(FluidState state) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public boolean isSource(FluidState state) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Flowing extends SupernovaFlowingFluid {
|
||||
public Flowing(Properties properties) {
|
||||
super(properties);
|
||||
this.setDefaultState((FluidState)((FluidState)this.getStateContainer().getBaseState()).with(LEVEL_1_8, 7));
|
||||
}
|
||||
|
||||
protected void fillStateContainer(StateContainer.Builder<Fluid, FluidState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(new Property[]{LEVEL_1_8});
|
||||
}
|
||||
|
||||
public int getLevel(FluidState state) {
|
||||
return (Integer)state.get(LEVEL_1_8);
|
||||
}
|
||||
|
||||
public boolean isSource(FluidState state) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.halbear.supernova.custom.fluid;
|
||||
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class SupernovaFluidAttributes {
|
||||
|
||||
private final boolean flammable;
|
||||
private final boolean ExpandsGas;
|
||||
private final ResourceLocation OverlayTexture;
|
||||
|
||||
protected SupernovaFluidAttributes(SupernovaFluidBuilder ExtendedBuilder, Fluid fluid) {
|
||||
this.flammable = ExtendedBuilder.flammable;
|
||||
this.ExpandsGas = ExtendedBuilder.ExpandsGas;
|
||||
this.OverlayTexture = ExtendedBuilder.OverlayTexture;
|
||||
}
|
||||
|
||||
public static SupernovaFluidBuilder Supernovabuilder(ResourceLocation OVERLAY_TEXTURE) {
|
||||
return new SupernovaFluidBuilder(OVERLAY_TEXTURE, SupernovaFluidAttributes::new);
|
||||
}
|
||||
|
||||
public static class SupernovaFluidBuilder {
|
||||
|
||||
private ResourceLocation OverlayTexture;
|
||||
private boolean flammable;
|
||||
private boolean ExpandsGas;
|
||||
|
||||
private BiFunction<SupernovaFluidBuilder, Fluid, SupernovaFluidAttributes> factory;
|
||||
|
||||
protected SupernovaFluidBuilder(ResourceLocation OVERLAY_TEXTURE, BiFunction<SupernovaFluidBuilder, Fluid, SupernovaFluidAttributes> factory) {
|
||||
this.factory = factory;
|
||||
this.OverlayTexture = OVERLAY_TEXTURE;
|
||||
}
|
||||
|
||||
public final SupernovaFluidBuilder Flammable() {
|
||||
this.flammable = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final SupernovaFluidBuilder GasExpands() {
|
||||
this.ExpandsGas = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package net.halbear.supernova.custom.fluid;
|
||||
|
||||
public class SupernovaOverlayRenderer {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.halbear.supernova.data;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = SuperNova.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class DataGenerators {
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
package net.halbear.supernova.entity;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.IPacket;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class Spaceship extends Entity {
|
||||
private static final DataParameter<Float> ORIENTATION_ROLL = EntityDataManager.createKey(Spaceship.class, DataSerializers.FLOAT);
|
||||
private static final DataParameter<Float> ORIENTATION_YAW = EntityDataManager.createKey(Spaceship.class, DataSerializers.FLOAT);
|
||||
private static final DataParameter<Float> ORIENTATION_PITCH = EntityDataManager.createKey(Spaceship.class, DataSerializers.FLOAT);
|
||||
|
||||
private static final Vector3d[] VehicleSeatOffsets = new Vector3d[]{
|
||||
new Vector3d(0.0D, 3D, 0.0D),
|
||||
new Vector3d(0.0D, 1.5D, 0.0D),
|
||||
};
|
||||
|
||||
public Spaceship(EntityType<? extends Spaceship> type, World worldIn) {
|
||||
super(type, worldIn);
|
||||
}
|
||||
|
||||
public void SetVehicleRoll(float value){
|
||||
this.dataManager.set(ORIENTATION_ROLL, value);
|
||||
}
|
||||
public void SetVehicleYaw(float value){
|
||||
this.dataManager.set(ORIENTATION_YAW, value);
|
||||
}
|
||||
public void SetVehiclePitch(float value){
|
||||
this.dataManager.set(ORIENTATION_PITCH, value);
|
||||
}
|
||||
public float GetVehicleRoll(){
|
||||
return this.dataManager.get(ORIENTATION_ROLL);
|
||||
}
|
||||
public float GetVehicleYaw(){
|
||||
return this.dataManager.get(ORIENTATION_YAW);
|
||||
}
|
||||
public float GetVehiclePitch(){
|
||||
return this.dataManager.get(ORIENTATION_PITCH);
|
||||
}
|
||||
public float[] GetVehicleRotations(){
|
||||
return new float[]{GetVehicleYaw(),GetVehiclePitch(),GetVehicleRoll()};
|
||||
}
|
||||
public void SetVehicleRotations(float Yaw, float Pitch, float Roll){
|
||||
SetVehicleRoll(Roll);
|
||||
SetVehicleYaw(Yaw);
|
||||
SetVehiclePitch(Pitch);
|
||||
}
|
||||
@Override
|
||||
public boolean canBeCollidedWith(){return true;}
|
||||
|
||||
@Override
|
||||
protected boolean canFitPassenger(Entity passenger) {
|
||||
return this.getPassengers().size() < VehicleSeatOffsets.length;
|
||||
}
|
||||
@Override
|
||||
public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) {
|
||||
if (this.getPassengers().size() < VehicleSeatOffsets.length && !player.isPassenger()) {
|
||||
if (!this.world.isRemote()) {
|
||||
return player.startRiding(this) ? ActionResultType.CONSUME : ActionResultType.PASS;
|
||||
}
|
||||
return ActionResultType.func_233537_a_(this.world.isRemote());
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getControllingPassenger() {
|
||||
return this.getPassengers().isEmpty() ? null : this.getPassengers().get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePassenger(Entity passenger) {
|
||||
if (this.isPassenger(passenger)) {
|
||||
int seatIndex = this.getPassengers().indexOf(passenger);
|
||||
|
||||
if (seatIndex >= 0 && seatIndex < VehicleSeatOffsets.length) {
|
||||
Vector3d localOffset = VehicleSeatOffsets[seatIndex];
|
||||
Vector3d rotatedOffset = localOffset.rotateYaw((float) Math.toRadians(-this.rotationYaw));
|
||||
passenger.setPosition(
|
||||
this.getPosX() + rotatedOffset.x,
|
||||
this.getPosY() + rotatedOffset.y + passenger.getMountedYOffset(),
|
||||
this.getPosZ() + rotatedOffset.z
|
||||
);
|
||||
} else {
|
||||
super.updatePassenger(passenger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerData() {
|
||||
this.dataManager.register(ORIENTATION_ROLL, 0F);
|
||||
this.dataManager.register(ORIENTATION_PITCH, 0F);
|
||||
this.dataManager.register(ORIENTATION_YAW, 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readAdditional(CompoundNBT compoundNBT) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeAdditional(CompoundNBT compoundNBT) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IPacket<?> createSpawnPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package net.halbear.supernova.loot_modifiers;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.LootContext;
|
||||
import net.minecraft.loot.conditions.ILootCondition;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
|
||||
import net.minecraftforge.common.loot.LootModifier;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class ModReplaceLootDrop extends LootModifier {
|
||||
private final Item addition;
|
||||
protected ModReplaceLootDrop(ILootCondition[] conditionsIn, Item addition) {
|
||||
super(conditionsIn);
|
||||
this.addition = addition;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext lootContext) {
|
||||
generatedLoot.clear(); // clears the drop that was going to drop
|
||||
generatedLoot.add(new ItemStack(addition)); // adds new drop to the drop
|
||||
return generatedLoot;
|
||||
}
|
||||
|
||||
public static class Serializer extends GlobalLootModifierSerializer<ModReplaceLootDrop>{
|
||||
@Override
|
||||
public ModReplaceLootDrop read(ResourceLocation name, JsonObject object, ILootCondition[] conditionsIn) {
|
||||
Item addition = ForgeRegistries.ITEMS.getValue(
|
||||
new ResourceLocation(JSONUtils.getString(object, "addition")));
|
||||
return new ModReplaceLootDrop(conditionsIn, addition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject write(ModReplaceLootDrop instance) {
|
||||
JsonObject json = makeConditions(instance.conditions);
|
||||
json.addProperty("addition", ForgeRegistries.ITEMS.getKey(instance.addition).toString());
|
||||
return json;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.halbear.supernova.mixin;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.settings.PointOfView;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static net.halbear.supernova.vehicle.VehicleCameraSetup.GetCameraOffsets;
|
||||
|
||||
@Mixin(ActiveRenderInfo.class)
|
||||
public abstract class CameraMixin {
|
||||
@Inject(method = {"update", "func_216772_a"}, at = @At(value = "TAIL"),cancellable = true, remap = true)
|
||||
private void update(IBlockReader currentRenderedLevel, Entity entity, boolean isDetached, boolean isMirrored, float partialTicks, CallbackInfo ci){
|
||||
|
||||
if(entity.isPassenger() && Minecraft.getInstance().gameSettings.getPointOfView() != PointOfView.FIRST_PERSON && entity.getRidingEntity().getType().getRegistryName().getNamespace().equals(SuperNova.MOD_ID)){
|
||||
Vector3f Position = GetCameraOffsets();
|
||||
this.movePosition(-this.calcCameraDistance(Position.getZ()), Position.getY(), Position.getX());
|
||||
}
|
||||
}
|
||||
@Shadow(aliases = {"move", "func_216782_a"})
|
||||
protected abstract void movePosition(double p_216782_1_, double p_216782_3_, double p_216782_5_);
|
||||
@Shadow(aliases = {"getMaxZoom", "func_216779_a"}) protected abstract double calcCameraDistance(double p_216779_1_);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package net.halbear.supernova.registry;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.IArmorMaterial;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum ModArmourMaterial implements IArmorMaterial {;
|
||||
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
|
||||
private final String name;
|
||||
private final int maxDamageFactor;
|
||||
private final int[] damageReductionAmountArray;
|
||||
private final int enchantability;
|
||||
private final SoundEvent soundEvent;
|
||||
private final float toughness;
|
||||
private final float knockbackResistance;
|
||||
private final LazyValue<Ingredient> repairMaterial;
|
||||
|
||||
private ModArmourMaterial(String name, int maxDmg, int[] maxDmgReductArr, int enchantability, SoundEvent soundEvent, float toughness, float KnbckResistance, Supplier repairMat) {
|
||||
this.name = name;
|
||||
this.maxDamageFactor = maxDmg;
|
||||
this.damageReductionAmountArray = maxDmgReductArr;
|
||||
this.enchantability = enchantability;
|
||||
this.soundEvent = soundEvent;
|
||||
this.toughness = toughness;
|
||||
this.knockbackResistance = KnbckResistance;
|
||||
this.repairMaterial = new LazyValue(repairMat);
|
||||
}
|
||||
|
||||
public int getDurability(EquipmentSlotType equipSlotType) {
|
||||
return MAX_DAMAGE_ARRAY[equipSlotType.getIndex()] * this.maxDamageFactor;
|
||||
}
|
||||
|
||||
public int getDamageReductionAmount(EquipmentSlotType equipSlotType) {
|
||||
return this.damageReductionAmountArray[equipSlotType.getIndex()];
|
||||
}
|
||||
|
||||
public int getEnchantability() {
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
public SoundEvent getSoundEvent() {
|
||||
return this.soundEvent;
|
||||
}
|
||||
|
||||
public Ingredient getRepairMaterial() {
|
||||
return (Ingredient)this.repairMaterial.getValue();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public String getName() {
|
||||
return SuperNova.MOD_ID + ":" + this.name;
|
||||
}
|
||||
|
||||
public float getToughness() {
|
||||
return this.toughness;
|
||||
}
|
||||
|
||||
public float getKnockbackResistance() {
|
||||
return this.knockbackResistance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.halbear.supernova.registry;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.halbear.supernova.entity.Spaceship;
|
||||
import net.minecraft.entity.EntityClassification;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ModEntities {
|
||||
public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, SuperNova.MOD_ID);
|
||||
|
||||
public static final RegistryObject<EntityType<Spaceship>> SPACESHIP =
|
||||
ENTITY_TYPES.register("spaceship", ()-> EntityType.Builder.create(Spaceship::new,
|
||||
EntityClassification.MISC ).size(3f,8f).build(new ResourceLocation(SuperNova.MOD_ID, "spaceship").toString()));
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.halbear.supernova.registry;
|
||||
|
||||
import net.halbear.supernova.*;
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.halbear.supernova.loot_modifiers.ModReplaceLootDrop;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
@Mod.EventBusSubscriber(modid = SuperNova.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) //hal
|
||||
public class ModEventBusEvents {
|
||||
@SubscribeEvent
|
||||
public static void registerModifiderSerializers(@Nonnull final RegistryEvent.Register<GlobalLootModifierSerializer<?>>event){ //hal
|
||||
event.getRegistry().registerAll(
|
||||
new ModReplaceLootDrop.Serializer().setRegistryName(
|
||||
new ResourceLocation(SuperNova.MOD_ID,"silica_from_sand")), //hal
|
||||
new ModReplaceLootDrop.Serializer().setRegistryName(
|
||||
new ResourceLocation(SuperNova.MOD_ID,"silica_powder_from_quartz_block")), //hal
|
||||
new ModReplaceLootDrop.Serializer().setRegistryName(
|
||||
new ResourceLocation(SuperNova.MOD_ID,"silica_powder_from_smooth_quartz")) //hal
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.halbear.supernova.registry;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ModParticles {
|
||||
public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, SuperNova.MOD_ID);
|
||||
|
||||
//public static final RegistryObject<BasicParticleType> STAR_SPARKLE = PARTICLE_TYPES.register("star_sparkle", () -> new BasicParticleType(false));
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package net.halbear.supernova.registry.blocks;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
|
||||
import net.halbear.supernova.custom.block.ArcFurnace;
|
||||
import net.halbear.supernova.custom.block.DebugPortalBlock;
|
||||
import net.halbear.supernova.custom.block.StraightSteelPipe;
|
||||
import net.halbear.supernova.registry.items.ModItems;
|
||||
import net.halbear.supernova.registry.items.ItemGroups;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModBlocks { //hal
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, SuperNova.MOD_ID);
|
||||
//the blocks will appear in inventory as in order of declaration here, please keep all block types grouped together
|
||||
//such as group ores together, group organic materials together, keep it relatively organised in both the registry AND the en_us.json - hal
|
||||
|
||||
//REMEMBER TO PUT REGISTERED ITEMS AND BLOCKS IN THE EN_US.JSON, an example would be ""block.supernova.bauxite_ore": "Bauxite Ore","
|
||||
|
||||
//Overworld
|
||||
//ores
|
||||
public static final RegistryObject<Block> BAUXITE_ORE = //hal
|
||||
registerBlock("bauxite_ore", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.ROCK)
|
||||
.sound(SoundType.STONE)
|
||||
.hardnessAndResistance(3.0f, 3.0f)
|
||||
.harvestLevel(2)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.setRequiresTool()
|
||||
)
|
||||
);
|
||||
|
||||
public static final RegistryObject<Block> RUTILE_ORE = //hal & pal
|
||||
registerBlock("rutile_ore", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.ROCK)
|
||||
.sound(SoundType.STONE)
|
||||
.hardnessAndResistance(3.0f, 3.0f)
|
||||
.harvestLevel(3)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.setRequiresTool()
|
||||
)//pal: tf is a harvest level? hal: pickaxe level required to get drops, 1 is stone, 2 is iron etc...
|
||||
);
|
||||
|
||||
public static final RegistryObject<Block> COPPER_ORE = //hal & pal
|
||||
registerBlock("copper_ore", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.ROCK)
|
||||
.sound(SoundType.STONE)
|
||||
.hardnessAndResistance(3.0f, 3.0f)
|
||||
.harvestLevel(1)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.setRequiresTool()
|
||||
)
|
||||
);
|
||||
public static final RegistryObject<Block> ANATASE_ORE = //hal & pal
|
||||
registerBlock("anatase_ore", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.ROCK)
|
||||
.sound(SoundType.STONE)
|
||||
.hardnessAndResistance(3.0f, 3.0f)
|
||||
.harvestLevel(3)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.setRequiresTool()
|
||||
)
|
||||
);
|
||||
|
||||
// Block of x
|
||||
public static final RegistryObject<Block> BAUXITE_BLOCK = //hal
|
||||
registerBlock("bauxite_block", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.ROCK)
|
||||
.sound(SoundType.STONE)
|
||||
.hardnessAndResistance(2.0f, 1.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
)
|
||||
);
|
||||
|
||||
public static final RegistryObject<Block> RUTILE_CHUNK_BLOCK = //hal
|
||||
registerBlock("rutile_chunk_block", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.GLASS)
|
||||
.sound(SoundType.METAL)
|
||||
.hardnessAndResistance(2.0f, 1.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
)
|
||||
);
|
||||
public static final RegistryObject<Block> ANATASE_BLOCK = //hal
|
||||
registerBlock("anatase_block", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.GLASS)
|
||||
.sound(SoundType.METAL)
|
||||
.hardnessAndResistance(2.0f, 1.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
)
|
||||
);
|
||||
public static final RegistryObject<Block> RAW_COPPER_BLOCK = //hal
|
||||
registerBlock("raw_copper_block", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.IRON)
|
||||
.sound(SoundType.METAL)
|
||||
.hardnessAndResistance(2.0f, 1.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
)
|
||||
);
|
||||
public static final RegistryObject<Block> COPPER_BLOCK = //hal
|
||||
registerBlock("copper_block", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.IRON)
|
||||
.sound(SoundType.METAL)
|
||||
.hardnessAndResistance(2.0f, 1.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
)
|
||||
);
|
||||
public static final RegistryObject<Block> CHISLED_COPPER_BLOCK = //hal
|
||||
registerBlock("chisled_copper_block", () -> new Block(AbstractBlock.Properties
|
||||
.create(Material.IRON)
|
||||
.sound(SoundType.METAL)
|
||||
.hardnessAndResistance(2.0f, 1.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
)
|
||||
);
|
||||
|
||||
//Technology
|
||||
public static final RegistryObject<Block> ARC_FURNACE = //hal & pal
|
||||
registerBlock("arc_furnace", () -> new ArcFurnace(AbstractBlock.Properties
|
||||
.create(Material.IRON)
|
||||
.hardnessAndResistance(3.0f,3.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.METAL)
|
||||
)
|
||||
);
|
||||
|
||||
public static final RegistryObject<Block> DEBUG_PORTAL_BLOCK = //hal & pal
|
||||
registerBlock("debug_portal_block", () -> new DebugPortalBlock(AbstractBlock.Properties
|
||||
.create(Material.IRON)
|
||||
.hardnessAndResistance(1.0f,1.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.METAL)
|
||||
)
|
||||
);
|
||||
|
||||
public static final RegistryObject<Block> STEEL_PIPE = //hal
|
||||
registerBlock("steel_pipe", () -> new StraightSteelPipe(AbstractBlock.Properties
|
||||
.create(Material.IRON)
|
||||
.hardnessAndResistance(3.0f,3.0f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.sound(SoundType.METAL)
|
||||
.setRequiresTool()
|
||||
.notSolid()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block){ //hal
|
||||
RegistryObject<T> toReturn = ModBlocks.BLOCKS.register(name, block);
|
||||
registerBlockItem(name, toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) { //hal
|
||||
ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
||||
new Item.Properties().group(ItemGroups.SUPERNOVA_BLOCKS_TAB)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package net.halbear.supernova.registry.blocks;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.halbear.supernova.custom.fluid.FlammableFluid;
|
||||
import net.halbear.supernova.custom.fluid.SupernovaFlowingFluid;
|
||||
import net.halbear.supernova.custom.fluid.SupernovaFluidAttributes;
|
||||
import net.halbear.supernova.registry.items.ModItems;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.fluid.FlowingFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ModFluids {
|
||||
public static final ResourceLocation WATER_STILL_RL = new ResourceLocation("block/water_still");
|
||||
public static final ResourceLocation WATER_FLOW_RL = new ResourceLocation("block/water_flow");
|
||||
public static final ResourceLocation WATER_OVERLAY_RL = new ResourceLocation("block/water_overlay");
|
||||
public static final ResourceLocation CRUDE_OIL_STILL_RL = new ResourceLocation("supernova:block/crude_oil_still");
|
||||
public static final ResourceLocation CRUDE_OIL_FLOW_RL = new ResourceLocation("supernova:block/crude_oil_flowing");
|
||||
public static final ResourceLocation CRUDE_OIL_OVERLAY_RL = new ResourceLocation("supernova:block/crude_oil_overlay");
|
||||
public static final ResourceLocation REFINED_OIL_STILL_RL = new ResourceLocation("supernova:block/refined_oil_still");
|
||||
public static final ResourceLocation REFINED_OIL_FLOW_RL = new ResourceLocation("supernova:block/refined_oil_flowing");
|
||||
public static final ResourceLocation REFINED_OIL_OVERLAY_RL = new ResourceLocation("supernova:block/refined_oil_overlay");
|
||||
public static final ResourceLocation KEROSENE_STILL_RL = new ResourceLocation("supernova:block/kerosene_still");
|
||||
public static final ResourceLocation KEROSENE_FLOW_RL = new ResourceLocation("supernova:block/kerosene_flowing");
|
||||
|
||||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, SuperNova.MOD_ID);
|
||||
|
||||
//salt water
|
||||
public static final RegistryObject<FlowingFluid> SALT_WATER_FLUID = FLUIDS.register("salt_water_fluid",
|
||||
() -> new ForgeFlowingFluid.Source(ModFluids.SALT_WATER_PROPERTIES));
|
||||
public static final RegistryObject<FlowingFluid> SALT_WATER_FLOWING = FLUIDS.register("salt_water_flowing",
|
||||
() -> new ForgeFlowingFluid.Flowing(ModFluids.SALT_WATER_PROPERTIES));
|
||||
|
||||
public static final ForgeFlowingFluid.Properties SALT_WATER_PROPERTIES = new ForgeFlowingFluid.Properties(
|
||||
() -> SALT_WATER_FLUID.get(), () -> SALT_WATER_FLOWING.get(), FluidAttributes.builder(WATER_STILL_RL, WATER_FLOW_RL)
|
||||
.density(15).viscosity(5).sound(SoundEvents.BLOCK_WATER_AMBIENT).overlay(WATER_OVERLAY_RL).color(0xff45ADF2)).slopeFindDistance(5).levelDecreasePerBlock(1).canMultiply()
|
||||
.block(() -> ModFluids.SALT_WATER_BLOCK.get()).bucket(() -> ModItems.SALT_WATER_BUCKET.get());
|
||||
|
||||
public static final RegistryObject<FlowingFluidBlock> SALT_WATER_BLOCK = ModBlocks.BLOCKS.register("salt_water",
|
||||
() -> new FlowingFluidBlock(() -> ModFluids.SALT_WATER_FLUID.get(), AbstractBlock.Properties.create(Material.WATER)
|
||||
.doesNotBlockMovement().hardnessAndResistance(100f).noDrops()));
|
||||
|
||||
//Oil
|
||||
public static final RegistryObject<SupernovaFlowingFluid> CRUDE_OIL_FLUID = FLUIDS.register("crude_oil_fluid",
|
||||
() -> new SupernovaFlowingFluid.Source(ModFluids.CRUDE_OIL_PROPERTIES));
|
||||
public static final RegistryObject<SupernovaFlowingFluid> CRUDE_OIL_FLOWING = FLUIDS.register("crude_oil_flowing",
|
||||
() -> new SupernovaFlowingFluid.Flowing(ModFluids.CRUDE_OIL_PROPERTIES));
|
||||
|
||||
public static final SupernovaFlowingFluid.Properties CRUDE_OIL_PROPERTIES = new SupernovaFlowingFluid.Properties(
|
||||
() -> CRUDE_OIL_FLUID.get(), () -> CRUDE_OIL_FLOWING.get(), FluidAttributes.builder(CRUDE_OIL_STILL_RL, CRUDE_OIL_FLOW_RL)
|
||||
.density(30).viscosity(30).sound(SoundEvents.BLOCK_HONEY_BLOCK_SLIDE).overlay(CRUDE_OIL_OVERLAY_RL).color(0x00FFFFFF),
|
||||
SupernovaFluidAttributes.Supernovabuilder(CRUDE_OIL_OVERLAY_RL).Flammable()).tickRate(7).slopeFindDistance(4).levelDecreasePerBlock(2)
|
||||
.block(() -> ModFluids.CRUDE_OIL_BLOCK.get()).bucket(() -> ModItems.CRUDE_OIL_BUCKET.get());
|
||||
|
||||
public static final RegistryObject<FlammableFluid> CRUDE_OIL_BLOCK = ModBlocks.BLOCKS.register("crude_oil",
|
||||
() -> new FlammableFluid(() -> ModFluids.CRUDE_OIL_FLUID.get(), AbstractBlock.Properties.create(Material.WATER).tickRandomly()
|
||||
.doesNotBlockMovement().hardnessAndResistance(100f).noDrops()));
|
||||
|
||||
|
||||
public static final RegistryObject<SupernovaFlowingFluid> REFINED_OIL_FLUID = FLUIDS.register("refined_oil_fluid",
|
||||
() -> new SupernovaFlowingFluid.Source(ModFluids.REFINED_OIL_PROPERTIES));
|
||||
public static final RegistryObject<SupernovaFlowingFluid> REFINED_OIL_FLOWING = FLUIDS.register("refined_oil_flowing",
|
||||
() -> new SupernovaFlowingFluid.Flowing(ModFluids.REFINED_OIL_PROPERTIES));
|
||||
|
||||
public static final SupernovaFlowingFluid.Properties REFINED_OIL_PROPERTIES = new SupernovaFlowingFluid.Properties(
|
||||
() -> REFINED_OIL_FLUID.get(), () -> REFINED_OIL_FLOWING.get(), FluidAttributes.builder(REFINED_OIL_STILL_RL, REFINED_OIL_FLOW_RL)
|
||||
.density(30).viscosity(30).sound(SoundEvents.ITEM_BOTTLE_FILL).overlay(REFINED_OIL_OVERLAY_RL).color(0x00FFFFFF),
|
||||
SupernovaFluidAttributes.Supernovabuilder(CRUDE_OIL_OVERLAY_RL).Flammable()).tickRate(20).slopeFindDistance(4).levelDecreasePerBlock(2)
|
||||
.block(() -> ModFluids.REFINED_OIL_BLOCK.get()).bucket(() -> ModItems.REFINED_OIL_BUCKET.get());
|
||||
|
||||
public static final RegistryObject<FlammableFluid> REFINED_OIL_BLOCK = ModBlocks.BLOCKS.register("refined_oil",
|
||||
() -> new FlammableFluid(() -> ModFluids.REFINED_OIL_FLUID.get(), AbstractBlock.Properties.create(Material.WATER).tickRandomly()
|
||||
.doesNotBlockMovement().hardnessAndResistance(100f).noDrops()));
|
||||
|
||||
//Kerosene
|
||||
public static final RegistryObject<SupernovaFlowingFluid> KEROSENE_FLUID = FLUIDS.register("kerosene_fluid",
|
||||
() -> new SupernovaFlowingFluid.Source(ModFluids.KEROSENE_PROPERTIES));
|
||||
public static final RegistryObject<SupernovaFlowingFluid> KEROSENE_FLOWING = FLUIDS.register("kerosene_flowing",
|
||||
() -> new SupernovaFlowingFluid.Flowing(ModFluids.KEROSENE_PROPERTIES));
|
||||
|
||||
public static final SupernovaFlowingFluid.Properties KEROSENE_PROPERTIES = new SupernovaFlowingFluid.Properties(
|
||||
() -> KEROSENE_FLUID.get(), () -> KEROSENE_FLOWING.get(), FluidAttributes.builder(KEROSENE_STILL_RL, KEROSENE_FLOW_RL)
|
||||
.density(30).viscosity(10).sound(SoundEvents.ITEM_BOTTLE_FILL).overlay(REFINED_OIL_OVERLAY_RL).color(0xeeFFFFFF),
|
||||
SupernovaFluidAttributes.Supernovabuilder(CRUDE_OIL_OVERLAY_RL).Flammable()).tickRate(6).slopeFindDistance(5).levelDecreasePerBlock(1)
|
||||
.block(() -> ModFluids.KEROSENE_BLOCK.get()).bucket(() -> ModItems.KEROSENE_BUCKET.get());
|
||||
|
||||
public static final RegistryObject<FlammableFluid> KEROSENE_BLOCK = ModBlocks.BLOCKS.register("kerosene",
|
||||
() -> new FlammableFluid(() -> ModFluids.KEROSENE_FLUID.get(), AbstractBlock.Properties.create(Material.WATER).tickRandomly()
|
||||
.doesNotBlockMovement().hardnessAndResistance(100f).noDrops()));
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.halbear.supernova.registry.items;
|
||||
|
||||
import net.halbear.supernova.registry.blocks.ModBlocks;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemGroups {
|
||||
|
||||
public static final ItemGroup SUPERNOVA_BLOCKS_TAB = new ItemGroup("supernovaBlocksModTab") {
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
return new ItemStack(ModBlocks.ARC_FURNACE.get());
|
||||
}
|
||||
};
|
||||
public static final ItemGroup SUPERNOVA_ITEMS_TAB = new ItemGroup("supernovaItemsModTab") {
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
return new ItemStack(ModItems.BAUXITE_CHUNK.get());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package net.halbear.supernova.registry.items;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.halbear.supernova.registry.blocks.ModFluids;
|
||||
import net.halbear.supernova.registry.util.ModSoundEvents;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ModItems {
|
||||
|
||||
public static final DeferredRegister<Item> ITEMS = // hal
|
||||
DeferredRegister.create(ForgeRegistries.ITEMS, SuperNova.MOD_ID);
|
||||
|
||||
//the items will appear in inventory as in order of declaration here, please keep all item types grouped together
|
||||
//such as group ores together, group crystal+powdered forms together, keep it relatively organised in both the registry AND the en_us.json - hal
|
||||
|
||||
//REMEMBER TO PUT REGISTERED ITEMS AND BLOCKS IN THE EN_US.JSON, an example would be ""block.supernova.bauxite_ore": "Bauxite Ore","
|
||||
//ores
|
||||
public static final RegistryObject<Item> BAUXITE_CHUNK = ITEMS.register("bauxite_chunk", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)){
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (Screen.hasShiftDown()){
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.bauxite_tooltip"));
|
||||
} else{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.tooltip_prompt"));
|
||||
}
|
||||
}});
|
||||
|
||||
public static final RegistryObject<Item> RUTILE_CHUNK = ITEMS.register("rutile_chunk", // pal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)){
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (Screen.hasShiftDown()){
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.rutile_tooltip"));
|
||||
} else{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.tooltip_prompt"));
|
||||
}
|
||||
}});
|
||||
|
||||
public static final RegistryObject<Item> COPPER_CHUNK = ITEMS.register("copper_chunk", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)){
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (Screen.hasShiftDown()){
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.copperchunk_tooltip"));
|
||||
} else{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.tooltip_prompt"));
|
||||
}
|
||||
}});
|
||||
|
||||
public static final RegistryObject<Item> ANATASE_CHUNK = ITEMS.register("anatase_chunk", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)){
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (Screen.hasShiftDown()){
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.anatasechunk_tooltip"));
|
||||
} else{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.tooltip_prompt"));
|
||||
}
|
||||
}});
|
||||
|
||||
//crystals
|
||||
public static final RegistryObject<Item> SILICA_CRYSTAL = ITEMS.register("silica_crystal", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)){
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (Screen.hasShiftDown()){
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.silicachunk_tooltip"));
|
||||
} else{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.tooltip_prompt"));
|
||||
}
|
||||
}});
|
||||
|
||||
public static final RegistryObject<Item> SILICA_POWDER = ITEMS.register("silica_powder", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)){
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
if (Screen.hasShiftDown()){
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.silicapowder_tooltip"));
|
||||
} else{
|
||||
tooltip.add(new TranslationTextComponent("tooltip.supernova.tooltip_prompt"));
|
||||
}
|
||||
}});
|
||||
|
||||
//ingots & alloys
|
||||
public static final RegistryObject<Item> COPPER_INGOT = ITEMS.register("copper_ingot", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
public static final RegistryObject<Item> ALUMINIUM_INGOT = ITEMS.register("aluminium_ingot", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
public static final RegistryObject<Item> TITANIUM_INGOT = ITEMS.register("titanium_ingot", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
public static final RegistryObject<Item> STEEL_INGOT = ITEMS.register("steel_ingot", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
|
||||
//whatever carborundum is
|
||||
public static final RegistryObject<Item> CARBORUNDUM = ITEMS.register("carborundum", // hal
|
||||
() -> new Item(new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
|
||||
//buckets
|
||||
public static final RegistryObject<Item> SALT_WATER_BUCKET = ITEMS.register("salt_water_bucket",()-> new BucketItem(()-> ModFluids.SALT_WATER_FLUID.get(),
|
||||
new Item.Properties().maxStackSize(1).group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
public static final RegistryObject<Item> CRUDE_OIL_BUCKET = ITEMS.register("crude_oil_bucket",()-> new BucketItem(()-> ModFluids.CRUDE_OIL_FLUID.get(),
|
||||
new Item.Properties().maxStackSize(1).group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
public static final RegistryObject<Item> REFINED_OIL_BUCKET = ITEMS.register("refined_oil_bucket",()-> new BucketItem(()-> ModFluids.REFINED_OIL_FLUID.get(),
|
||||
new Item.Properties().maxStackSize(1).group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
public static final RegistryObject<Item> KEROSENE_BUCKET = ITEMS.register("kerosene_bucket",()-> new BucketItem(()-> ModFluids.KEROSENE_FLUID.get(),
|
||||
new Item.Properties().maxStackSize(1).group(ItemGroups.SUPERNOVA_ITEMS_TAB)));
|
||||
|
||||
//music disks
|
||||
public static final RegistryObject<Item> ASTRAL_NIGHTMARE = ITEMS.register("astral_nightmare_md",
|
||||
()-> new MusicDiscItem(1, () -> ModSoundEvents.ASTRAL_NIGHTMARE.get(),
|
||||
new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB).maxStackSize(1)));
|
||||
public static final RegistryObject<Item> NEW_WORLD_MD = ITEMS.register("new_world_md",
|
||||
()-> new MusicDiscItem(1, () -> ModSoundEvents.NEW_WORLD.get(),
|
||||
new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB).maxStackSize(1)));
|
||||
public static final RegistryObject<Item> NEBULA_MD = ITEMS.register("nebula_md",
|
||||
()-> new MusicDiscItem(1, () -> ModSoundEvents.NEBULA.get(),
|
||||
new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB).maxStackSize(1)));
|
||||
public static final RegistryObject<Item> STARDUST_MOUNTAIN_MD = ITEMS.register("stardust_mountain_md",
|
||||
()-> new MusicDiscItem(1, () -> ModSoundEvents.STARDUST_MOUNTAIN.get(),
|
||||
new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB).maxStackSize(1)));
|
||||
public static final RegistryObject<Item> FISSURE_IN_SPACE_MD = ITEMS.register("fissure_in_space_md",
|
||||
()-> new MusicDiscItem(1, () -> ModSoundEvents.FISSURE_IN_SPACE.get(),
|
||||
new Item.Properties().group(ItemGroups.SUPERNOVA_ITEMS_TAB).maxStackSize(1)));
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package net.halbear.supernova.registry.util;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
//import dev.halbear1.supernova.custom.particle.StarSparkle;
|
||||
import net.halbear.supernova.entity.EntityRenderers.SpaceshipRenderer;
|
||||
import net.halbear.supernova.entity.Spaceship;
|
||||
import net.halbear.supernova.registry.ModEntities;
|
||||
import net.halbear.supernova.registry.blocks.ModBlocks;
|
||||
import net.halbear.supernova.registry.blocks.ModFluids;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.entity.MobRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = SuperNova.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public class ClientEventHandler {
|
||||
|
||||
@SafeVarargs
|
||||
public static void SetCollectionRenderType(RenderType type, RegistryObject<Block>... blocks_list) { //hal
|
||||
for (RegistryObject<Block> blockRegistryObject : blocks_list) {
|
||||
RenderTypeLookup.setRenderLayer(blockRegistryObject.get(), type);
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void init(final FMLClientSetupEvent event) { // block render types, examples for paladin and chef to see
|
||||
// pal: drying up your code
|
||||
SetCollectionRenderType(RenderType.getSolid(), // Cutout: Texture pixels with a transparency element are discarded, fastest method, prevents re-ordering at render.
|
||||
ModBlocks.ARC_FURNACE
|
||||
//blocks here
|
||||
);
|
||||
SetCollectionRenderType(RenderType.getCutout(), // Cutout: Texture pixels with a transparency element are discarded, fastest method, prevents re-ordering at render.
|
||||
ModBlocks.BAUXITE_ORE, //hal
|
||||
ModBlocks.RUTILE_ORE, // pal: rutile, generator
|
||||
ModBlocks.COPPER_ORE,
|
||||
ModBlocks.ANATASE_ORE,
|
||||
ModBlocks.STEEL_PIPE
|
||||
//blocks here
|
||||
);
|
||||
RenderTypeLookup.setRenderLayer(ModFluids.SALT_WATER_FLUID.get(), RenderType.getTranslucent());
|
||||
RenderTypeLookup.setRenderLayer(ModFluids.SALT_WATER_FLOWING.get(), RenderType.getTranslucent());
|
||||
RenderTypeLookup.setRenderLayer(ModFluids.SALT_WATER_BLOCK.get(), RenderType.getTranslucent());
|
||||
RenderTypeLookup.setRenderLayer(ModFluids.KEROSENE_FLUID.get(), RenderType.getTranslucent());
|
||||
RenderTypeLookup.setRenderLayer(ModFluids.KEROSENE_FLOWING.get(), RenderType.getTranslucent());
|
||||
RenderTypeLookup.setRenderLayer(ModFluids.KEROSENE_BLOCK.get(), RenderType.getTranslucent());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(ModEntities.SPACESHIP.get(), SpaceshipRenderer::new);
|
||||
/*SetCollectionRenderType(RenderType.getCutoutMipped(), // Cutout Mipped: Cutout but with mipmapping. Textures from far away are simplified for performance.
|
||||
//blocks here
|
||||
);
|
||||
|
||||
|
||||
SetCollectionRenderType(RenderType.getTranslucent(), // Translucent: Texture pixels with a transparency element are mixed, slowest method.
|
||||
//blocks here
|
||||
);*/
|
||||
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public static void registerFactory(final ParticleFactoryRegisterEvent event){
|
||||
//register particles here, an example would be:
|
||||
//Minecraft.GetInstance().particleEngine.register(ModParticleTypes.ExampleParticle.get(), ExampleParticle.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(ModParticles.STAR_SPARKLE.get(), StarSparkle.Factory::new);
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package net.halbear.supernova.registry.util;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ModSoundEvents {
|
||||
public static final DeferredRegister<SoundEvent> SOUND_EVENTS =
|
||||
DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, SuperNova.MOD_ID);
|
||||
//Game Sounds
|
||||
|
||||
//Entity Sounds
|
||||
|
||||
//Music Disks
|
||||
public static final RegistryObject<SoundEvent> NEW_WORLD = registerSoundEvent("new_world");
|
||||
public static final RegistryObject<SoundEvent> NEBULA = registerSoundEvent("nebula");
|
||||
public static final RegistryObject<SoundEvent> STARDUST_MOUNTAIN = registerSoundEvent("stardust_mountain");
|
||||
public static final RegistryObject<SoundEvent> ASTRAL_NIGHTMARE = registerSoundEvent("astral_nightmare");
|
||||
public static final RegistryObject<SoundEvent> FISSURE_IN_SPACE = registerSoundEvent("fissure_in_space");
|
||||
|
||||
public static RegistryObject<SoundEvent> registerSoundEvent(String name){
|
||||
return SOUND_EVENTS.register(name, () -> new SoundEvent(new ResourceLocation(SuperNova.MOD_ID, name)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package net.halbear.supernova.registry.util;
|
||||
import net.halbear.supernova.SuperNova;
|
||||
|
||||
import net.halbear.supernova.registry.blocks.ModFluids;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = SuperNova.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
|
||||
|
||||
public class ServerEventHandler {
|
||||
|
||||
//SPACE STUFF
|
||||
//if you can't tell what these do by the function names... bro.. cmon
|
||||
@SubscribeEvent
|
||||
public static void FogDistance(EntityViewRenderEvent.FogDensity FogDensity) {
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
double eyeHeight = player.getPosYEye() - 1 / 9d;
|
||||
FluidState fluid = player.world.getFluidState(new BlockPos(player.getPosX(), eyeHeight, player.getPosZ()));
|
||||
if (fluid.getFluid() == ModFluids.CRUDE_OIL_FLUID.get() || fluid.getFluid() == ModFluids.CRUDE_OIL_FLOWING.get()) {
|
||||
FogDensity.setDensity(1000f);
|
||||
}
|
||||
if (fluid.getFluid() == ModFluids.REFINED_OIL_FLUID.get() || fluid.getFluid() == ModFluids.REFINED_OIL_FLOWING.get()) {
|
||||
FogDensity.setDensity(1000f);
|
||||
}
|
||||
if (fluid.getFluid() == ModFluids.KEROSENE_FLUID.get() || fluid.getFluid() == ModFluids.KEROSENE_FLOWING.get()) {
|
||||
FogDensity.setDensity(10f);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void OilFog(EntityViewRenderEvent.FogColors FogColor) {
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
double eyeHeight = player.getPosYEye() - 1 / 9d;
|
||||
FluidState fluid = player.world.getFluidState(new BlockPos(player.getPosX(), eyeHeight, player.getPosZ()));
|
||||
if (fluid.getFluid() == ModFluids.CRUDE_OIL_FLUID.get() || fluid.getFluid() == ModFluids.CRUDE_OIL_FLOWING.get()) {
|
||||
FogColor.setBlue(0);
|
||||
FogColor.setGreen(0);
|
||||
FogColor.setRed(0);
|
||||
}
|
||||
if (fluid.getFluid() == ModFluids.REFINED_OIL_FLUID.get() || fluid.getFluid() == ModFluids.REFINED_OIL_FLOWING.get()) {
|
||||
FogColor.setBlue(35);
|
||||
FogColor.setGreen(0);
|
||||
FogColor.setRed(5);
|
||||
}
|
||||
if (fluid.getFluid() == ModFluids.KEROSENE_FLUID.get() || fluid.getFluid() == ModFluids.KEROSENE_FLOWING.get()) {
|
||||
FogColor.setBlue(230);
|
||||
FogColor.setGreen(190);
|
||||
FogColor.setRed(0);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void PlayerGravityCheck(PlayerEvent.PlayerChangedDimensionEvent event) {
|
||||
Entity player = event.getPlayer();
|
||||
if (event.getFrom() == RegistryKey.getOrCreateKey(Registry.WORLD_KEY, new ResourceLocation("supernova:space"))) {
|
||||
player.setNoGravity(false);
|
||||
}
|
||||
if (event.getTo() == RegistryKey.getOrCreateKey(Registry.WORLD_KEY, new ResourceLocation("supernova:space"))) {
|
||||
player.setNoGravity(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void ChunkGravityCheck(EntityEvent.EnteringChunk chunkEvent){
|
||||
Entity entity = chunkEvent.getEntity();
|
||||
World world = entity.world;
|
||||
Biome entityBiome = world.getBiome(entity.getPosition());
|
||||
if (Objects.equals(entityBiome.getRegistryName(), new ResourceLocation("supernova:space")) && !entity.hasNoGravity()){
|
||||
entity.setNoGravity(true);
|
||||
} else if (!Objects.equals(entityBiome.getRegistryName(), new ResourceLocation("supernova:space")) && entity.hasNoGravity()) {
|
||||
entity.setNoGravity(false);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void EntityGravityCheck(LivingSpawnEvent SpawnEvent){
|
||||
Entity entity = SpawnEvent.getEntity();
|
||||
World world = entity.world;
|
||||
Biome entityBiome = world.getBiome(entity.getPosition());
|
||||
if (Objects.equals(entityBiome.getRegistryName(), new ResourceLocation("supernova:space")) && !entity.hasNoGravity()){
|
||||
entity.setNoGravity(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package net.halbear.supernova.registry.worldgen;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeMaker;
|
||||
import net.minecraftforge.common.BiomeManager;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModBiomes {
|
||||
public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, SuperNova.MOD_ID);
|
||||
|
||||
static {
|
||||
//space
|
||||
createBiome("space", BiomeMaker::makeVoidBiome);
|
||||
}
|
||||
|
||||
public static final RegistryKey<Biome> SPACE = registerBiome("space");
|
||||
|
||||
public static RegistryKey<Biome> registerBiome(String name) {
|
||||
return RegistryKey.getOrCreateKey(Registry.BIOME_KEY, new ResourceLocation(SuperNova.MOD_ID, name));
|
||||
}
|
||||
|
||||
public static RegistryObject<Biome> createBiome(String name, Supplier<Biome> biome) {
|
||||
return BIOMES.register(name, biome);
|
||||
}
|
||||
|
||||
public static void registerBiomes() {
|
||||
BiomeManager.addBiome(BiomeManager.BiomeType.WARM, new BiomeManager.BiomeEntry(SPACE, 1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package net.halbear.supernova.registry.worldgen;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.halbear.supernova.registry.blocks.ModBlocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.WorldGenRegistries;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
|
||||
public class ModConfiguredFeatures { //hal & pal
|
||||
//pal: 'bauxite' not 'baxuite'
|
||||
public static final ConfiguredFeature<?,?> BAUXITE_ORE_GEN = Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD, ModBlocks.BAUXITE_ORE.get().getDefaultState(), 8)).range(40).square().count(12);
|
||||
public static final ConfiguredFeature<?,?> RUTILE_ORE_GEN = Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD, ModBlocks.RUTILE_ORE.get().getDefaultState(), 6)).range(25).square().count(7);
|
||||
public static final ConfiguredFeature<?,?> COPPER_ORE_GEN = Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD, ModBlocks.COPPER_ORE.get().getDefaultState(), 12)).range(225).square().count(24);
|
||||
public static final ConfiguredFeature<?,?> ANATASE_ORE_GEN = Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD, ModBlocks.ANATASE_ORE.get().getDefaultState(), 5)).range(25).square().count(5);
|
||||
|
||||
private static <FC extends IFeatureConfig> ConfiguredFeature<FC,?> register(String name, ConfiguredFeature<FC,?> feature){ //hal
|
||||
return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation(SuperNova.MOD_ID, name), feature);
|
||||
}
|
||||
|
||||
public static void registerConfiguredFeatures() { //hal & pal
|
||||
register("bauxite_ore_gen",BAUXITE_ORE_GEN);
|
||||
register("rutile_ore_gen",RUTILE_ORE_GEN);
|
||||
register("copper_ore_gen",COPPER_ORE_GEN);
|
||||
register("anatase_ore_gen",ANATASE_ORE_GEN);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.halbear.supernova.registry.worldgen;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.text.ChatType;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
public class ModDimensions {
|
||||
public static RegistryKey<World> SPACE = RegistryKey.getOrCreateKey(Registry.WORLD_KEY, new ResourceLocation(SuperNova.MOD_ID, "space"){
|
||||
@SubscribeEvent
|
||||
public void onPlayerChangedDimensionEvent(PlayerEvent.PlayerChangedDimensionEvent dimension) {
|
||||
PlayerEntity player = dimension.getPlayer();
|
||||
MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
||||
if (server != null){
|
||||
server.getPlayerList().func_232641_a_(new StringTextComponent("dimension change registry"), ChatType.SYSTEM, Util.DUMMY_UUID);
|
||||
}
|
||||
if (dimension.getFrom() == ModDimensions.SPACE) {
|
||||
player.setNoGravity(false);
|
||||
}
|
||||
if (dimension.getTo() == ModDimensions.SPACE) {
|
||||
player.setNoGravity(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package net.halbear.supernova.registry.worldgen;
|
||||
|
||||
public class ModFeatures {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package net.halbear.supernova.registry.worldgen;
|
||||
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ModSurfaceBuilders {
|
||||
public static final DeferredRegister<SurfaceBuilder<?>> SURFACE_BUILDERS = DeferredRegister.create(ForgeRegistries.SURFACE_BUILDERS, SuperNova.MOD_ID);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.halbear.supernova.setup;
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.halbear.supernova.registry.worldgen.ModConfiguredFeatures;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = SuperNova.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
|
||||
public class CommonEventHandler {
|
||||
|
||||
@SubscribeEvent //hal & pal
|
||||
public static void biomeModification(BiomeLoadingEvent event) { // this will add features such as ore to the overworld
|
||||
event.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES).add(() -> ModConfiguredFeatures.BAUXITE_ORE_GEN);
|
||||
event.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES).add(() -> ModConfiguredFeatures.RUTILE_ORE_GEN);
|
||||
event.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES).add(() -> ModConfiguredFeatures.COPPER_ORE_GEN);
|
||||
event.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES).add(() -> ModConfiguredFeatures.ANATASE_ORE_GEN);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package net.halbear.supernova.setup;
|
||||
import net.halbear.supernova.SuperNova;
|
||||
import net.halbear.supernova.entity.Spaceship;
|
||||
import net.halbear.supernova.registry.ModEntities;
|
||||
import net.halbear.supernova.registry.worldgen.ModConfiguredFeatures;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = SuperNova.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class ModEventHandler {
|
||||
@SubscribeEvent
|
||||
public static void addEntityAttributes(EntityAttributeCreationEvent event){
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterEntities(RegistryEvent.Register<EntityType<?>> event){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package net.halbear.supernova.vehicle;
|
||||
|
||||
import net.halbear.supernova.*;
|
||||
import net.halbear.supernova.entity.Spaceship;
|
||||
import net.halbear.supernova.registry.ModEntities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class VehicleCameraSetup {
|
||||
private static Vector3f CamOffset = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
private static Vector3f CamTransformations = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
private static float CamFOV = 0.0f;
|
||||
private static float CamFOVExternal = 0.0f;
|
||||
private static String CurrentEntity = "";
|
||||
private static boolean SupernovaVehicle = false;
|
||||
public static Vector3f GetCameraOffsets(){
|
||||
return CamOffset;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void PlayerTickEvent(TickEvent.PlayerTickEvent event) {
|
||||
|
||||
Minecraft minecraftInstance = Minecraft.getInstance();
|
||||
if (minecraftInstance.player != null && minecraftInstance.player.isPassenger() && minecraftInstance.player.getRidingEntity() != null
|
||||
&& CurrentEntity != minecraftInstance.player.getRidingEntity().getType().getRegistryName().toString()) {
|
||||
CurrentEntity = minecraftInstance.player.getRidingEntity().getType().getRegistryName().toString();
|
||||
SupernovaVehicle = minecraftInstance.player.getRidingEntity().getType().getRegistryName().getNamespace().equals(SuperNova.MOD_ID);
|
||||
if (CurrentEntity.equals(ModEntities.SPACESHIP.get().getRegistryName().toString())) {
|
||||
CamOffset = new Vector3f(0.0f, -0.75f, 6.5f);
|
||||
CamTransformations = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
CamFOV = 70.0f;
|
||||
CamFOVExternal = 60.0f;
|
||||
}
|
||||
}
|
||||
if (minecraftInstance.player != null && (!minecraftInstance.player.isPassenger() || !SupernovaVehicle)
|
||||
&& (CamFOVExternal != (float) Minecraft.getInstance().gameSettings.fov
|
||||
|| CamFOV != (float) Minecraft.getInstance().gameSettings.fov || CamOffset.getX() != 0 || CamOffset.getY() != 0
|
||||
|| CamOffset.getZ() != 0 || CamTransformations.getX() != 0 || CamTransformations.getY() != 0
|
||||
|| CamTransformations.getZ() != 0)) {
|
||||
CamOffset = new Vector3f(0.0f, 0.0f, 0.0f);// reset if the players not riding an entity and if any the values aren't 0
|
||||
CamTransformations = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
CamFOV = (float) Minecraft.getInstance().gameSettings.fov;
|
||||
CamFOVExternal = (float) Minecraft.getInstance().gameSettings.fov;
|
||||
if (!minecraftInstance.player.isPassenger())
|
||||
CurrentEntity = "";
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onCameraSetup(EntityViewRenderEvent.CameraSetup event) {
|
||||
if (SupernovaVehicle) {
|
||||
event.setRoll(event.getRoll() + CamTransformations.getX());
|
||||
event.setYaw(event.getYaw() + CamTransformations.getY());
|
||||
event.setPitch(event.getPitch() + CamTransformations.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package net.halbear.supernova.world.dimension;
|
||||
|
||||
import net.halbear.supernova.custom.block.ArcFurnace;
|
||||
import net.halbear.supernova.registry.blocks.ModBlocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.util.ITeleporter;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class DebugTeleporter implements ITeleporter {
|
||||
public static BlockPos CurPos = BlockPos.ZERO;
|
||||
public static boolean insideDimension = false;
|
||||
|
||||
public DebugTeleporter(BlockPos position, boolean insideDimensionBool){
|
||||
CurPos = position;
|
||||
insideDimension = insideDimensionBool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld DestinationWorld, float yaw, Function<Boolean, Entity> repositionEntity){
|
||||
entity = repositionEntity.apply(false);
|
||||
double y = 61;
|
||||
if (!insideDimension){
|
||||
y = CurPos.getY();
|
||||
}
|
||||
BlockPos DestinationPos = new BlockPos(CurPos.getX(), y, CurPos.getZ());
|
||||
int tries = 0;
|
||||
while ((DestinationWorld.getBlockState(DestinationPos).getMaterial()!= Material.AIR) && !DestinationWorld.getBlockState(DestinationPos).isReplaceable(Fluids.WATER) && DestinationWorld.getBlockState(DestinationPos.up()).getMaterial() != Material.AIR && !DestinationWorld.getBlockState(DestinationPos.up()).isReplaceable(Fluids.WATER) && tries < 25) {
|
||||
DestinationPos = DestinationPos.up(2);
|
||||
tries++;
|
||||
}
|
||||
entity.setPositionAndUpdate(DestinationPos.getX(),DestinationPos.getY(),DestinationPos.getZ());
|
||||
|
||||
if (insideDimension){
|
||||
boolean doSetBlock = true;
|
||||
for (BlockPos positionCheck : BlockPos.getAllInBoxMutable(DestinationPos.down(10).west(10), DestinationPos.up(10).east(10))){
|
||||
if (DestinationWorld.getBlockState(positionCheck).getBlock()instanceof ArcFurnace){
|
||||
doSetBlock = false;
|
||||
break;
|
||||
}
|
||||
if (doSetBlock) {
|
||||
DestinationWorld.setBlockState(DestinationPos.down(), ModBlocks.DEBUG_PORTAL_BLOCK.get().getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package net.halbear.supernova.world.gen.ores;
|
||||
|
||||
public class OreInCave {
|
||||
}
|
||||
Reference in New Issue
Block a user