Skip to content

Commit

Permalink
Update Netherite Space Suit Code
Browse files Browse the repository at this point in the history
Update Netherite Space Suit Code
  • Loading branch information
MrScautHD committed Dec 4, 2021
1 parent 97f9dc7 commit 950a439
Show file tree
Hide file tree
Showing 66 changed files with 516 additions and 346 deletions.
15 changes: 9 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ buildscript {
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
/*
repositories {
maven {
name = "Progwml6 maven"
Expand All @@ -24,6 +25,7 @@ repositories {
url = "https://www.cursemaven.com"
}
}
*/
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'org.spongepowered.mixin'
Expand All @@ -32,11 +34,11 @@ version = '1.0'
group = 'com.yourname.modid'
archivesBaseName = 'modid'

java.toolchain.languageVersion = JavaLanguageVersion.of(8)
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
mappings channel: 'snapshot', version: '20201028-1.16.3'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
mappings channel: 'official', version: '1.18'
//accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

runs {
client {
Expand Down Expand Up @@ -70,13 +72,13 @@ minecraft {
}

dependencies {
minecraft 'net.minecraftforge:forge:1.16.5-36.2.0'
minecraft 'net.minecraftforge:forge:1.18-38.0.14'

//Mixin
if (System.getProperty("idea.sync.active") != "true") {
annotationProcessor 'org.spongepowered:mixin:0.8.2:processor'
}

/*
//JEI
compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.1.137:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.1.137")
Expand All @@ -96,6 +98,7 @@ dependencies {
runtimeOnly fg.deobf("mekanism:Mekanism:1.16.5-10.0.20.447:additions")
runtimeOnly fg.deobf("mekanism:Mekanism:1.16.5-10.0.20.447:generators")
runtimeOnly fg.deobf("mekanism:Mekanism:1.16.5-10.0.20.447:tools")
*/
}

mixin {
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx10G
org.gradle.daemon=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 6 additions & 7 deletions src/main/java/net/mrscauthd/boss_tools/BossToolsMod.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package net.mrscauthd.boss_tools;

import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.network.NetworkEvent;
import net.minecraftforge.network.NetworkRegistry;
import net.minecraftforge.network.simple.SimpleChannel;
import net.mrscauthd.boss_tools.compat.CompatibleManager;
import net.mrscauthd.boss_tools.gui.screens.planetselection.PlanetSelectionGui;
import net.mrscauthd.boss_tools.keybind.KeyBindings;
Expand All @@ -14,17 +19,11 @@
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

import net.minecraftforge.fml.network.simple.SimpleChannel;
import net.minecraftforge.fml.network.NetworkEvent;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.common.MinecraftForge;

import net.minecraft.util.ResourceLocation;
import net.minecraft.network.PacketBuffer;

import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;
Expand Down Expand Up @@ -102,7 +101,7 @@ private void enqueueIMC(final InterModEnqueueEvent event) {
private void processIMC(final InterModProcessEvent event) {
}

public static <T> void addNetworkMessage(Class<T> messageType, BiConsumer<T, PacketBuffer> encoder, Function<PacketBuffer, T> decoder, BiConsumer<T, Supplier<NetworkEvent.Context>> messageConsumer) {
public static <T> void addNetworkMessage(Class<T> messageType, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<NetworkEvent.Context>> messageConsumer) {
PACKET_HANDLER.registerMessage(messageID, messageType, encoder, decoder, messageConsumer);
messageID++;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/mrscauthd/boss_tools/ModInnet.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.WorldGenRegistries;
import net.minecraft.world.World;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.FlatChunkGenerator;
import net.minecraft.world.gen.GenerationStage;
Expand All @@ -31,13 +33,15 @@
import net.minecraft.world.gen.surfacebuilders.ISurfaceBuilderConfig;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig;
import net.minecraft.world.item.Item;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.registries.*;
import net.mrscauthd.boss_tools.armor.SpaceSuit;
import net.mrscauthd.boss_tools.block.*;
import net.mrscauthd.boss_tools.capability.CapabilityOxygen;
Expand Down Expand Up @@ -83,10 +87,6 @@
import net.mrscauthd.boss_tools.feature.VenusDeltas;
import net.mrscauthd.boss_tools.entity.alien.AlienEntity;

import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.RegistryBuilder;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.DeferredWorkQueue;
Expand Down
190 changes: 124 additions & 66 deletions src/main/java/net/mrscauthd/boss_tools/armor/NetheriteSpaceSuit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
package net.mrscauthd.boss_tools.armor;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraftforge.client.IItemRenderProperties;
import net.mrscauthd.boss_tools.BossToolsMod;
import net.mrscauthd.boss_tools.armormaterial.SpaceSuitNetheriteArmorMaterial;
import net.mrscauthd.boss_tools.entity.renderer.spacesuit.SpaceSuitModel;
Expand All @@ -13,115 +28,158 @@
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.api.distmarker.Dist;
import org.jetbrains.annotations.Nullable;

import net.minecraft.world.World;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.item.ArmorItem;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.client.renderer.entity.model.BipedModel;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

public class NetheriteSpaceSuit {

public static ArmorItem NETHERITE_OXYGEN_MASK = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlotType.HEAD, new Item.Properties().group(BossToolsItemGroups.tab_normal).isImmuneToFire()) {
public static ArmorItem NETHERITE_OXYGEN_MASK = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlot.HEAD, new Item.Properties().tab(BossToolsItemGroups.tab_normal).fireResistant()) {

@Override
@OnlyIn(Dist.CLIENT)
public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
BipedModel armorModel = new BipedModel(1);
armorModel.bipedHead = new SpaceSuitModel.SPACE_SUIT_P1().Head;
armorModel.isSneak = living.isSneaking();
armorModel.isSitting = defaultModel.isSitting;
armorModel.isChild = living.isChild();
return armorModel;
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(new IItemRenderProperties() {

@Override
@OnlyIn(Dist.CLIENT)
public HumanoidModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) {

Map map = Map.of("head", new SpaceSuitModel.SPACE_SUIT_P1(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P1.LAYER_LOCATION)).Head);
ModelPart modelPart = new ModelPart(Collections.emptyList(), map);

HumanoidModel armorModel = new HumanoidModel(modelPart);

armorModel.crouching = living.isCrouching();
armorModel.riding = defaultModel.riding;
armorModel.young = living.isBaby();

return armorModel;
}
});
}

@Override
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return BossToolsMod.ModId + ":textures/models/armor/netherite_space_suit_head.png";
}

};

public static ArmorItem NETHERITE_SPACE_SUIT = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlotType.CHEST, new Item.Properties().group(BossToolsItemGroups.tab_normal).isImmuneToFire()) {
public static ArmorItem NETHERITE_SPACE_SUIT = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlot.CHEST, new Item.Properties().tab(BossToolsItemGroups.tab_normal).fireResistant()) {
@Override
@OnlyIn(Dist.CLIENT)
public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
BipedModel armorModel = new BipedModel(1);
armorModel.bipedBody = new SpaceSuitModel.SPACE_SUIT_P1().Body;
armorModel.bipedLeftArm = new SpaceSuitModel.SPACE_SUIT_P1().ArmLeft;
armorModel.bipedRightArm = new SpaceSuitModel.SPACE_SUIT_P1().ArmRight;
armorModel.isSneak = living.isSneaking();
armorModel.isSitting = defaultModel.isSitting;
armorModel.isChild = living.isChild();
return armorModel;
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(new IItemRenderProperties() {

@Override
@OnlyIn(Dist.CLIENT)
public HumanoidModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) {

Map map = Map.of(
"body", new SpaceSuitModel.SPACE_SUIT_P1(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P1.LAYER_LOCATION)).Body,
"left_arm", new SpaceSuitModel.SPACE_SUIT_P1(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P1.LAYER_LOCATION)).Left_Arm,
"right_arm", new SpaceSuitModel.SPACE_SUIT_P1(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P1.LAYER_LOCATION)).Right_Arm);

ModelPart modelPart = new ModelPart(Collections.emptyList(), map);

HumanoidModel armorModel = new HumanoidModel(modelPart);

armorModel.crouching = living.isCrouching();
armorModel.riding = defaultModel.riding;
armorModel.young = living.isBaby();

return armorModel;
}
});
}

