Skip to content

Commit

Permalink
Replacing a class with an anonymous implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Oct 20, 2024
1 parent b62504b commit ac39ff7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 70 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.imesense.dynamicspawncontrol.ProjectStructure;
import org.imesense.dynamicspawncontrol.ai.spider.util.attackweb.IWebSlinger;
import org.imesense.dynamicspawncontrol.ai.spider.util.attackweb.WebSlingerCapability;
import org.imesense.dynamicspawncontrol.ai.spider.util.attackweb.WebSlingerProvider;
import org.imesense.dynamicspawncontrol.debug.CodeGenericUtils;
import org.imesense.dynamicspawncontrol.technical.customlibrary.SimpleCapabilityProvider;
import org.imesense.dynamicspawncontrol.technical.customlibrary.thing.EntityThingBase;
import org.imesense.dynamicspawncontrol.technical.customlibrary.thing.IThingBase;
import org.imesense.dynamicspawncontrol.technical.customlibrary.thing.TileEntityThingBase;

/**
Expand Down Expand Up @@ -40,14 +42,25 @@ public synchronized void attachCapabilitiesTileEntity(AttachCapabilitiesEvent<Ti

if (doesIt(priority))
{
WebSlingerProvider provider = new WebSlingerProvider(
WebSlingerCapability.CAPABILITY,
WebSlingerCapability.DEFAULT_FACING,
new TileEntityThingBase(entity),
priority
);

event.addCapability(WebSlingerCapability.ID, provider);
event.addCapability(WebSlingerCapability.ID, new SimpleCapabilityProvider<IWebSlinger>
(
WebSlingerCapability.CAPABILITY,
WebSlingerCapability.DEFAULT_FACING,
WebSlingerCapability.CAPABILITY.getDefaultInstance())
{
private final int TASK_PRIORITY = priority;

private final IThingBase OWNER = new TileEntityThingBase(entity);

@Override
public IWebSlinger getInstance()
{
final IWebSlinger CAP = super.getInstance();
CAP.checkInit(this.OWNER, this.TASK_PRIORITY);

return CAP;
}
});
}
}

Expand All @@ -64,14 +77,25 @@ public synchronized void attachCapabilitiesEntity(AttachCapabilitiesEvent<Entity

if (doesIt(priority))
{
WebSlingerProvider provider = new WebSlingerProvider(
WebSlingerCapability.CAPABILITY,
WebSlingerCapability.DEFAULT_FACING,
new EntityThingBase(entity),
priority
);

event.addCapability(WebSlingerCapability.ID, provider);
event.addCapability(WebSlingerCapability.ID, new SimpleCapabilityProvider<IWebSlinger>
(
WebSlingerCapability.CAPABILITY,
WebSlingerCapability.DEFAULT_FACING,
WebSlingerCapability.CAPABILITY.getDefaultInstance())
{
private final int TASK_PRIORITY = priority;

private final IThingBase OWNER = new EntityThingBase(entity);

@Override
public IWebSlinger getInstance()
{
final IWebSlinger CAP = super.getInstance();
CAP.checkInit(this.OWNER, this.TASK_PRIORITY);

return CAP;
}
});
}
}

Expand Down

0 comments on commit ac39ff7

Please sign in to comment.