Added the start of the space ship entity

This commit is contained in:
Halbear
2026-05-17 00:47:05 +01:00
parent 0c28cdb9f2
commit 28816a0385
47 changed files with 1600 additions and 178 deletions
@@ -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);
}