Skip to content

Commit d718a2b

Browse files
committed
further progress
1 parent 2e2fac3 commit d718a2b

File tree

136 files changed

+535
-694
lines changed

Some content is hidden

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

136 files changed

+535
-694
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ dependencies {
154154
//compileOnly fg.deobf("mezz.jei:jei-1.20.1-common-api:15.2.0.25")
155155
//compileOnly fg.deobf("mezz.jei:jei-1.20.1-forge-api:15.2.0.25")
156156
//runtimeOnly fg.deobf("mezz.jei:jei-1.20.1-forge-15.2.0.25")
157-
implementation "curse.maven:citadel-331936:4613231"
157+
implementation fg.deobf("curse.maven:citadel-331936:4744075")
158158
}
159159

160160
// Example for how to get properties into the manifest for reading by the runtime..

src/main/java/com/github/alexthe666/iceandfire/IceAndFire.java

+7-10
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
import net.minecraft.world.item.CreativeModeTab;
2121
import net.minecraft.world.item.ItemStack;
2222
import net.minecraft.world.level.biome.Biome;
23-
import net.minecraft.world.level.biome.MultiNoiseBiomeSource;
2423
import net.minecraft.world.level.chunk.ChunkGenerator;
25-
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
26-
import net.minecraft.world.level.levelgen.feature.Feature;
2724
import net.minecraftforge.common.MinecraftForge;
2825
import net.minecraftforge.event.server.ServerAboutToStartEvent;
2926
import net.minecraftforge.event.server.ServerStartedEvent;
@@ -91,11 +88,11 @@ public IceAndFire() {
9188

9289
MinecraftForge.EVENT_BUS.addListener(this::onServerStarted);
9390

94-
modBus.addGenericListener(StructureFeature.class, EventPriority.LOW,
91+
/*modBus.addGenericListener(StructureFeature.class, EventPriority.LOW,
9592
(final RegistryEvent.Register<StructureFeature<?>> event) -> IafWorldRegistry
9693
.registerStructureConfiguredFeatures());
9794
modBus.addGenericListener(Feature.class, EventPriority.LOW,
98-
(final RegistryEvent.Register<Feature<?>> event) -> IafWorldRegistry.registerConfiguredFeatures());
95+
(final RegistryEvent.Register<Feature<?>> event) -> IafWorldRegistry.registerConfiguredFeatures());*/
9996

10097
IafItemRegistry.ITEMS.register(modBus);
10198
IafBlockRegistry.BLOCKS.register(modBus);
@@ -126,9 +123,9 @@ public static void onServerAboutToStart(ServerAboutToStartEvent event) {
126123
// Create configured structure feature tags
127124
//DataGenerators.createResources(biomes);
128125

129-
event.getServer().getWorldData().worldGenSettings().dimensions().forEach(levelStem -> {
126+
/*event.getServer().getWorldData().worldGenSettings().dimensions().forEach(levelStem -> {
130127
reloadSources(biomes, levelStem.generator());
131-
});
128+
});*/
132129

133130
biomes.holders().forEach(biome -> {
134131
IafWorldRegistry.addFeatures(biome);
@@ -138,13 +135,13 @@ public static void onServerAboutToStart(ServerAboutToStartEvent event) {
138135
}
139136

140137
private static void reloadSources(Registry<Biome> biomes, ChunkGenerator generator) {
141-
if (generator instanceof NoiseBasedChunkGenerator chunkGenerator
138+
/*if (generator instanceof NoiseBasedChunkGenerator chunkGenerator
142139
&& chunkGenerator.biomeSource instanceof MultiNoiseBiomeSource biomeSource
143140
&& chunkGenerator.runtimeBiomeSource instanceof MultiNoiseBiomeSource runtimeBiomeSource)
144141
{
145142
biomeSource.possibleBiomes.stream().distinct().forEach(IafWorldRegistry::addFeatures);
146143
runtimeBiomeSource.possibleBiomes.stream().distinct().forEach(IafWorldRegistry::addFeatures);
147-
}
144+
}*/
148145
}
149146

150147
@SubscribeEvent
@@ -193,7 +190,7 @@ private void setup(final FMLCommonSetupEvent event) {
193190
NETWORK_WRAPPER.registerMessage(packetsRegistered++, MessageSwingArm.class, MessageSwingArm::write, MessageSwingArm::read, MessageSwingArm.Handler::handle);
194191
event.enqueueWork(() -> {
195192
PROXY.setup();
196-
IafVillagerRegistry.setup();
193+
//TODO: IafVillagerRegistry.setup();
197194
IafLootRegistry.init();
198195
});
199196
}

src/main/java/com/github/alexthe666/iceandfire/client/gui/GuiDragonForge.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private int getCookTime(int p_175381_1_) {
6464
BlockEntity te = IceAndFire.PROXY.getRefrencedTE();
6565
int j = 0;
6666

67-
List<DragonForgeRecipe> recipes = this.getMinecraft().level.getRecipeManager()
67+
List<DragonForgeRecipe> recipes = this.getMinecraft().level().getRecipeManager()
6868
.getAllRecipesFor(IafRecipeRegistry.DRAGON_FORGE_TYPE)
6969
.stream().filter(item ->
7070
item.isValidInput(tileFurnace.getSlot(0).getItem()) && item.isValidBlood(tileFurnace.getSlot(1).getItem())).collect(Collectors.toList());

src/main/java/com/github/alexthe666/iceandfire/client/model/ModelDeathWormGauntlet.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public Iterable<AdvancedModelBox> getAllParts() {
108108
public void animate(ItemStack stack, float partialTick) {
109109
this.resetToDefaultPose();
110110
if (stack.getTag() != null) {
111-
Entity holder = Minecraft.getInstance().level.getEntity(stack.getTag().getInt("HolderID"));
111+
Entity holder = Minecraft.getInstance().level().getEntity(stack.getTag().getInt("HolderID"));
112112
if (!(holder instanceof LivingEntity))
113113
return;
114114
float lungeTicks = MiscProperties.getLungeTicks((LivingEntity) holder) + partialTick;

src/main/java/com/github/alexthe666/iceandfire/client/render/entity/layer/LayerBipedArmor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private void renderEquipment(PoseStack matrixStackIn, MultiBufferSource bufferIn
5252
ItemStack itemstack = entityIn.getItemBySlot(slotType);
5353
if (itemstack.getItem() instanceof ArmorItem) {
5454
ArmorItem armoritem = (ArmorItem) itemstack.getItem();
55-
if (armoritem.getSlot() == slotType) {
55+
if (armoritem.getEquipmentSlot() == slotType) {
5656
this.getParentModel().setModelAttributes(modelIn);
5757
this.setModelSlotVisible(modelIn, slotType);
5858
boolean flag1 = itemstack.hasFoil();

src/main/java/com/github/alexthe666/iceandfire/client/texture/ArrayLayeredTexture.java

+21-58
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.io.IOException;
1515
import java.util.Iterator;
1616
import java.util.List;
17+
import java.util.Optional;
1718

1819
public class ArrayLayeredTexture extends AbstractTexture {
1920
private static final Logger LOGGER = LogManager.getLogger();
@@ -27,75 +28,37 @@ public ArrayLayeredTexture(List<String> textureNames) {
2728
public void load(@NotNull ResourceManager manager) {
2829
Iterator<String> iterator = this.layeredTextureNames.iterator();
2930
String s = iterator.next();
30-
31-
try (Resource iresource = manager.getResource(new ResourceLocation(s))) {
32-
NativeImage nativeimage = net.minecraftforge.client.MinecraftForgeClient.getImageLayer(new ResourceLocation(s), manager);
33-
while (iterator.hasNext()) {
34-
String s1 = iterator.next();
35-
if (s1 != null) {
36-
try (
37-
Resource iresource1 = manager.getResource(new ResourceLocation(s1));
38-
NativeImage nativeimage1 = NativeImage.read(iresource1.getInputStream())
39-
) {
31+
Optional<Resource> iresource = manager.getResource(new ResourceLocation(s));
32+
if (iresource.isPresent()) {
33+
try {
34+
NativeImage nativeimage = NativeImage.read(iresource.get().open());
35+
while (iterator.hasNext()) {
36+
String s1 = iterator.next();
37+
if (s1 != null) {
38+
Optional<Resource> iresource1 = manager.getResource(new ResourceLocation(s1));
39+
NativeImage nativeimage1 = NativeImage.read(iresource1.get().open());
4040
for (int i = 0; i < Math.min(nativeimage1.getHeight(), nativeimage.getHeight()); i++) {
4141
for (int j = 0; j < Math.min(nativeimage1.getWidth(), nativeimage.getWidth()); j++) {
42-
blendPixel(nativeimage, nativeimage1, j, i, nativeimage1.getPixelRGBA(j, i));
42+
nativeimage.blendPixel(j, i, nativeimage1.getPixelRGBA(j, i));
4343
}
4444
}
4545
}
4646
}
47-
}
4847

49-
if (!RenderSystem.isOnRenderThreadOrInit()) {
50-
RenderSystem.recordRenderCall(() -> {
48+
if (!RenderSystem.isOnRenderThreadOrInit()) {
49+
RenderSystem.recordRenderCall(() -> {
50+
this.loadImage(nativeimage);
51+
});
52+
} else {
5153
this.loadImage(nativeimage);
52-
});
53-
} else {
54-
this.loadImage(nativeimage);
54+
}
55+
} catch (IOException exception) {
56+
LOGGER.error("Couldn't load layered image", exception);
5557
}
56-
} catch (IOException ioexception) {
57-
LOGGER.error("Couldn't load layered image", ioexception);
58-
}
59-
60-
}
61-
62-
public static void blendPixel(NativeImage nativeimage, NativeImage nativeimage1, int xIn, int yIn, int colIn) {
63-
int i = nativeimage.getPixelRGBA(xIn, yIn);
64-
float f = NativeImage.getA(colIn) / 255.0F;
65-
float f1 = NativeImage.getB(colIn) / 255.0F;
66-
float f2 = NativeImage.getG(colIn) / 255.0F;
67-
float f3 = NativeImage.getR(colIn) / 255.0F;
68-
float f4 = NativeImage.getA(i) / 255.0F;
69-
float f5 = NativeImage.getB(i) / 255.0F;
70-
float f6 = NativeImage.getG(i) / 255.0F;
71-
float f7 = NativeImage.getR(i) / 255.0F;
72-
float f8 = 1.0F - f;
73-
float f9 = f * f + f4 * f8;
74-
float f10 = f1 * f + f5 * f8;
75-
float f11 = f2 * f + f6 * f8;
76-
float f12 = f3 * f + f7 * f8;
77-
if (f9 > 1.0F) {
78-
f9 = 1.0F;
58+
} else {
59+
LOGGER.error("Couldn't load layered image");
7960
}
8061

81-
if (f10 > 1.0F) {
82-
f10 = 1.0F;
83-
}
84-
85-
if (f11 > 1.0F) {
86-
f11 = 1.0F;
87-
}
88-
89-
if (f12 > 1.0F) {
90-
f12 = 1.0F;
91-
}
92-
93-
int j = (int) (f9 * 255.0F);
94-
int k = (int) (f10 * 255.0F);
95-
int l = (int) (f11 * 255.0F);
96-
int i1 = (int) (f12 * 255.0F);
97-
nativeimage.setPixelRGBA(xIn, yIn, NativeImage.combine(j, k, l, i1));
98-
9962
}
10063

10164
private void loadImage(NativeImage imageIn) {

src/main/java/com/github/alexthe666/iceandfire/config/DefaultBiomes.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.github.alexthe666.iceandfire.config.biome.BiomeEntryType;
44
import com.github.alexthe666.iceandfire.config.biome.IafSpawnBiomeData;
5+
import net.minecraftforge.common.Tags;
56

67
import static net.minecraft.tags.BiomeTags.*;
78
import static net.minecraftforge.common.Tags.Biomes.*;
@@ -113,7 +114,7 @@ public class DefaultBiomes {
113114

114115
public static final IafSpawnBiomeData VERY_HILLY = new IafSpawnBiomeData()
115116
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 0)
116-
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_MOUNTAIN.location().toString(), 0)
117+
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, Tags.Biomes.IS_MOUNTAIN.location().toString(), 0)
117118
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 1)
118119
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_HILL.location().toString(), 1);
119120

@@ -172,7 +173,7 @@ public class DefaultBiomes {
172173
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 1)
173174
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_DENSE.location().toString(), 1)
174175
.addBiomeEntry(BiomeEntryType.BIOME_CATEGORY, false, "forest", 1)
175-
.addBiomeEntry(BiomeEntryType.BIOME_TAG, true, IS_MOUNTAIN.location().toString(), 1)
176+
.addBiomeEntry(BiomeEntryType.BIOME_TAG, true, Tags.Biomes.IS_MOUNTAIN.location().toString(), 1)
176177
.addBiomeEntry(BiomeEntryType.BIOME_TAG, true, IS_HILL.location().toString(), 1)
177178
.addBiomeEntry(BiomeEntryType.BIOME_TAG, true, IS_WET.location().toString(), 1)
178179
.addBiomeEntry(BiomeEntryType.BIOME_TAG, true, IS_HOT.location().toString(), 1)
@@ -201,7 +202,7 @@ public class DefaultBiomes {
201202
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 0)
202203
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_BADLANDS.location().toString(), 0)
203204
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 1)
204-
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_MOUNTAIN.location().toString(), 1)
205+
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, Tags.Biomes.IS_MOUNTAIN.location().toString(), 1)
205206
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 2)
206207
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_HILL.location().toString(), 2)
207208
.addBiomeEntry(BiomeEntryType.REGISTRY_NAME, false, "terralith:rocky_mountains", 3);
@@ -235,7 +236,7 @@ public class DefaultBiomes {
235236
public static final IafSpawnBiomeData HIPPOGRYPH_DARK_BROWN = new IafSpawnBiomeData()
236237
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 0)
237238
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_FOREST.location().toString(), 0)
238-
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_MOUNTAIN.location().toString(), 0)
239+
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, Tags.Biomes.IS_MOUNTAIN.location().toString(), 0)
239240
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_SNOWY.location().toString(), 0)
240241
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 1)
241242
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_FOREST.location().toString(), 1)
@@ -247,12 +248,12 @@ public class DefaultBiomes {
247248
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 0)
248249
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_SPARSE.location().toString(), 0)
249250
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_SNOWY.location().toString(), 0)
250-
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_MOUNTAIN.location().toString(), 0)
251+
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, Tags.Biomes.IS_MOUNTAIN.location().toString(), 0)
251252
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_PEAK.location().toString(), 0)
252253
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 1)
253254
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_SPARSE.location().toString(), 1)
254255
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_SNOWY.location().toString(), 1)
255-
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_MOUNTAIN.location().toString(), 1)
256+
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, Tags.Biomes.IS_MOUNTAIN.location().toString(), 1)
256257
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_SLOPE.location().toString(), 1)
257258
.addBiomeEntry(BiomeEntryType.REGISTRY_NAME, false, "terralith:rocky_mountains", 2);
258259

