Jump to content

OneHotEncoder

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by OneHotEncoder

  1. Couldn't I just as well use access transformers then? Or is there a difference?
  2. I want to keep track of all my portal locations similar to what minecraft does with nether portals and PointOfInterest. I however can't use PointOfInterest since the PointOfInterestType constructor is private (and I want to avoid using access transformers if possible). I've looked into using a world capability (see my previous thread), but I hit a roadblock when realizing that a new ServerWorld instance is created each time I enter the dimension (resetting the capability data). How would I go about storing data without attaching it to anything?
  3. Yes I'm using Forge 1.15.2 Each portal location is stored as a BlockPos which can correspond to any one of the portal blocks that make up the portal. Do you mean that each time the player is teleported I should scan all nearby blocks and see if there is a portal block among them? That would certainly work but kinda seems like a cheap solution, I'd prefer to actually store the locations if it doesn't turn out to be way harder than imagined.
  4. I'm trying to use world capabilities to keep track of all portal locations for my custom dimension (know that PointOfInterest exists but PointOfInterestType constructor is private). The problem is that the AttachCapabilitiesEvent is fired each time the player is transported to my dimension (but not when the player is transported to the overworld from my dimension). It almost seems like a new ServerWorld instance is created each time? So the portal locations in my dimension are lost. Below is the code which registers the capability. @Mod.EventBusSubscriber(MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class CapabilityEvents { @SubscribeEvent public static void onAttachWorldCapabilities(final AttachCapabilitiesEvent<World> event) { if (event.getObject() instanceof ServerWorld) { final ResourceLocation resourceLocation = new ResourceLocation(MOD_ID, "portal_locations"); event.addCapability(resourceLocation, new PortalLocations()); } } } I've tried to check if the world already has the capability attached by prepending the following code to the method, but it doesn't work. if (event.getObject().getCapability(ModCapabilityManager.PORTAL_LOCATIONS).isPresent()) { return; } What can I do to make sure that the capability doesn't "reset" each time I transport the player to my dimension? The code used to transport the player is a slightly modified version of ServerPlayerEntity#changeDimension
  5. The interaction with water seems to be implemented directly in the Entity class, so how can I make my fluid interact in the same way? I know that I could tag my fluid as water in /data/minecraft/tags/fluids/water.json. This would however result in the interaction between my fluid and water to stop working, so it isn't an option for me. Any help is appreciated
  6. Solution: Apparently there was nothing wrong with how I tried to render the fluid. The poblem was my FluidAttributes.Builder I had naively though that it would be enough to specify the rgb values of the fluid, but you also have to specify the alpha value (specifically set it to 0xff). Chaning my code from .color(0xa0e67a) to .color(0xffa0e67a) fixed the problem. Holy hell this took hours to find.
  7. I have managed to create a new liquid just fine, it works as expected. The problem is that I'd like for it to be translucent just like water. I'm learning by looking at the code for water, and my attempt at making the liquid translucent can be seen below: public static final Map<Fluid, RenderType> TYPES_BY_FLUID = Util.make(Maps.newHashMap(), (map) -> { final RenderType translucent = RenderType.getTranslucent(); map.put(FluidRegistry.FLOWING_ACID.get(), translucent); map.put(FluidRegistry.ACID.get(), translucent); }); @Mod.EventBusSubscriber(modid = Mod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ClientSetup { @SubscribeEvent public static void clientSetup(final FMLClientSetupEvent event) { TYPES_BY_FLUID.forEach(RenderTypeLookup::setRenderLayer); } } With this code the liquid however becomes invisible instead. I haven't been able to find anything else about how water is rendered so I'm feeling a bit stuck.
×
×
  • Create New...

Important Information

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