How to use getUsageMode method of be.seeseemelk.mockbukkit.block.state.StructureMock class

Best MockBukkit code snippet using be.seeseemelk.mockbukkit.block.state.StructureMock.getUsageMode

Source:StructureMockTest.java Github

copy

Full Screen

...83 assertEquals(new BlockVector(4, 5, 6), clone.getStructureSize());84 assertEquals(Mirror.FRONT_BACK, clone.getMirror());85 assertEquals(StructureRotation.CLOCKWISE_90, clone.getRotation());86 assertEquals("meta_data", clone.getMetadata());87 assertEquals(UsageMode.SAVE, clone.getUsageMode());88 assertFalse(clone.isIgnoreEntities());89 assertTrue(clone.isShowAir());90 assertFalse(clone.isBoundingBoxVisible());91 assertEquals(0.5f, clone.getIntegrity());92 assertEquals(1L, clone.getSeed());93 }94 @Test95 void setStructureName()96 {97 structure.setStructureName("structure_name");98 assertEquals("structure_name", structure.getStructureName());99 }100 @Test101 void setStructureName_Null_ThrowsException()102 {103 assertThrowsExactly(NullPointerException.class, () -> structure.setStructureName(null));104 }105 @Test106 void setAuthor()107 {108 structure.setAuthor("author");109 assertEquals("author", structure.getAuthor());110 }111 @Test112 void setAuthor_Null_ThrowsException()113 {114 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setAuthor((String) null));115 }116 @Test117 void setAuthor_Entity()118 {119 LivingEntityMock entity = (LivingEntityMock) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.SHEEP);120 entity.setName("entity_author");121 structure.setAuthor(entity);122 assertEquals("entity_author", structure.getAuthor());123 }124 @Test125 void setAuthor_Entity_Null_ThrowsException()126 {127 assertThrowsExactly(NullPointerException.class, () -> structure.setAuthor((LivingEntity) null));128 }129 @Test130 void setRelativePosition()131 {132 structure.setRelativePosition(new BlockVector(48, 48, 48));133 assertEquals(new BlockVector(48, 48, 48), structure.getRelativePosition());134 }135 @Test136 void setRelativePosition_Null_ThrowsException()137 {138 assertThrowsExactly(NullPointerException.class, () -> structure.setRelativePosition(null));139 }140 @Test141 void setRelativePosition_X_TooLarge()142 {143 BlockVector vector = new BlockVector(49, 48, 48);144 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setRelativePosition(vector));145 }146 @Test147 void setRelativePosition_Y_TooLarge()148 {149 BlockVector vector = new BlockVector(48, 49, 48);150 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setRelativePosition(vector));151 }152 @Test153 void setRelativePosition_Z_TooLarge()154 {155 BlockVector vector = new BlockVector(48, 48, 49);156 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setRelativePosition(vector));157 }158 @Test159 void setRelativePosition_X_TooSmall()160 {161 BlockVector vector = new BlockVector(-49, -48, -48);162 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setRelativePosition(vector));163 }164 @Test165 void setRelativePosition_Y_TooSmall()166 {167 BlockVector vector = new BlockVector(-48, -49, -48);168 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setRelativePosition(vector));169 }170 @Test171 void setRelativePosition_Z_TooSmall()172 {173 BlockVector vector = new BlockVector(-48, -48, -49);174 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setRelativePosition(vector));175 }176 @Test177 void setStructureSize()178 {179 structure.setStructureSize(new BlockVector(48, 48, 48));180 assertEquals(new BlockVector(48, 48, 48), structure.getStructureSize());181 }182 @Test183 void setStructureSize_Null_ThrowsException()184 {185 assertThrowsExactly(NullPointerException.class, () -> structure.setStructureSize(null));186 }187 @Test188 void setStructureSize_X_TooLarge()189 {190 BlockVector vector = new BlockVector(49, 48, 48);191 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setStructureSize(vector));192 }193 @Test194 void setStructureSize_Y_TooLarge()195 {196 BlockVector vector = new BlockVector(48, 49, 48);197 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setStructureSize(vector));198 }199 @Test200 void setStructureSize_Z_TooLarge()201 {202 BlockVector vector = new BlockVector(48, 48, 49);203 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setStructureSize(vector));204 }205 @Test206 void setStructureSize_X_TooSmall()207 {208 BlockVector vector = new BlockVector(-49, -48, -48);209 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setStructureSize(vector));210 }211 @Test212 void setStructureSize_Y_TooSmall()213 {214 BlockVector vector = new BlockVector(-48, -49, -48);215 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setStructureSize(vector));216 }217 @Test218 void setStructureSize_Z_TooSmall()219 {220 BlockVector vector = new BlockVector(-48, -48, -49);221 assertThrowsExactly(IllegalArgumentException.class, () -> structure.setStructureSize(vector));222 }223 @Test224 void setMirror()225 {226 structure.setMirror(Mirror.FRONT_BACK);227 assertEquals(Mirror.FRONT_BACK, structure.getMirror());228 }229 @Test230 void setMirror_Null_ThrowsException()231 {232 assertThrowsExactly(NullPointerException.class, () -> structure.setMirror(null));233 }234 @Test235 void setRotation()236 {237 structure.setRotation(StructureRotation.CLOCKWISE_90);238 assertEquals(StructureRotation.CLOCKWISE_90, structure.getRotation());239 }240 @Test241 void setRotation_Null_ThrowsException()242 {243 assertThrowsExactly(NullPointerException.class, () -> structure.setRotation(null));244 }245 @Test246 void setUsageMode()247 {248 structure.setUsageMode(UsageMode.SAVE);249 assertEquals(UsageMode.SAVE, structure.getUsageMode());250 }251 @Test252 void setUsageMode_Null_ThrowsException()253 {254 assertThrowsExactly(NullPointerException.class, () -> structure.setUsageMode(null));255 }256 @Test257 void setIgnoreEntities()258 {259 structure.setIgnoreEntities(false);260 assertFalse(structure.isIgnoreEntities());261 }262 @Test263 void setShowAir()...

