Jump to content

BigWordsScareMe

Members
  • Posts

    17
  • Joined

  • Last visited

BigWordsScareMe's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I figured it out by looking at the dimension manager class. entityIn.changeDimension(worldIn.dimension.getType() == DimensionType.OVERWORLD ? DimensionManager.registerOrGetDimension(racismmod.USA_TYPE, DimensionInit.USA_DIMENSION.get(), null, true) : DimensionType.OVERWORLD);
  2. public class BlockUsaPortal extends Block{ public BlockUsaPortal(Properties properties){ super(properties); } public boolean hasTileEntity(BlockState state){ return true; } public TileEntity createTileEntity(BlockState state, IBlockReader world) { return ModTileEntityTypes.USAPORTAL.get().create(); } public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) { if (!worldIn.isRemote && !entityIn.isPassenger() && !entityIn.isBeingRidden() && entityIn.isNonBoss() && VoxelShapes.compare(VoxelShapes.create(entityIn.getBoundingBox().offset((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()))), state.getShape(worldIn, pos), IBooleanFunction.AND)) { entityIn.changeDimension(worldIn.dimension.getType() == DimensionType.OVERWORLD ? DimensionType.OVERWORLD : (DimensionType) DimensionInit.USA_DIMENSION.get().getFactory()); } } } So I'm trying to make a portal for a custom dimension. Right now I'm just trying to get it to teleport you to this dimension when you touch it, and so far that's not working. When I come into contact with this block in the overworld, all it does is spawn a nether portal where I'm standing (or teleports me to a nearby one). If I try to do it in the custom dimension the game crashes. Any advice on how I can get this to work properly is appreciated.
  3. Trying to figure out how to make a portal, that may work
  4. So I'm trying to make a custom event for when a player comes into contact with a specific block. I've successfuly used premade events (like PlayerLoggedInEvent) to accomplish different tasks, but I can't seem to find any events I can use for when a player comes into contact with a certain modded block. I've been looking the referenced libraries trying to figure out how to make an event, but nothings working. Ant advice on how to accomplish this would be appreciated.
  5. Ok it seems to be working better now. Still something I need to mess with, but it actually works now. Thank you!
  6. https://pastebin.com/uh6LSbhy https://pastebin.com/99JDmpeK First is crash, second is the class file which attempts to spawn the entity
  7. Missile m1 = new Missile(ModEntityTypes.MISSILE_ENTITY.get(), this.world); This doesn't give me an error in eclipse, but crashes the game. What do I put there?
  8. package com.sonniccub.racismmod.init; import com.sonniccub.racismmod.racismmod; import com.sonniccub.racismmod.entities.Cop; import com.sonniccub.racismmod.entities.Missile; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class ModEntityTypes { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, racismmod.MOD_ID); public static final RegistryObject<EntityType<Cop>> COP_ENTITY = ENTITY_TYPES.register("cop", () -> EntityType.Builder.<Cop>create(Cop::new, EntityClassification.MONSTER) .size(1f, 2f) .build(new ResourceLocation(racismmod.MOD_ID, "cop").toString())); public static final RegistryObject<EntityType<Missile>> MISSILE_ENTITY = ENTITY_TYPES.register("missile", () -> EntityType.Builder.<Missile>create(Missile::new, EntityClassification.MONSTER) .size(1f, 1f) .build(new ResourceLocation(racismmod.MOD_ID, "missile").toString())); } Is this what you mean? I can /summon it into the game, but I just don't know what to put there, everything I've tried gives me an error
  9. So I'm still sorta lost on how to spawn an entity. I'm pretty sure i can use world.addentity to spawn it, but first I guess I need to make it using something like this: Missile m1 = new Missile(???, world); My question is what do I put instead of the three question marks? I tried putting null, and it just crashed my game when it should have started. Here is my missile class. package com.sonniccub.racismmod.entities; import java.util.Random; import com.sonniccub.racismmod.racismmod; import com.sonniccub.racismmod.init.ModEntityTypes; import net.minecraft.entity.EntityType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.MonsterEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.event.entity.living.LivingHurtEvent; @Mod.EventBusSubscriber(modid = racismmod.MOD_ID, bus = Bus.FORGE) public class Missile extends MonsterEntity { public Missile(EntityType<? extends MonsterEntity> type, World worldIn) { super(type, worldIn); } protected void registerAttributes() { super.registerAttributes(); this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(1D); this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.26F); } }
  10. nvm I figured it out, I had a capital where there shouldn't have been one my bad
  11. that doesn't seem to be working, could you give me an example of how its used?
  12. So I'm trying to spawn an entity from code, and I just don't know what command to use. As in not using the /summon command in minecraft. I found a way to do this with vanilla entities, but it doesn't seem to work with modded ones. Any advice on how to do this is appreciated!
  13. So like the title says, I wanted to make an event activate for one specific entity. This is the code I have so far, but I can't seem to get something to go after that == to make sure it only activates for the entity I want. @Mod.EventBusSubscriber(modid = racismmod.MOD_ID, bus = Bus.FORGE) public class MissileExplodeEvent { @SubscribeEvent public static void missileExplodeEvent(LivingHurtEvent event) { if(event.getSource() == DamageSource.FALL) { System.out.print(event.getEntity()); if(event.getEntity() == ) { } else { } } } } I'm trying to make this work for a custom entity, so if making a new event class isn't the way to do it, I am able to edit that entitie's class, Any help on how to do this would be appreciated.
  14. I fixed it. I just moved the if statement to a different area in that same file and it worked just fine
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.