use of mcjty.rftoolsdim.dimensions.world.GenericWorldProvider in project RFToolsDimensions by McJty.
the class ForgeEventHandlers method onOreGenEvent.
@SubscribeEvent
public void onOreGenEvent(OreGenEvent.GenerateMinable event) {
World world = event.getWorld();
if (world == null) {
return;
}
WorldProvider provider = world.provider;
if (!(provider instanceof GenericWorldProvider))
return;
DimensionInformation information = ((GenericWorldProvider) provider).getDimensionInformation();
if (information != null && information.hasFeatureType(FeatureType.FEATURE_CLEAN)) {
event.setResult(Event.Result.DENY);
}
}
use of mcjty.rftoolsdim.dimensions.world.GenericWorldProvider in project RFToolsDimensions by McJty.
the class ForgeEventHandlers method onReplaceBiomeBlocks.
@SubscribeEvent
public void onReplaceBiomeBlocks(ChunkGeneratorEvent.ReplaceBiomeBlocks event) {
World world = event.getWorld();
if (world == null) {
return;
}
WorldProvider provider = world.provider;
if (!(provider instanceof GenericWorldProvider))
return;
DimensionInformation information = ((GenericWorldProvider) provider).getDimensionInformation();
if (information.hasFeatureType(FeatureType.FEATURE_CLEAN)) {
event.setResult(Event.Result.DENY);
}
}
use of mcjty.rftoolsdim.dimensions.world.GenericWorldProvider in project RFToolsDimensions by McJty.
the class ForgeEventHandlers method onPlayerRightClickEvent.
@SubscribeEvent
public void onPlayerRightClickEvent(PlayerInteractEvent.RightClickBlock event) {
World world = event.getWorld();
if (world.isRemote)
return;
BlockPos pos = event.getPos();
WorldProvider provider = world.provider;
if (!(world.getBlockState(pos).getBlock() instanceof BlockBed && provider instanceof GenericWorldProvider))
return;
// We are in an RFTools dimension.
switch(GeneralConfiguration.bedBehaviour) {
case 0:
event.setCanceled(true);
Logging.message(event.getEntityPlayer(), "You cannot sleep in this dimension!");
break;
// In case 1, just do the usual thing (this typically mean explosion).
case 2:
event.setCanceled(true);
event.getEntityPlayer().setSpawnChunk(pos, true, provider.getDimension());
Logging.message(event.getEntityPlayer(), "Spawn point set!");
}
}
use of mcjty.rftoolsdim.dimensions.world.GenericWorldProvider in project RFToolsDimensions by McJty.
the class ForgeEventHandlers method onEntitySpawn.
@SubscribeEvent
public void onEntitySpawn(LivingSpawnEvent.SpecialSpawn event) {
World world = event.getWorld();
if (world.isRemote) {
return;
}
EntityLivingBase entityLiving = event.getEntityLiving();
if (entityLiving instanceof EntityDragon && world.provider instanceof GenericWorldProvider) {
// Ender dragon needs to be spawned with an additional NBT key set
NBTTagCompound dragonTag = new NBTTagCompound();
entityLiving.writeEntityToNBT(dragonTag);
dragonTag.setShort("DragonPhase", (short) 0);
entityLiving.readEntityFromNBT(dragonTag);
}
}
Aggregations