Skip to content

Commit 68faad6

Browse files
committed
Added capes and other stuff
1 parent 2559007 commit 68faad6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+330
-14
lines changed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 GLEEP ORANGE
3+
Copyright (c) 2022 Team Galena
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ minecraft {
3737
ideaModule "${rootProject.name}.${project.name}.main"
3838
taskName 'Client'
3939
args "-mixin.config=${mod_id}.mixins.json"
40+
args "-mixin.config=galenacapes.forge.mixins.json"
4041
mods {
4142
modClientRun {
4243
source sourceSets.main
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package galena.galenacapes;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
6+
import java.util.List;
7+
8+
public class Constants {
9+
10+
/*
11+
@author: Xaidee
12+
13+
Remember to update this list frequently!
14+
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
15+
*/
16+
17+
public static final String MOD_ID = "galenacapes";
18+
public static final String MOD_NAME = "Galena Capes";
19+
public static final Logger LOG = LoggerFactory.getLogger(MOD_NAME);
20+
21+
// List of usernames apart of Team Galena
22+
public static final List<String> Dev = List.of(
23+
"Dev"
24+
);
25+
/// Patreon member capes
26+
public static final List<String> OPatreons = List.of( // Oreganized Cape
27+
"Xaidee",
28+
"Bi_nome",
29+
"keviikk"
30+
);
31+
public static final List<String> OFPatreons = List.of( // Overweight Farming Cape
32+
33+
);
34+
public static final List<String> GPatreonsBlue = List.of( // Blue Galosphere Cape
35+
36+
);
37+
public static final List<String> GPatreonsYellow = List.of( // Yellow Galosphere Cape
38+
39+
);
40+
public static final List<String> CPatreons = List.of( // Cooperative Cape
41+
"Axeceros"
42+
);
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package galena.galenacapes.mixin;
2+
3+
import galena.galenacapes.Constants;
4+
import net.minecraft.client.Minecraft;
5+
import net.minecraft.client.multiplayer.PlayerInfo;
6+
import net.minecraft.client.player.AbstractClientPlayer;
7+
import net.minecraft.resources.ResourceLocation;
8+
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.Shadow;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13+
14+
import javax.annotation.Nullable;
15+
import java.util.Objects;
16+
17+
@Mixin(AbstractClientPlayer.class)
18+
public abstract class AbstractClientPlayerMixin {
19+
20+
/*
21+
@author: Xaidee
22+
23+
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
24+
*/
25+
26+
@Shadow @Nullable
27+
protected abstract PlayerInfo getPlayerInfo();
28+
29+
@Inject(method= "getCloakTextureLocation()Lnet/minecraft/resources/ResourceLocation;", at=@At("RETURN"), cancellable = true)
30+
31+
public void getCloakTextureLocation(CallbackInfoReturnable<ResourceLocation> cir) {
32+
assert Minecraft.getInstance().player != null;
33+
if(!(Objects.requireNonNull(this.getPlayerInfo()).getProfile().getId().equals(Minecraft.getInstance().player.getUUID()))) {
34+
cir.setReturnValue(null);
35+
} else {
36+
String username = this.getPlayerInfo().getProfile().getName();
37+
38+
for (int i = 0; Constants.Dev.size() > i; i++) {
39+
if (Constants.Dev.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/dev.png"));
40+
}
41+
for (int i = 0; Constants.OPatreons.size() > i; i++) {
42+
if (Constants.OPatreons.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/oreganized.png"));
43+
}
44+
for (int i = 0; Constants.OFPatreons.size() > i; i++) {
45+
if (Constants.OFPatreons.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/overweightfarming.png"));
46+
}
47+
for (int i = 0; Constants.GPatreonsBlue.size() > i; i++) {
48+
if (Constants.GPatreonsBlue.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/galosphere_blue.png"));
49+
}
50+
for (int i = 0; Constants.GPatreonsYellow.size() > i; i++) {
51+
if (Constants.GPatreonsYellow.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/galosphere_yellow.png"));
52+
}
53+
for (int i = 0; Constants.CPatreons.size() > i; i++) {
54+
if (Constants.CPatreons.get(i).equals(username)) cir.setReturnValue(new ResourceLocation(Constants.MOD_ID, "textures/capes/coopperative.png"));
55+
}
56+
}
57+
}
58+
}

src/main/java/galena/oreganized/Oreganized.java

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public Oreganized() {
5959
OSoundEvents.SOUNDS,
6060
OStructures.STRUCTURE_TYPES,
6161
OStructures.STRUCTURES,
62+
OBiomeModifiers.BIOME_MODIFIERS,
6263
};
6364

6465
for (DeferredRegister<?> register : registers) {
@@ -68,6 +69,8 @@ public Oreganized() {
6869

6970
private void setup(FMLCommonSetupEvent event) {
7071
event.enqueueWork(() -> {
72+
OConfiguredFeatures.register();
73+
OPlacedFeatures.register();
7174
OCauldronInteractions.register();
7275

7376
PotionBrewing.addMix(Potions.WATER, OItems.LEAD_INGOT.get(), OPotions.STUNNING.get());

src/main/java/galena/oreganized/content/block/MoltenLeadBlock.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
import net.minecraft.world.level.block.Block;
2222
import net.minecraft.world.level.block.Blocks;
2323
import net.minecraft.world.level.block.BucketPickup;
24+
import net.minecraft.world.level.block.LiquidBlock;
2425
import net.minecraft.world.level.block.state.BlockBehaviour;
2526
import net.minecraft.world.level.block.state.BlockState;
2627
import net.minecraft.world.level.block.state.StateDefinition;
2728
import net.minecraft.world.level.block.state.properties.BooleanProperty;
29+
import net.minecraft.world.level.material.FlowingFluid;
2830
import net.minecraft.world.level.pathfinder.PathComputationType;
2931
import net.minecraft.world.phys.Vec3;
3032
import net.minecraft.world.phys.shapes.CollisionContext;
@@ -33,17 +35,18 @@
3335
import net.minecraft.world.phys.shapes.VoxelShape;
3436

3537
import java.util.Optional;
38+
import java.util.function.Supplier;
3639

37-
public class MoltenLeadBlock extends Block implements BucketPickup {
40+
public class MoltenLeadBlock extends LiquidBlock {
3841
/*
3942
The following code is a mishmash of PowderSnowBlock with some extras taken from Fluid classes.
4043
*/
4144
private static final BooleanProperty MOVING = BooleanProperty.create("ismoving");
4245

4346
private static final VoxelShape FALLING_COLLISION_SHAPE = Shapes.box(0.0D, 0.0D, 0.0D, 1.0D, (double)0.9F, 1.0D);
4447

45-
public MoltenLeadBlock(BlockBehaviour.Properties properties) {
46-
super(properties);
48+
public MoltenLeadBlock(Supplier<? extends FlowingFluid> fluid, Properties properties) {
49+
super(fluid, properties.noCollission().strength(-1.0F, 3600000.0F).noLootTable().lightLevel((state) -> 8));
4750
}
4851

4952
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package galena.oreganized.content.fluid;
2+
3+
import net.minecraft.core.BlockPos;
4+
import net.minecraft.sounds.SoundEvents;
5+
import net.minecraft.sounds.SoundSource;
6+
import net.minecraft.util.RandomSource;
7+
import net.minecraft.world.level.Level;
8+
import net.minecraft.world.level.LevelReader;
9+
import net.minecraft.world.level.material.FluidState;
10+
import net.minecraftforge.fluids.ForgeFlowingFluid;
11+
12+
public class MoltenLeadFluid extends ForgeFlowingFluid {
13+
14+
public MoltenLeadFluid(Properties properties) {
15+
super(properties);
16+
}
17+
18+
@Override
19+
protected void animateTick(Level world, BlockPos pos, FluidState state, RandomSource rand) {
20+
if (rand.nextInt(200) == 0) {
21+
world.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.LAVA_AMBIENT, SoundSource.BLOCKS, 1.0F, 1.0F, false);
22+
}
23+
}
24+
25+
@Override
26+
public int getTickDelay(LevelReader world) {
27+
return 5;
28+
}
29+
30+
@Override
31+
protected boolean isRandomlyTicking() {
32+
return true;
33+
}
34+
35+
public int getAmount(FluidState state) {
36+
return 8;
37+
}
38+
39+
public boolean isSource(FluidState state) {
40+
return true;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package galena.oreganized.content.index;
2+
3+
import com.mojang.serialization.Codec;
4+
import galena.oreganized.Oreganized;
5+
import galena.oreganized.world.OreganizedBiomeModifier;
6+
import net.minecraftforge.common.world.BiomeModifier;
7+
import net.minecraftforge.fml.common.Mod;
8+
import net.minecraftforge.registries.DeferredRegister;
9+
import net.minecraftforge.registries.ForgeRegistries;
10+
import net.minecraftforge.registries.RegistryObject;
11+
12+
@Mod.EventBusSubscriber(modid = Oreganized.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
13+
public class OBiomeModifiers {
14+
15+
public static final DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIERS = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, Oreganized.MOD_ID);
16+
17+
public static final RegistryObject<Codec<? extends BiomeModifier>> OREGANIZED_BIOME_MODIFIER = BIOME_MODIFIERS.register("oreganized_biome_modifier", () -> Codec.unit(OreganizedBiomeModifier::new));
18+
}

src/main/java/galena/oreganized/content/index/OBlocks.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ public class OBlocks {
2727
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Oreganized.MOD_ID);
2828

2929

30-
public static final RegistryObject<Block> MOLTEN_LEAD = register("molten_lead_block", () ->
31-
new MoltenLeadBlock(BlockBehaviour.Properties.of(OMaterials.MOLTEN_LEAD).strength(-1.0F, 3600000.0F)
32-
.dynamicShape().lightLevel((light) -> 8)));
30+
public static final RegistryObject<LiquidBlock> MOLTEN_LEAD = register("molten_lead_block", () ->
31+
new MoltenLeadBlock(OFluids.MOLTEN_LEAD, BlockBehaviour.Properties.of(OMaterials.MOLTEN_LEAD)));
3332
public static final RegistryObject<Block> MOLTEN_LEAD_CAULDRON = register("molten_lead_cauldron", () -> new MoltenLeadCauldronBlock(BlockBehaviour.Properties.copy(Blocks.LAVA_CAULDRON).lightLevel(moltenStageEmission())));
3433

3534
// Glance
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package galena.oreganized.content.index;
2+
3+
import galena.oreganized.Oreganized;
4+
import net.minecraft.core.Holder;
5+
import net.minecraft.data.BuiltinRegistries;
6+
import net.minecraft.resources.ResourceLocation;
7+
import net.minecraft.tags.BlockTags;
8+
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
9+
import net.minecraft.world.level.levelgen.feature.Feature;
10+
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
11+
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
12+
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
13+
14+
import java.util.List;
15+
16+
public class OConfiguredFeatures {
17+
18+
public static void register() {
19+
20+
}
21+
22+
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));
23+
24+
public static <FC extends FeatureConfiguration, F extends Feature<FC>> Holder<ConfiguredFeature<FC, ?>> registerConfiguredFeature(String id, F feature, FC featureConfiguration) {
25+
ResourceLocation modLoc = new ResourceLocation(Oreganized.MOD_ID, id);
26+
27+
if (BuiltinRegistries.CONFIGURED_FEATURE.keySet().contains(modLoc))
28+
throw new IllegalStateException("Placed Feature ID: \"" + modLoc + "\" already exists in the Placed Features registry!");
29+
30+
return BuiltinRegistries.registerExact(BuiltinRegistries.CONFIGURED_FEATURE, modLoc.toString(), new ConfiguredFeature<>(feature, featureConfiguration));
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package galena.oreganized.content.index;
2+
3+
import galena.oreganized.Oreganized;
4+
import galena.oreganized.content.fluid.MoltenLeadFluid;
5+
import net.minecraft.resources.ResourceLocation;
6+
import net.minecraft.world.level.material.FlowingFluid;
7+
import net.minecraft.world.level.material.Fluid;
8+
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
9+
import net.minecraftforge.fluids.FluidType;
10+
import net.minecraftforge.registries.DeferredRegister;
11+
import net.minecraftforge.registries.ForgeRegistries;
12+
import net.minecraftforge.registries.RegistryObject;
13+
14+
import java.util.function.Consumer;
15+
16+
public class OFluids {
17+
18+
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, Oreganized.MOD_ID);
19+
public static final DeferredRegister<FluidType> TYPES = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, Oreganized.MOD_ID);
20+
21+
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)) {
22+
@Override
23+
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {
24+
consumer.accept(new IClientFluidTypeExtensions() {
25+
@Override
26+
public ResourceLocation getStillTexture() {
27+
return new ResourceLocation(Oreganized.MOD_ID, "fluid/molten_lead");
28+
}
29+
});
30+
}
31+
});
32+
33+
public static final RegistryObject<FlowingFluid> MOLTEN_LEAD = FLUIDS.register("molten_lead", () -> new MoltenLeadFluid(OFluids.MOLTEN_LEAD_PROPERTIES));
34+
35+
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);
36+
}

src/main/java/galena/oreganized/content/index/OItems.java

+4
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ public class OItems {
5656
() -> new ElectrumArmorItem(OArmorMaterials.ELECTRUM, EquipmentSlot.LEGS));
5757
public static final RegistryObject<Item> ELECTRUM_BOOTS = ITEMS.register("electrum_boots",
5858
() -> new ElectrumArmorItem(OArmorMaterials.ELECTRUM, EquipmentSlot.FEET));
59+
60+
// Compatibility
61+
/*public static final RegistryObject<Item> ELECTRUM_KNIFE = ITEMS.register("electrum_knife",
62+
() -> new KnifeItem(OItemTiers.ELECTRUM, 0.5F, -1.8F, (new Item.Properties()).tab(ModList.get().isLoaded(FarmersDelight.MODID) ? FarmersDelight.CREATIVE_TAB : null);*/
5963
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package galena.oreganized.content.index;
2+
3+
import galena.oreganized.Oreganized;
4+
import net.minecraft.core.Holder;
5+
import net.minecraft.data.BuiltinRegistries;
6+
import net.minecraft.resources.ResourceLocation;
7+
import net.minecraft.world.level.levelgen.VerticalAnchor;
8+
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
9+
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
10+
import net.minecraft.world.level.levelgen.placement.*;
11+
12+
import java.util.List;
13+
14+
public class OPlacedFeatures {
15+
16+
public static void register() {
17+
18+
}
19+
20+
public static final Holder<PlacedFeature> SILVER_ORE_LOW = registerPlacedFeature("silver_ore", OConfiguredFeatures.SILVER_ORE_LOW, commonOrePlacement(4, HeightRangePlacement.uniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(48))));
21+
22+
public static <FC extends FeatureConfiguration> Holder<PlacedFeature> registerPlacedFeature(String id, Holder<ConfiguredFeature<FC, ?>> feature, PlacementModifier... placementModifiers) {
23+
return registerPlacedFeature(id, feature, List.of(placementModifiers));
24+
}
25+
26+
public static <FC extends FeatureConfiguration> Holder<PlacedFeature> registerPlacedFeature(String id, Holder<ConfiguredFeature<FC, ?>> feature, List<PlacementModifier> placementModifiers) {
27+
ResourceLocation modLoc = new ResourceLocation(Oreganized.MOD_ID, id);
28+
if (BuiltinRegistries.PLACED_FEATURE.keySet().contains(modLoc))
29+
throw new IllegalStateException("Placed Feature ID: \"" + modLoc + "\" already exists in the Placed Features registry!");
30+
31+
PlacedFeature placedFeature = new PlacedFeature(Holder.hackyErase(feature), List.copyOf(placementModifiers));
32+
33+
return BuiltinRegistries.register(BuiltinRegistries.PLACED_FEATURE, modLoc, placedFeature);
34+
}
35+
36+
private static List<PlacementModifier> orePlacement(PlacementModifier modifier, PlacementModifier modifier2) {
37+
return List.of(modifier, InSquarePlacement.spread(), modifier2, BiomeFilter.biome());
38+
}
39+
40+
private static List<PlacementModifier> commonOrePlacement(int count, PlacementModifier modifier) {
41+
return orePlacement(CountPlacement.of(count), modifier);
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package galena.oreganized.world;
2+
3+
import com.mojang.serialization.Codec;
4+
import galena.oreganized.content.index.OBiomeModifiers;
5+
import galena.oreganized.content.index.OPlacedFeatures;
6+
import net.minecraft.core.Holder;
7+
import net.minecraft.world.level.biome.Biome;
8+
import net.minecraft.world.level.levelgen.GenerationStep;
9+
import net.minecraftforge.common.world.BiomeModifier;
10+
import net.minecraftforge.common.world.ModifiableBiomeInfo;
11+
12+
public class OreganizedBiomeModifier implements BiomeModifier {
13+
14+
@Override
15+
public void modify(Holder<Biome> biome, Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder) {
16+
if (phase == Phase.ADD) {
17+
builder.getGenerationSettings().addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, OPlacedFeatures.SILVER_ORE_LOW);
18+
}
19+
}
20+
21+
@Override
22+
public Codec<? extends BiomeModifier> codec() {
23+
return OBiomeModifiers.OREGANIZED_BIOME_MODIFIER.get();
24+
}
25+
}

0 commit comments

Comments
 (0)