Skip to content

Commit eb64ff6

Browse files
committed
Amber Rendering Changes + Amber Fluid Freezing
1 parent d93415c commit eb64ff6

File tree

3 files changed

+39
-29
lines changed

3 files changed

+39
-29
lines changed

src/main/java/com/uraneptus/sullysmod/common/blocks/AmberBlock.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.uraneptus.sullysmod.core.other.tags.SMBlockTags;
88
import com.uraneptus.sullysmod.core.registry.SMBlocks;
99
import net.minecraft.core.BlockPos;
10+
import net.minecraft.core.Direction;
1011
import net.minecraft.core.particles.BlockParticleOption;
1112
import net.minecraft.core.particles.ParticleTypes;
1213
import net.minecraft.nbt.CompoundTag;
@@ -48,6 +49,21 @@ public RenderShape getRenderShape(BlockState pState) {
4849
return RenderShape.MODEL;
4950
}
5051

52+
@Override
53+
public boolean skipRendering(BlockState pState, BlockState pAdjacentBlockState, Direction pSide) {
54+
return pAdjacentBlockState.is(this) || super.skipRendering(pState, pAdjacentBlockState, pSide);
55+
}
56+
57+
@Override
58+
public float getShadeBrightness(BlockState pState, BlockGetter pLevel, BlockPos pPos) {
59+
return 1.0F;
60+
}
61+
62+
@Override
63+
public boolean propagatesSkylightDown(BlockState pState, BlockGetter pReader, BlockPos pPos) {
64+
return true;
65+
}
66+
5167
public VoxelShape getCollisionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
5268
BlockEntity blockEntity = pLevel.getBlockEntity(pPos);
5369

src/main/java/com/uraneptus/sullysmod/common/fluids/MoltenAmberFluid.java

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,6 @@ public Item getBucket() {
5555
return SMItems.MOLTEN_AMBER_BUCKET.get();
5656
}
5757

58-
@Override
59-
public void tick(Level pLevel, BlockPos pPos, FluidState pState) {
60-
super.tick(pLevel, pPos, pState);
61-
RandomSource random = pLevel.getRandom();
62-
int k = 5;
63-
if (pState.isSource()) {
64-
k = 15;
65-
}
66-
if (random.nextInt(k) == 0) {
67-
boolean cooldown = true;
68-
if (pLevel.dimension() == Level.NETHER) {
69-
cooldown = false;
70-
} else {
71-
for (BlockPos pos : BlockPos.betweenClosed(pPos.offset(-1, -1, -1), pPos.offset(1, 1, 1))) {
72-
if (pLevel.getBlockState(pos).is(SMBlockTags.MELTS_AMBER)) {
73-
cooldown = false;
74-
break;
75-
}
76-
}
77-
}
78-
if (cooldown) {
79-
if (pLevel.getBlockState(pPos).getBlock() instanceof LiquidBlock) {
80-
pLevel.setBlock(pPos, ForgeEventFactory.fireFluidPlaceBlockEvent(pLevel, pPos, pPos, SMBlocks.AMBER.get().defaultBlockState()), 3);
81-
}
82-
}
83-
}
84-
}
8558

8659
public void animateTick(Level pLevel, BlockPos pPos, FluidState pState, RandomSource pRandom) {
8760
BlockPos blockpos = pPos.above();
@@ -135,7 +108,28 @@ public void randomTick(Level pLevel, BlockPos pPos, FluidState pState, RandomSou
135108
}
136109
}
137110
}
138-
111+
int k = 2;
112+
if (pState.isSource()) {
113+
k = 15;
114+
}
115+
if (pRandom.nextInt(k) == 0) {
116+
boolean cooldown = true;
117+
if (pLevel.dimension() == Level.NETHER) {
118+
cooldown = false;
119+
} else {
120+
for (BlockPos pos : BlockPos.betweenClosed(pPos.offset(-1, -1, -1), pPos.offset(1, 1, 1))) {
121+
if (pLevel.getBlockState(pos).is(SMBlockTags.MELTS_AMBER) && !pLevel.getBlockState(pos).is(SMBlocks.MOLTEN_AMBER_BLOCK.get())) {
122+
cooldown = false;
123+
break;
124+
}
125+
}
126+
}
127+
if (cooldown) {
128+
if (pLevel.getBlockState(pPos).getBlock() instanceof LiquidBlock) {
129+
pLevel.setBlock(pPos, ForgeEventFactory.fireFluidPlaceBlockEvent(pLevel, pPos, pPos, SMBlocks.AMBER.get().defaultBlockState()), 3);
130+
}
131+
}
132+
}
139133
}
140134

141135
private boolean hasFlammableNeighbours(LevelReader pLevel, BlockPos pPos) {

src/main/java/com/uraneptus/sullysmod/data/server/tags/SMBlockTagsProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void addTags(HolderLookup.Provider pProvider) {
149149
Blocks.CAMPFIRE,
150150
Blocks.SOUL_CAMPFIRE,
151151
Blocks.LAVA,
152-
SMBlocks.AMBER_LANTERN.get()
152+
SMBlocks.MOLTEN_AMBER_BLOCK.get()
153153
);
154154

155155
//Forge Tags

0 commit comments

Comments
 (0)