Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Aug 4, 2024
1 parent a4a013e commit 395908d
Show file tree
Hide file tree
Showing 22 changed files with 69 additions and 249 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/id/paradiselost/blocks/FloatingBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.id.paradiselost.api.FloatingBlockHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
Expand All @@ -12,11 +13,11 @@
import net.minecraft.world.WorldAccess;

@SuppressWarnings("deprecation")
public class FloatingBlock extends Block {
public class FloatingBlock extends ExperienceDroppingBlock {
private final boolean powered;

public FloatingBlock(boolean powered, Settings properties, UniformIntProvider experienceDropped) {
super(properties);
super(properties, experienceDropped);
this.powered = powered;
}

Expand Down
10 changes: 4 additions & 6 deletions src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ private static Settings flower() {
public static final ParadiseLostTallBrushBlock WILD_FLAX = add("wild_flax", new ParadiseLostTallBrushBlock(flower()), flammablePlant, cutoutMippedRenderLayer);

// Ores
public static final OreBlock CHERINE_ORE = add("cherine_ore", new OreBlock(of(Material.STONE).requiresTool().strength(3f), UniformIntProvider.create(0, 2)));
public static final OreBlock OLVITE_ORE = add("olvite_ore", new OreBlock(of(Material.STONE).requiresTool().strength(3f), UniformIntProvider.create(1, 3)));
public static final OreBlock SURTRUM = add("surtrum", new SurtrumOreBlock(of(Material.STONE).sounds(BlockSoundGroup.NETHER_GOLD_ORE).requiresTool().strength(9f, 20f), UniformIntProvider.create(2, 5)));
public static final ExperienceDroppingBlock CHERINE_ORE = add("cherine_ore", new ExperienceDroppingBlock(of(Material.STONE).requiresTool().strength(3f), UniformIntProvider.create(0, 2)));
public static final ExperienceDroppingBlock OLVITE_ORE = add("olvite_ore", new ExperienceDroppingBlock(of(Material.STONE).requiresTool().strength(3f), UniformIntProvider.create(1, 3)));
public static final ExperienceDroppingBlock SURTRUM = add("surtrum", new SurtrumOreBlock(of(Material.STONE).sounds(BlockSoundGroup.NETHER_GOLD_ORE).requiresTool().strength(9f, 20f), UniformIntProvider.create(2, 5)));
public static final Block METAMORPHIC_SHELL = add("metamorphic_shell", new Block(of(Material.STONE).sounds(BlockSoundGroup.TUFF).requiresTool().strength(40f, 6f)));
public static final PoofBlock SURTRUM_AIR = add("surtrum_air", new PoofBlock(of(Material.FIRE).sounds(BlockSoundGroup.NETHER_GOLD_ORE)));
public static final FloatingBlock LEVITA_ORE = add("levita_ore", new FloatingBlock(false, of(Material.STONE).requiresTool().strength(4f), UniformIntProvider.create(4, 7)));
Expand Down Expand Up @@ -287,9 +287,7 @@ private static Settings cherineTorch() {
//dungeon
// public static final DungeonSwitchBlock DUNGEON_SWITCH = add("dungeonswitch", new DungeonSwitchBlock(of(Material.METAL, MapColor.BLUE).strength(-1.0F, 3600000.0F)));

public static void init() {
ParadiseLostRegistryQueues.BLOCK.register();
}
public static void init() {}

@Environment(EnvType.CLIENT)
public static void initClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@

import net.id.paradiselost.blocks.blockentity.CherineCampfireBlockEntity;
import net.minecraft.block.CampfireBlock;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3f;
import net.minecraft.util.math.RotationAxis;

public class CherineCampfireBlockEntityRenderer implements BlockEntityRenderer<CherineCampfireBlockEntity> {

private final ItemRenderer itemRenderer;

public CherineCampfireBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
this.itemRenderer = ctx.getItemRenderer();
}

@Override
Expand All @@ -31,14 +34,13 @@ public void render(CherineCampfireBlockEntity campfireBlockEntity, float f, Matr
matrixStack.translate(0.5D, 0.44921875D, 0.5D);
Direction direction2 = Direction.fromHorizontal((l + direction.getHorizontal()) % 4);
float g = -direction2.asRotation();
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(g));
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90.0F));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(g));
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90.0F));
matrixStack.translate(-0.3125D, -0.3125D, 0.0D);
matrixStack.scale(0.375F, 0.375F, 0.375F);
MinecraftClient.getInstance().getItemRenderer().renderItem(itemStack, ModelTransformation.Mode.FIXED, i, j, matrixStack, vertexConsumerProvider, k + l);
this.itemRenderer.renderItem(itemStack, ModelTransformationMode.FIXED, i, j, matrixStack, vertexConsumerProvider, campfireBlockEntity.getWorld(), k + l);
matrixStack.pop();
}
}

}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.client.particle.*;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.tag.FluidTags;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.util.math.BlockPos;