@@ -265,7 +266,7 @@ public class DefaultBiomes {
265266

266267
public static final IafSpawnBiomeData HIPPOGRYPH_CHESTNUT = new IafSpawnBiomeData()
267268
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_OVERWORLD.location().toString(), 0)
268-
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_MOUNTAIN.location().toString(), 0)
269+
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, Tags.Biomes.IS_MOUNTAIN.location().toString(), 0)
269270
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_BADLANDS.location().toString(), 0)
270271
.addBiomeEntry(BiomeEntryType.BIOME_TAG, false, IS_DRY.location().toString(), 0)
271272
.addBiomeEntry(BiomeEntryType.REGISTRY_NAME, false, "terralith:savanna_badlands", 1);

src/main/java/com/github/alexthe666/iceandfire/entity/EntityAmphithereArrow.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.github.alexthe666.iceandfire.misc.IafSoundRegistry;
55
import net.minecraft.core.particles.ParticleTypes;
66
import net.minecraft.network.protocol.Packet;
7+
import net.minecraft.network.protocol.game.ClientGamePacketListener;
78
import net.minecraft.util.Mth;
89
import net.minecraft.world.entity.EntityType;
910
import net.minecraft.world.entity.LivingEntity;
@@ -39,24 +40,24 @@ public EntityAmphithereArrow(EntityType type, LivingEntity shooter, Level worldI
3940

4041

4142
@Override
42-
public @NotNull Packet<?> getAddEntityPacket() {
43+
public @NotNull Packet<ClientGamePacketListener> getAddEntityPacket() {
4344
return NetworkHooks.getEntitySpawningPacket(this);
4445
}
4546

4647
@Override
4748
public void tick() {
4849
super.tick();
49-
if ((tickCount == 1 || this.tickCount % 70 == 0) && !this.inGround && !this.onGround) {
50+
if ((tickCount == 1 || this.tickCount % 70 == 0) && !this.inGround && !this.onGround()) {
5051
this.playSound(IafSoundRegistry.AMPHITHERE_GUST, 1, 1);
5152
}
52-
if (level.isClientSide && !this.inGround) {
53+
if (level().isClientSide && !this.inGround) {
5354
double d0 = this.random.nextGaussian() * 0.02D;
5455
double d1 = this.random.nextGaussian() * 0.02D;
5556
double d2 = this.random.nextGaussian() * 0.02D;
5657
double d3 = 10.0D;
5758
double xRatio = this.getDeltaMovement().x * this.getBbWidth();
5859
double zRatio = this.getDeltaMovement().z * this.getBbWidth();
59-
this.level.addParticle(ParticleTypes.CLOUD, this.getX() + xRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d0 * 10.0D, this.getY() + this.random.nextFloat() * this.getBbHeight() - d1 * 10.0D, this.getZ() + zRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d2 * 10.0D, d0, d1, d2);
60+
this.level().addParticle(ParticleTypes.CLOUD, this.getX() + xRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d0 * 10.0D, this.getY() + this.random.nextFloat() * this.getBbHeight() - d1 * 10.0D, this.getZ() + zRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d2 * 10.0D, d0, d1, d2);
6061

6162
}
6263
}
@@ -73,7 +74,7 @@ protected void doPostHurtEffects(LivingEntity living) {
7374
}
7475

7576
public void spawnExplosionParticle() {
76-
if (this.level.isClientSide) {
77+
if (this.level().isClientSide) {
7778
for (int height = 0; height < 1 + random.nextInt(2); height++) {
7879
for (int i = 0; i < 20; ++i) {
7980
double d0 = this.random.nextGaussian() * 0.02D;
@@ -82,11 +83,11 @@ public void spawnExplosionParticle() {
8283
double d3 = 10.0D;
8384
double xRatio = this.getDeltaMovement().x * this.getBbWidth();
8485
double zRatio = this.getDeltaMovement().z * this.getBbWidth();
85-
this.level.addParticle(ParticleTypes.CLOUD, this.getX() + xRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d0 * d3, this.getY() + this.random.nextFloat() * this.getBbHeight() - d1 * d3, this.getZ() + zRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d2 * d3, d0, d1, d2);
86+
this.level().addParticle(ParticleTypes.CLOUD, this.getX() + xRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d0 * d3, this.getY() + this.random.nextFloat() * this.getBbHeight() - d1 * d3, this.getZ() + zRatio + this.random.nextFloat() * this.getBbWidth() * 1.0F - this.getBbWidth() - d2 * d3, d0, d1, d2);
8687
}
8788
}
8889
} else {
89-
this.level.broadcastEntityEvent(this, (byte) 20);
90+
this.level().broadcastEntityEvent(this, (byte) 20);
9091
}
9192
}
9293

0 commit comments

Comments
 (0)