forked from GL33P-0R4NG3/oreganized
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
330 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package galena.galenacapes; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.List; | ||
|
||
public class Constants { | ||
|
||
/* | ||
@author: Xaidee | ||
Remember to update this list frequently! | ||
For the most recent version of this file please refer to https://github.com/Xaidee/Galena-Capes/blob/1.18/Common/src/main/java/galena/galenacapes/Constants.java | ||
*/ | ||
|
||
public static final String MOD_ID = "galenacapes"; | ||
public static final String MOD_NAME = "Galena Capes"; | ||
public static final Logger LOG = LoggerFactory.getLogger(MOD_NAME); | ||
|
||
// List of usernames apart of Team Galena | ||
public static final List<String> Dev = List.of( | ||
"Dev" | ||
); | ||
/// Patreon member capes | ||
public static final List<String> OPatreons = List.of( // Oreganized Cape | ||
"Xaidee", | ||
"Bi_nome", | ||
"keviikk" | ||
); | ||
public static final List<String> OFPatreons = List.of( // Overweight Farming Cape | ||
|
||
); | ||
public static final List<String> GPatreonsBlue = List.of( // Blue Galosphere Cape | ||
|
||
); | ||
public static final List<String> GPatreonsYellow = List.of( // Yellow Galosphere Cape | ||
|
||
); | ||
public static final List<String> CPatreons = List.of( // Cooperative Cape | ||
"Axeceros" | ||
); | ||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/galena/galenacapes/mixin/AbstractClientPlayerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package galena.galenacapes.mixin; | ||
|
||
import galena.galenacapes.Constants; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.multiplayer.PlayerInfo; | ||
import net.minecraft.client.player.AbstractClientPlayer; | ||
import net.minecraft.resources.ResourceLocation; | ||
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.CallbackInfoReturnable; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.Objects; | ||
|
||
@Mixin(AbstractClientPlayer.class) | ||
public abstract class AbstractClientPlayerMixin { | ||
|
||
/* | ||
@author: Xaidee | ||
For the most recent version of this file please refer to https://github.com/Xaidee/Galena-Capes/blob/1.18/Common/src/main/java/galena/galenacapes/mixin/AbstractClientPlayerMixin.java | ||
*/ | ||
|
||
@Shadow @Nullable | ||
protected abstract PlayerInfo getPlayerInfo(); | ||
|
||
@Inject(method= "getCloakTextureLocation()Lnet/minecraft/resources/ResourceLocation;", at=@At("RETURN"), cancellable = true) | ||
|
||
public void getCloakTextureLocation(CallbackInfoReturnable<ResourceLocation> cir) { | ||
assert Minecraft.getInstance().player != null; | ||
if(!(Objects.requireNonNull(this.getPlayerInfo()).getProfile().getId().equals(Minecraft.getInstance().player.getUUID()))) { | ||
cir.setReturnValue(null); | ||
} else { | ||
String username = this.getPlayerInfo().getProfile().getName(); | ||
|
||
for (int i = 0; Constants.Dev.size() > i; i++) { | ||
if (Constants.Dev.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/dev.png")); | ||
} | ||
for (int i = 0; Constants.OPatreons.size() > i; i++) { | ||
if (Constants.OPatreons.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/oreganized.png")); | ||
} | ||
for (int i = 0; Constants.OFPatreons.size() > i; i++) { | ||
if (Constants.OFPatreons.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/overweightfarming.png")); | ||
} | ||
for (int i = 0; Constants.GPatreonsBlue.size() > i; i++) { | ||
if (Constants.GPatreonsBlue.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/galosphere_blue.png")); | ||
} | ||
for (int i = 0; Constants.GPatreonsYellow.size() > i; i++) { | ||
if (Constants.GPatreonsYellow.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/galosphere_yellow.png")); | ||
} | ||
for (int i = 0; Constants.CPatreons.size() > i; i++) { | ||
if (Constants.CPatreons.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/coopperative.png")); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/galena/oreganized/content/fluid/MoltenLeadFluid.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package galena.oreganized.content.fluid; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.sounds.SoundEvents; | ||
import net.minecraft.sounds.SoundSource; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.LevelReader; | ||
import net.minecraft.world.level.material.FluidState; | ||
import net.minecraftforge.fluids.ForgeFlowingFluid; | ||
|
||
public class MoltenLeadFluid extends ForgeFlowingFluid { | ||
|
||
public MoltenLeadFluid(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
@Override | ||
protected void animateTick(Level world, BlockPos pos, FluidState state, RandomSource rand) { | ||
if (rand.nextInt(200) == 0) { | ||
world.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.LAVA_AMBIENT, SoundSource.BLOCKS, 1.0F, 1.0F, false); | ||
} | ||
} | ||
|
||
@Override | ||
public int getTickDelay(LevelReader world) { | ||
return 5; | ||
} | ||
|
||
@Override | ||
protected boolean isRandomlyTicking() { | ||
return true; | ||
} | ||
|
||
public int getAmount(FluidState state) { | ||
return 8; | ||
} | ||
|
||
public boolean isSource(FluidState state) { | ||
return true; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/galena/oreganized/content/index/OBiomeModifiers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package galena.oreganized.content.index; | ||
|
||
import com.mojang.serialization.Codec; | ||
import galena.oreganized.Oreganized; | ||
import galena.oreganized.world.OreganizedBiomeModifier; | ||
import net.minecraftforge.common.world.BiomeModifier; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import net.minecraftforge.registries.RegistryObject; | ||
|
||
@Mod.EventBusSubscriber(modid = Oreganized.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) | ||
public class OBiomeModifiers { | ||
|
||
public static final DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIERS = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, Oreganized.MOD_ID); | ||
|
||
public static final RegistryObject<Codec<? extends BiomeModifier>> OREGANIZED_BIOME_MODIFIER = BIOME_MODIFIERS.register("oreganized_biome_modifier", () -> Codec.unit(OreganizedBiomeModifier::new)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/galena/oreganized/content/index/OConfiguredFeatures.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package galena.oreganized.content.index; | ||
|
||
import galena.oreganized.Oreganized; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.data.BuiltinRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.tags.BlockTags; | ||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; | ||
import net.minecraft.world.level.levelgen.feature.Feature; | ||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; | ||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; | ||
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; | ||
|
||
import java.util.List; | ||
|
||
public class OConfiguredFeatures { | ||
|
||
public static void register() { | ||
|
||
} | ||
|
||
public static final Holder<ConfiguredFeature<OreConfiguration, ?>> SILVER_ORE_LOW = registerConfiguredFeature("silver_ore", Feature.ORE, new OreConfiguration(List.of(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), OBlocks.SILVER_ORE.get().defaultBlockState()), OreConfiguration.target(new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES), OBlocks.DEEPSLATE_SILVER_ORE.get().defaultBlockState())), 6)); | ||
|
||
public static <FC extends FeatureConfiguration, F extends Feature<FC>> Holder<ConfiguredFeature<FC, ?>> registerConfiguredFeature(String id, F feature, FC featureConfiguration) { | ||
ResourceLocation modLoc = new ResourceLocation(Oreganized.MOD_ID, id); | ||
|
||
if (BuiltinRegistries.CONFIGURED_FEATURE.keySet().contains(modLoc)) | ||
throw new IllegalStateException("Placed Feature ID: \"" + modLoc + "\" already exists in the Placed Features registry!"); | ||
|
||
return BuiltinRegistries.registerExact(BuiltinRegistries.CONFIGURED_FEATURE, modLoc.toString(), new ConfiguredFeature<>(feature, featureConfiguration)); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/galena/oreganized/content/index/OFluids.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package galena.oreganized.content.index; | ||
|
||
import galena.oreganized.Oreganized; | ||
import galena.oreganized.content.fluid.MoltenLeadFluid; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.material.FlowingFluid; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; | ||
import net.minecraftforge.fluids.FluidType; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import net.minecraftforge.registries.RegistryObject; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public class OFluids { | ||
|
||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, Oreganized.MOD_ID); | ||
public static final DeferredRegister<FluidType> TYPES = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, Oreganized.MOD_ID); | ||
|
||
public static final RegistryObject<FluidType> MOLTEN_LEAD_TYPE = TYPES.register("molten_lead", () -> new FluidType(FluidType.Properties.create().lightLevel(8).density(1500).temperature(600).viscosity(3000).motionScale(0.007D).canExtinguish(false)) { | ||
@Override | ||
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) { | ||
consumer.accept(new IClientFluidTypeExtensions() { | ||
@Override | ||
public ResourceLocation getStillTexture() { | ||
return new ResourceLocation(Oreganized.MOD_ID, "fluid/molten_lead"); | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
public static final RegistryObject<FlowingFluid> MOLTEN_LEAD = FLUIDS.register("molten_lead", () -> new MoltenLeadFluid(OFluids.MOLTEN_LEAD_PROPERTIES)); | ||
|
||
public static final MoltenLeadFluid.Properties MOLTEN_LEAD_PROPERTIES = new MoltenLeadFluid.Properties(MOLTEN_LEAD_TYPE, MOLTEN_LEAD, MOLTEN_LEAD).bucket(OItems.MOLTEN_LEAD_BUCKET).block(OBlocks.MOLTEN_LEAD); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/galena/oreganized/content/index/OPlacedFeatures.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package galena.oreganized.content.index; | ||
|
||
import galena.oreganized.Oreganized; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.data.BuiltinRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.levelgen.VerticalAnchor; | ||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; | ||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; | ||
import net.minecraft.world.level.levelgen.placement.*; | ||
|
||
import java.util.List; | ||
|
||
public class OPlacedFeatures { | ||
|
||
public static void register() { | ||
|
||
} | ||
|
||
public static final Holder<PlacedFeature> SILVER_ORE_LOW = registerPlacedFeature("silver_ore", OConfiguredFeatures.SILVER_ORE_LOW, commonOrePlacement(4, HeightRangePlacement.uniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(48)))); | ||
|
||
public static <FC extends FeatureConfiguration> Holder<PlacedFeature> registerPlacedFeature(String id, Holder<ConfiguredFeature<FC, ?>> feature, PlacementModifier... placementModifiers) { | ||
return registerPlacedFeature(id, feature, List.of(placementModifiers)); | ||
} | ||
|
||
public static <FC extends FeatureConfiguration> Holder<PlacedFeature> registerPlacedFeature(String id, Holder<ConfiguredFeature<FC, ?>> feature, List<PlacementModifier> placementModifiers) { | ||
ResourceLocation modLoc = new ResourceLocation(Oreganized.MOD_ID, id); | ||
if (BuiltinRegistries.PLACED_FEATURE.keySet().contains(modLoc)) | ||
throw new IllegalStateException("Placed Feature ID: \"" + modLoc + "\" already exists in the Placed Features registry!"); | ||
|
||
PlacedFeature placedFeature = new PlacedFeature(Holder.hackyErase(feature), List.copyOf(placementModifiers)); | ||
|
||
return BuiltinRegistries.register(BuiltinRegistries.PLACED_FEATURE, modLoc, placedFeature); | ||
} | ||
|
||
private static List<PlacementModifier> orePlacement(PlacementModifier modifier, PlacementModifier modifier2) { | ||
return List.of(modifier, InSquarePlacement.spread(), modifier2, BiomeFilter.biome()); | ||
} | ||
|
||
private static List<PlacementModifier> commonOrePlacement(int count, PlacementModifier modifier) { | ||
return orePlacement(CountPlacement.of(count), modifier); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/galena/oreganized/world/OreganizedBiomeModifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package galena.oreganized.world; | ||
|
||
import com.mojang.serialization.Codec; | ||
import galena.oreganized.content.index.OBiomeModifiers; | ||
import galena.oreganized.content.index.OPlacedFeatures; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.world.level.biome.Biome; | ||
import net.minecraft.world.level.levelgen.GenerationStep; | ||
import net.minecraftforge.common.world.BiomeModifier; | ||
import net.minecraftforge.common.world.ModifiableBiomeInfo; | ||
|
||
public class OreganizedBiomeModifier implements BiomeModifier { | ||
|
||
@Override | ||
public void modify(Holder<Biome> biome, Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder) { | ||
if (phase == Phase.ADD) { | ||
builder.getGenerationSettings().addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, OPlacedFeatures.SILVER_ORE_LOW); | ||
} | ||
} | ||
|
||
@Override | ||
public Codec<? extends BiomeModifier> codec() { | ||
return OBiomeModifiers.OREGANIZED_BIOME_MODIFIER.get(); | ||
} | ||
} |
Oops, something went wrong.