@Override
public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) {
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
return new SpaceSuitCapabilityProvider(stack, 48000);
}

@Override
public void addInformation(ItemStack itemstack, World world, List<ITextComponent> list, ITooltipFlag flag) {
super.addInformation(itemstack, world, list, flag);
IOxygenStorage oxygenStorage = OxygenUtil.getItemStackOxygenStorage(itemstack);
list.add(GaugeTextHelper.buildSpacesuitOxygenTooltip(oxygenStorage));
public void appendHoverText(ItemStack p_41421_, @Nullable net.minecraft.world.level.Level p_41422_, List<Component> p_41423_, TooltipFlag p_41424_) {
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_);
IOxygenStorage oxygenStorage = OxygenUtil.getItemStackOxygenStorage(p_41421_);
p_41423_.add(GaugeTextHelper.buildSpacesuitOxygenTooltip(oxygenStorage));
}

@Override
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
@OnlyIn(Dist.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return BossToolsMod.ModId + ":textures/models/armor/netherite_space_suit.png";
}

private double OXYGEN_TIMER = 0;

@Override
public void onArmorTick(ItemStack itemstack, World world, PlayerEntity player) {
Methodes.extractArmorOxygenUsingTimer(itemstack, player);
public void onArmorTick(ItemStack stack, Level world, Player player) {
Methodes.extractArmorOxygenUsingTimer(stack, player);
}
};