import java.util.SplittableRandom;
Expand Down Expand Up @@ -53,10 +53,10 @@ public void tick() {
}
}
this.prevAngle = this.angle;
if (!this.onGround && !this.world.getFluidState(new BlockPos(this.x, this.y, this.z)).isIn(FluidTags.WATER)) {
this.angle += Math.PI * Math.sin(this.rotateFactor * this.age) / 2;
if (!this.onGround && !this.world.getFluidState(new BlockPos((int) this.x, (int) this.y, (int) this.z)).isIn(FluidTags.WATER)) {
this.angle += (float) (Math.PI * Math.sin(this.rotateFactor * this.age) / 2);
}
if (this.world.getFluidState(new BlockPos(this.x, this.y, this.z)).isIn(FluidTags.WATER)) {
if (this.world.getFluidState(new BlockPos((int) this.x, (int) this.y, (int) this.z)).isIn(FluidTags.WATER)) {
this.velocityY = 0;
this.gravityStrength = 0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.particle.*;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.tag.FluidTags;
import net.minecraft.util.math.BlockPos;

Expand Down Expand Up @@ -54,10 +55,10 @@ public void tick() {
}
}
this.prevAngle = this.angle;
if (!this.onGround && !this.world.getFluidState(new BlockPos(this.x, this.y, this.z)).isIn(FluidTags.WATER)) {
this.angle += Math.PI * Math.sin(this.rotateFactor * this.age) / 2;
if (!this.onGround && !this.world.getFluidState(new BlockPos((int) this.x, (int) this.y, (int) this.z)).isIn(FluidTags.WATER)) {
this.angle += (float) (Math.PI * Math.sin(this.rotateFactor * this.age) / 2);
}
if (this.world.getFluidState(new BlockPos(this.x, this.y, this.z)).isIn(FluidTags.WATER)) {
if (this.world.getFluidState(new BlockPos((int) this.x, (int) this.y, (int) this.z)).isIn(FluidTags.WATER)) {
this.velocityY = 0;
this.gravityStrength = 0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleType;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

/**
* The server/common parts of the Paradise Lost particle system.
Expand All @@ -23,10 +24,6 @@ public class ParadiseLostParticles {
public static DefaultParticleType FALLING_ORANGE_PETAL = register("falling_orange_petal");
public static DefaultParticleType CHERINE_FLAME = register("cherine_flame");
public static DefaultParticleType VENOM_BUBBLE = register("venom_bubble");
/**
* A super fancy RGB splash particle.
*/
public static ParticleType<ColoredSplashParticleEffect> COLORED_SPLASH = register("colored_splash", ColoredSplashParticleEffect.FACTORY);

/**
* Registers a simple particle type.
Expand All @@ -35,7 +32,7 @@ public class ParadiseLostParticles {
* @return The new type
*/
private static DefaultParticleType register(String id) {
return Registry.register(Registry.PARTICLE_TYPE, ParadiseLost.locate(id), FabricParticleTypes.simple(true));
return Registry.register(Registries.PARTICLE_TYPE, ParadiseLost.locate(id), FabricParticleTypes.simple(true));
}

/**
Expand All @@ -47,7 +44,7 @@ private static DefaultParticleType register(String id) {
* @return The new type
*/
private static <T extends ParticleEffect> ParticleType<T> register(String id, ParticleEffect.Factory<T> factory) {
return Registry.register(Registry.PARTICLE_TYPE, ParadiseLost.locate(id), FabricParticleTypes.complex(true, factory));
return Registry.register(Registries.PARTICLE_TYPE, ParadiseLost.locate(id), FabricParticleTypes.complex(true, factory));
}

/**
Expand All @@ -56,16 +53,6 @@ private static <T extends ParticleEffect> ParticleType<T> register(String id, Pa
public static void init() {
}

/**
* Creates a colored particle effect.
*
* @param color The color to use
* @return The new effect
*/
public static ColoredSplashParticleEffect coloredSplash(int color) {
return new ColoredSplashParticleEffect(COLORED_SPLASH, color);
}

/**
* The client half of the particle system.
*/
Expand All @@ -79,7 +66,6 @@ public static void init() {
register(FALLING_ORANGE_PETAL, FallingOrangePetalParticle.DefaultFactory::new);
register(VENOM_BUBBLE, VenomBubbleParticle.DefaultFactory::new);
register(CHERINE_FLAME, CherineFlameParticle.DefaultFactory::new);
register(COLORED_SPLASH, ColoredSplashParticle.FACTORY);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.client.color.world.FoliageColors;
import net.minecraft.client.color.world.GrassColors;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;

@Environment(EnvType.CLIENT)
public class ParadiseLostColorProviders {
Expand All @@ -31,7 +31,7 @@ private static void initItems() {

private static void initDynamicColorBlocks() {
// Ideally we shouldn't go through the entire block registry, but it's almost instantaneous anyway
Registry.BLOCK.stream()
Registries.BLOCK.stream()
.filter(block -> block instanceof DynamicColorBlock)
.forEach(block -> {
DynamicColorBlock dynamic = (DynamicColorBlock) block;
Expand Down
Loading

0 comments on commit 395908d

Please sign in to comment.