Full Screen

Full Screen

Source:StructureMock.java Github

copy

Full Screen

...142 Preconditions.checkNotNull(mode, "Usage Mode cannot be null");143 this.usageMode = mode;144 }145 @Override146 public @NotNull UsageMode getUsageMode()147 {148 return this.usageMode;149 }150 @Override151 public void setIgnoreEntities(boolean ignoreEntities)152 {153 this.ignoreEntities = ignoreEntities;154 }155 @Override156 public boolean isIgnoreEntities()157 {158 return this.ignoreEntities;159 }160 @Override161 public void setShowAir(boolean showAir)162 {163 this.showAir = showAir;164 }165 @Override166 public boolean isShowAir()167 {168 return this.showAir;169 }170 @Override171 public void setBoundingBoxVisible(boolean showBoundingBox)172 {173 this.showBoundingBox = showBoundingBox;174 }175 @Override176 public boolean isBoundingBoxVisible()177 {178 return this.showBoundingBox;179 }180 @Override181 public void setIntegrity(float integrity)182 {183 Preconditions.checkArgument(StructureMock.isBetween(integrity, 0.0f, 1.0f), "Integrity must be between 0 and 1");184 this.integrity = integrity;185 }186 @Override187 public float getIntegrity()188 {189 return this.integrity;190 }191 @Override192 public void setSeed(long seed)193 {194 this.seed = seed;195 }196 @Override197 public long getSeed()198 {199 return this.seed;200 }201 @Override202 public void setMetadata(@NotNull String metadata)203 {204 Preconditions.checkNotNull(metadata, "Metadata cannot be null");205 if (this.getUsageMode() == UsageMode.DATA)206 {207 this.metadata = metadata;208 }209 }210 @Override211 public @NotNull String getMetadata()212 {213 return this.metadata;214 }215 //todo: create a math util class216 private static boolean isBetween(float num, float min, float max)217 {218 return num >= min && num <= max;219 }...

Full Screen

Full Screen

getUsageMode

Using AI Code Generation

copy

Full Screen

1import be.seeseemelk.mockbukkit.block.state.StructureMock;2import org.bukkit.block.Block;3import org.bukkit.block.BlockState;4import org.bukkit.block.Structure;5import org.bukkit.block.data.BlockData;6import org.bukkit.block.data.type.StructureBlock;7import org.bukkit.Location;8public class StructureMockTest {9 public static void main(String[] args) {10 StructureMock structureMock = new StructureMock();11 BlockData blockData = structureMock.getBlockData();12 StructureBlock structureBlock = (StructureBlock) blockData;13 structureBlock.setMode(StructureBlock.Mode.DATA);14 structureMock.setBlockData(blockData);15 Structure structure = (Structure) structureMock;16 System.out.println(structure.getUsageMode());17 }18}19import be.seeseemelk.mockbukkit.block.state.StructureBlockMock;20import org.bukkit.block.Block;21import org.bukkit.block.BlockState;22import org.bukkit.block.Structure;23import org.bukkit.block.data.BlockData;24import org.bukkit.block.data.type.StructureBlock;25import org.bukkit.Location;26public class StructureBlockMockTest {27 public static void main(String[] args) {28 StructureBlockMock structureBlockMock = new StructureBlockMock();29 BlockData blockData = structureBlockMock.getBlockData();30 StructureBlock structureBlock = (StructureBlock) blockData;31 structureBlock.setMode(StructureBlock.Mode.DATA);32 structureBlockMock.setBlockData(blockData);33 Structure structure = (Structure) structureBlockMock;34 System.out.println(structure.getUsageMode());35 }36}37import be.seeseemelk.mockbukkit.block.state.StructureBlockStateMock;38import org.bukkit.block.Block;39import org.bukkit.block.BlockState;40import org.bukkit.block.Structure;41import org.bukkit.block.data.BlockData;42import org.bukkit.block.data.type.StructureBlock;43import org.bukkit.Location;44public class StructureBlockStateMockTest {45 public static void main(String[] args) {46 StructureBlockStateMock structureBlockStateMock = new StructureBlockStateMock();47 BlockData blockData = structureBlockStateMock.getBlockData();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful