mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Poplar
This commit is contained in:
1 parent
2fa0853e42
commit
8e3ef1b651
45 files changed
+1036
-36
No files matched your search
+19
@@ -84,6 +84,25 @@ public class ModdedBlockResolutionContractTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void netherGroundCoverAcceptsNyliumAndSoulSoilButRejectsBarrenBlocks() {
|
||||
for (Block plant : new Block[]{Blocks.CRIMSON_ROOTS, Blocks.WARPED_ROOTS, Blocks.NETHER_SPROUTS}) {
|
||||
for (Block substrate : new Block[]{Blocks.CRIMSON_NYLIUM, Blocks.WARPED_NYLIUM,
|
||||
Blocks.SOUL_SOIL, Blocks.GRASS_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL}) {
|
||||
assertTrue(plant + " on " + substrate, NativeBlockProperties.canPlaceOnto(plant, substrate));
|
||||
}
|
||||
for (Block substrate : new Block[]{Blocks.NETHERRACK, Blocks.SOUL_SAND,
|
||||
Blocks.STONE, Blocks.GRAVEL, Blocks.AIR, Blocks.WATER}) {
|
||||
assertFalse(plant + " on " + substrate, NativeBlockProperties.canPlaceOnto(plant, substrate));
|
||||
}
|
||||
}
|
||||
for (Block fungus : new Block[]{Blocks.CRIMSON_FUNGUS, Blocks.WARPED_FUNGUS}) {
|
||||
for (Block substrate : new Block[]{Blocks.CRIMSON_NYLIUM, Blocks.WARPED_NYLIUM, Blocks.SOUL_SOIL}) {
|
||||
assertTrue(fungus + " on " + substrate, NativeBlockProperties.canPlaceOnto(fungus, substrate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sulfurAndDripstoneTipsReceivePostLoadUpdates() {
|
||||
for (Block block : new Block[]{Blocks.SULFUR_SPIKE, Blocks.POINTED_DRIPSTONE}) {
|
||||
|
||||
+98
@@ -1,7 +1,23 @@
|
||||
package art.arcane.iris.modded.command;
|
||||
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.localization.IrisLanguage;
|
||||
import art.arcane.iris.localization.RuntimeUiMessages;
|
||||
import art.arcane.iris.modded.ModdedIrisLog;
|
||||
import art.arcane.iris.world.history.SavedBiomeUnavailableException;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeCommandText;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeEditPlayer;
|
||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeEditWorld;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockPoint;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeWorld;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.server.Bootstrap;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -9,8 +25,90 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.clearInvocations;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.mockStatic;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class ModdedDustRevealerTest {
|
||||
@BeforeClass
|
||||
public static void initializeRuntimeTypes() {
|
||||
SharedConstants.tryDetectVersion();
|
||||
Bootstrap.bootStrap();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadingBiomesShowOneNoticeAndNextInteractionShowsResolvedDetails() {
|
||||
Engine engine = mock(Engine.class);
|
||||
NativeEditPlayer player = mock(NativeEditPlayer.class);
|
||||
NativeEditWorld level = mock(NativeEditWorld.class);
|
||||
NativeWorld world = mock(NativeWorld.class);
|
||||
NativeBlockState block = mock(NativeBlockState.class);
|
||||
NativeBlockPoint position = new NativeBlockPoint(4, 80, 7);
|
||||
IrisBiome biome = new IrisBiome();
|
||||
biome.setLoadKey("saved-forest");
|
||||
when(level.world()).thenReturn(world);
|
||||
when(level.block(4, 80, 7)).thenReturn(block);
|
||||
when(block.key()).thenReturn("minecraft:stone");
|
||||
when(level.biome(position)).thenReturn(new NativeEditWorld.BiomeIdentity("minecraft:forest", 4));
|
||||
when(engine.getSurfaceBiome(4, 7))
|
||||
.thenThrow(new SavedBiomeUnavailableException("Loading", true))
|
||||
.thenReturn(biome);
|
||||
|
||||
try (MockedStatic<IrisModdedCommands> commands = mockStatic(IrisModdedCommands.class);
|
||||
MockedStatic<ModdedIrisLog> logging = mockStatic(ModdedIrisLog.class)) {
|
||||
commands.when(() -> IrisModdedCommands.engineFor(world)).thenReturn(engine);
|
||||
|
||||
ModdedDustRevealer.reveal(player, level, position);
|
||||
|
||||
ArgumentCaptor<NativeCommandText> notice = ArgumentCaptor.forClass(NativeCommandText.class);
|
||||
verify(player).sendSystemMessage(notice.capture());
|
||||
assertEquals(IrisLanguage.plain(RuntimeUiMessages.DUST_BIOME_LOADING), notice.getValue().getString());
|
||||
verify(engine, never()).getBiome(4, 80, 7);
|
||||
verify(level, never()).sound(any(), any(), any());
|
||||
logging.verifyNoInteractions();
|
||||
|
||||
clearInvocations(player);
|
||||
ModdedDustRevealer.reveal(player, level, position);
|
||||
|
||||
verify(player).sendSystemMessage(argThat(
|
||||
message -> message.getString().startsWith("Surface biome: saved-forest")));
|
||||
verify(player, never()).sendSystemMessage(argThat(
|
||||
message -> message.getString().equals(IrisLanguage.plain(RuntimeUiMessages.DUST_BIOME_LOADING))));
|
||||
logging.verifyNoInteractions();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unavailableSavedBiomesRemainLoggedAndAbortReveal() {
|
||||
Engine engine = mock(Engine.class);
|
||||
NativeEditPlayer player = mock(NativeEditPlayer.class);
|
||||
NativeEditWorld level = mock(NativeEditWorld.class);
|
||||
NativeWorld world = mock(NativeWorld.class);
|
||||
SavedBiomeUnavailableException failure = new SavedBiomeUnavailableException("Missing saved pack", false);
|
||||
when(level.world()).thenReturn(world);
|
||||
when(engine.getSurfaceBiome(4, 7)).thenThrow(failure);
|
||||
|
||||
try (MockedStatic<IrisModdedCommands> commands = mockStatic(IrisModdedCommands.class);
|
||||
MockedStatic<ModdedIrisLog> logging = mockStatic(ModdedIrisLog.class)) {
|
||||
commands.when(() -> IrisModdedCommands.engineFor(world)).thenReturn(engine);
|
||||
|
||||
ModdedDustRevealer.reveal(player, level, new NativeBlockPoint(4, 80, 7));
|
||||
|
||||
ArgumentCaptor<NativeCommandText> notice = ArgumentCaptor.forClass(NativeCommandText.class);
|
||||
verify(player).sendSystemMessage(notice.capture());
|
||||
assertEquals(IrisLanguage.plain(RuntimeUiMessages.DUST_REVEAL_FAILED), notice.getValue().getString());
|
||||
logging.verify(() -> ModdedIrisLog.error("Iris dust saved biome lookup failed at {}", "4, 80, 7", failure));
|
||||
logging.verifyNoMoreInteractions();
|
||||
verify(engine, never()).getBiome(4, 80, 7);
|
||||
verify(level, never()).sound(any(), any(), any());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void placementClassificationCoversObjectDecorationAndTerrain() {
|
||||
assertTrue(ModdedDustRevealer.placementLine(3, 10, 13, "tree")
|
||||
|
||||
Reference in new issue
Block a user