public static ArmorItem NETHERITE_SPACE_PANTS = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlotType.LEGS, new Item.Properties().group(BossToolsItemGroups.tab_normal).isImmuneToFire()) {
public static ArmorItem NETHERITE_SPACE_PANTS = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlot.LEGS, new Item.Properties().tab(BossToolsItemGroups.tab_normal).fireResistant()) {
@Override
@OnlyIn(Dist.CLIENT)
public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
BipedModel armorModel = new BipedModel(1);
armorModel.bipedLeftLeg = new SpaceSuitModel.SPACE_SUIT_P2().LegLeft;
armorModel.bipedRightLeg = new SpaceSuitModel.SPACE_SUIT_P2().LegRight;
armorModel.isSneak = living.isSneaking();
armorModel.isSitting = defaultModel.isSitting;
armorModel.isChild = living.isChild();
return armorModel;
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(new IItemRenderProperties() {

@Override
@OnlyIn(Dist.CLIENT)
public HumanoidModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) {

Map map = Map.of(
"left_leg", new SpaceSuitModel.SPACE_SUIT_P2(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P2.LAYER_LOCATION)).Left_Leg,
"right_leg", new SpaceSuitModel.SPACE_SUIT_P2(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P2.LAYER_LOCATION)).Right_Leg);

ModelPart modelPart = new ModelPart(Collections.emptyList(), map);

HumanoidModel armorModel = new HumanoidModel(modelPart);

armorModel.crouching = living.isCrouching();
armorModel.riding = defaultModel.riding;
armorModel.young = living.isBaby();

return armorModel;
}
});
}

@Override
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
@OnlyIn(Dist.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return BossToolsMod.ModId + ":textures/models/armor/netherite_space_suit_legs.png";
}
};

public static ArmorItem NETHERITE_SPACE_BOOTS = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlotType.FEET, new Item.Properties().group(BossToolsItemGroups.tab_normal).isImmuneToFire()) {
public static ArmorItem NETHERITE_SPACE_BOOTS = new ArmorItem(SpaceSuitNetheriteArmorMaterial.ARMOR_MATERIAL, EquipmentSlot.FEET, new Item.Properties().tab(BossToolsItemGroups.tab_normal).fireResistant()) {
@Override
@OnlyIn(Dist.CLIENT)
public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
BipedModel armorModel = new BipedModel(1);
armorModel.bipedLeftLeg = new SpaceSuitModel.SPACE_SUIT_P1().FootLeft;
armorModel.bipedRightLeg = new SpaceSuitModel.SPACE_SUIT_P1().FootRight;
armorModel.isSneak = living.isSneaking();
armorModel.isSitting = defaultModel.isSitting;
armorModel.isChild = living.isChild();
return armorModel;
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(new IItemRenderProperties() {

@Override
@OnlyIn(Dist.CLIENT)
public HumanoidModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) {

Map map = Map.of(
"left_leg", new SpaceSuitModel.SPACE_SUIT_P1(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P1.LAYER_LOCATION)).Left_Foot,
"right_leg", new SpaceSuitModel.SPACE_SUIT_P1(Minecraft.getInstance().getEntityModels().bakeLayer(SpaceSuitModel.SPACE_SUIT_P1.LAYER_LOCATION)).Right_Foot);

ModelPart modelPart = new ModelPart(Collections.emptyList(), map);

HumanoidModel armorModel = new HumanoidModel(modelPart);

armorModel.crouching = living.isCrouching();
armorModel.riding = defaultModel.riding;
armorModel.young = living.isBaby();

return armorModel;
}
});
}

@Override
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return BossToolsMod.ModId + ":textures/models/armor/netherite_space_suit.png";
}
};
Expand Down
Loading

0 comments on commit 950a439

Please sign in to comment.